none
ABOUT EXAMPLE: How to Open Properties Window for Default Project with Macro

    Discussione generale

  • Hi there!

    This is not a question, but a tip. I'd like to start a discussion and not a question, but I couldn't find this option.

    Spaso Lazarevic gave us a nice code example about how to open property window for default LS project using VS Macro.

    If you use Spaso's code with a solution that has just one project, the macro won't work.

    I had to make some changes to Spaso's macro work: I added the following code:

    If DTE.Solution.Projects.Count = 1 Then
                fullItemName = startupProject
            End If
    So, the final sub ShowProjectProperties code is:
    Private Sub ShowProjectProperties()
            Dim command As Integer = 1537 'Logical View
            Dim solutionName As String = DTE.Solution.Properties.Item("Name").Value
            Dim startupProject As String = DTE.Solution.Properties.Item("StartupProject").Value
            Dim fullItemName As String = Path.Combine(solutionName, PROJECTS_FOLDER, startupProject)
    
            If DTE.Solution.Projects.Count = 1 Then
                fullItemName = startupProject
            End If
    
            Try
                DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate()
                DTE.ActiveWindow.Object.GetItem(fullItemName).Select(vsUISelectionType.vsUISelectionTypeSelect)
                DTE.Commands.Raise("{1EF45AAF-900D-418E-8668-0F84C8404E52}", command, Customin, Customout)
    
                DTE.ActiveWindow.Object.GetItem(fullItemName).Select(vsUISelectionType.vsUISelectionTypeSelect)
                DTE.ExecuteCommand("ClassViewContextMenus.ClassViewMultiselectProjectreferencesItems.Properties")
            Catch ex As Exception
                Exit Sub
            End Try
        End Sub

    I hode this tip helps you.

    If you find this tip useful, please, vote +1.

    Best regards,


    Ciro

    domenica 15 aprile 2012 16:25

Tutte le risposte

  • In the furture, please change the post to discussion if you know it's not a question.

    Justin Anderson, LightSwitch Development Team

    domenica 15 aprile 2012 18:37
  • It appears that the option for marking a post as a discussion is missing - in this forum only. The option is still there in the Beta forum. I'll follow up with the Forums team.

    Steve Hoag Microsoft aka the Lights Witch (IEnumerable of Newt)

    domenica 15 aprile 2012 22:15
  • It appears that the option for marking a post as a discussion is missing - in this forum only. The option is still there in the Beta forum. I'll follow up with the Forums team.

    Steve Hoag Microsoft aka the Lights Witch (IEnumerable of Newt)

    In this forum you have to first save the post as a Question, then you can go back and change it to a Discussion.

    ... but umm yeah may be better if you just get it fixed :) :)


    The Visual Studio LightSwitch Marketplace

    http://LightSwitchHelpWebsite.com

    lunedì 16 aprile 2012 04:03
  • It's fixed now. The option to post a discussion was inadvertantly turned off.

    Steve Hoag Microsoft aka the Lights Witch (IEnumerable of Newt)

    lunedì 16 aprile 2012 18:22