Clean Selection Only or Build Selection Only 
Author Message
 Clean Selection Only or Build Selection Only

Anyone know how to do this with the new enviroment?


Sun, 10 Oct 2004 02:59:36 GMT  
 Clean Selection Only or Build Selection Only

It's currently not directly support in the VS7 IDE , but here is a sample
VS Macro that will work for VC Projects only. Once you add these macros,
you can them customize the menus or tools bars to bind the macros for quick
use.

To add the macro below

- Tools->Macros->Macros IDE

- Right Click on the "MyMacros" project node in the Macro IDE, and choose
Add References.

- Add the References to Microsoft.VisualStudio.VCProjectEngine

- Expand the MyMacros project node

- Double Click on the Module1 file
-  Add the following Imports statement:

Imports Microsoft.VisualStudio.VCProjectEngine

- Paste the code below into the Module1 block

- Save it and close the IDE

To bind a tool bar button

- Right Click on a tool bar in the VS IDE

- Select "Customize"

- Commands Tab

- Select "Macro" (at the bottom of the list) in the "Categories list

- Select these two new macros in commands list

- Drag them to a tool bar location out of the list control.

Use:

- Select a project in the solution, and click on your tool button you added.

========== Start Code

    Sub BuildSelection()

        ' this will only work on one selected VC Project in the Solution
Explorer

        Dim cppkind As String = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"

        Dim config As SolutionConfiguration =
DTE.Solution.SolutionBuild.ActiveConfiguration

        Dim projs As System.Array

        Dim proj As Project

        Dim vcprj As VCProject

        Dim vcconfig As VCConfiguration

        ' which project is selected

        projs = DTE.ActiveSolutionProjects()

        If projs.Length = 1 Then

            proj = CType(projs.GetValue(0), EnvDTE.Project)

            ' make sure we have a C++ project

            If proj.Kind() <> cppkind Then

                MsgBox("Must be a VC++ Project")

                GoTo done

            End If

            ' need to work right off the VC Project Object directly for this

            vcprj = proj.Object()

            vcconfig = vcprj.Configurations(config.Name() + "|Win32")

            ' Build it

            vcconfig.Build()

        Else

            MsgBox("Single VC Project must be selected")

        End If

done:

    End Sub

    Sub CleanSelection()

        Dim cppkind As String = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"

        Dim config As SolutionConfiguration =
DTE.Solution.SolutionBuild.ActiveConfiguration

        Dim projs As System.Array

        Dim proj As Project

        Dim vcprj As VCProject

        Dim vcconfig As VCConfiguration

        projs = DTE.ActiveSolutionProjects()

        If projs.Length = 1 Then

            proj = CType(projs.GetValue(0), EnvDTE.Project)

            If proj.Kind() <> cppkind Then

                MsgBox("Must be a VC++ Project")

                GoTo done

            End If

            vcprj = proj.Object()

            vcconfig = vcprj.Configurations(config.Name() + "|Win32")

            vcconfig.Clean()

        Else

            MsgBox("Single VC Project must be selected")

        End If

done:

End Sub

========== End Code

Thank you,
Bobby Mattappally
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:

>Anyone know how to do this with the new enviroment?



Tue, 12 Oct 2004 06:53:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Build/Clean Selection Only in Visual Studio.NET

2. Batch Build dialog selections

3. Pre-clean step in VC Project (like Post-build)

4. Batch Build...Clean

5. Default item selection in Context Menu

6. selection of all databases fails partially

7. Hide selections in a checkedlistbox?

8. Invisible selection i RichTextBox

9. DataGrid Selection

10. Directory Selection in System.Windows.Forms.OpenFileDialog

11. CListCtrl Extended Selection w/ a mouse

12. simulate xp's selection tool

 

 
Powered by phpBB® Forum Software