locked
How to get output files list RRS feed

  • Question

  • In VS2005/2008 I was able to get the list of output files for any project using IVsProjectCfg->EnumOutputs method. For VS2010 this method is obsolet. What can I use instead?
    Wednesday, February 2, 2011 10:53 AM

All replies

  • Hello,

     

    we should be able to get to the same information that you got to via EnumOutputs by using the IVsOutputGroup interface:

     

    Queryservice for SVsSolutionBuildManager

    call IVsSolutionBuildManager::FindActiveProjectcfg on the project IVsHierarchy

    cast to IVsProjectCfg2

    Call OpenoutputGroup (run a macro like below to get a feel for the outputgroup names)

    call get_outputs

      Sub CheckProjectOutputs()

            Dim v As VSProject

     

            v = DTE.Solution.Item(1).Object

     

            For Each o As OutputGroup In v.Project.ConfigurationManager.ActiveConfiguration.OutputGroups

     

                'MsgBox(o.DisplayName & " ")

                For Each f As String In o.FileNames

                    Debug.Print(o.DisplayName & " " & f)

                Next

            Next

     

    Outputs something like the following for a C# windows forms app

    Primary output WindowsFormsApplication1.exe

    Primary output WindowsFormsApplication1.exe.config

    Source Files Form1.cs

    Source Files Form1.Designer.cs

    Source Files Program.cs

    Source Files Properties\AssemblyInfo.cs

    Source Files Properties\Resources.Designer.cs

    Source Files Properties\Settings.Designer.cs

    Source Files Properties\Resources.resx

    Source Files WindowsFormsApplication1.exe.config

    Source Files WindowsFormsApplication1.csproj

    Debug Symbols WindowsFormsApplication1.pdb

     

     

      Sub CheckProjectOutputs()

            Dim v As VSProject

     

            v = DTE.Solution.Item(1).Object

     

            For Each o As OutputGroup In v.Project.ConfigurationManager.ActiveConfiguration.OutputGroups

     

                'MsgBox(o.DisplayName & " ")

                For Each f As String In o.FileNames

                    Debug.Print(o.DisplayName & " " & f)

                Next

            Next

     

     

    I hope that helps.

     

    thanks!


    bill boyce
    • Proposed as answer by billb08 - MSFT Thursday, February 10, 2011 3:48 PM
    • Marked as answer by David Zitzelsberger Thursday, February 10, 2011 6:43 PM
    • Unmarked as answer by VadimLuk Friday, March 4, 2011 2:41 AM
    Thursday, February 10, 2011 3:48 PM
  • Hello,

    thanks for the suggestion. Really, I need to know if dependent projects produce libraries. Unfortunately OutputGroups doesn't enumerate library name for DLL type of C++ project.

    EnumOutputs works in VS2005/VS2008 and outputs both .dll and .lib files for DLL projects.

    Thursday, February 17, 2011 2:11 PM