Set Project setting in Solution

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?c2lwcHl1Y29ubg==?=

    Set Project setting in Solution

    Hi

    I have a solution with 50 projects. They are all compiled in DEBUG mode and
    the output path has been modified to a custom directory

    I now want to build RELEASE mode and the Output Path needs to be reset for
    all the project to the custom directory

    Is there an easy way to do this besides opening 50 projects???

    - I was going to write a pgm to go to all directories and csproj files and
    edit that property ??? Anything easier???

    Thanks

  • Jialiang Ge [MSFT]

    #2
    RE: Set Project setting in Solution

    Hello sippyuconn,

    Are your 50 projects in one solution (sln)? If yes, I may have an easier
    way to build the projects in Release mode.

    First, let's look at a sample sln file:

    =============== =============== =============== ===
    Microsoft Visual Studio Solution File, Format Version 10.00
    # Visual Studio 2008
    Project("{FAE04 EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelWorkbook4 ",
    "ExcelWorkbook4 \ExcelWorkbook4 .csproj",
    "{63A08F02-7E57-40FB-A330-651A4078531B}"
    EndProject
    Project("{FAE04 EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1" ,
    "ClassLibrary1\ ClassLibrary1.c sproj",
    "{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}"
    EndProject
    Global
    GlobalSection(S olutionConfigur ationPlatforms) = preSolution
    Debug|Any CPU = Debug|Any CPU
    Release|Any CPU = Release|Any CPU
    EndGlobalSectio n
    GlobalSection(P rojectConfigura tionPlatforms) = postSolution
    {63A08F02-7E57-40FB-A330-651A4078531B}.D ebug|Any CPU.ActiveCfg =
    Debug|Any CPU
    {63A08F02-7E57-40FB-A330-651A4078531B}.D ebug|Any CPU.Build.0 = Debug|Any
    CPU
    {63A08F02-7E57-40FB-A330-651A4078531B}.R elease|Any CPU.ActiveCfg =
    Release|Any CPU
    {63A08F02-7E57-40FB-A330-651A4078531B}.R elease|Any CPU.Build.0 =
    Release|Any CPU
    {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.D ebug|Any CPU.ActiveCfg =
    Debug|Any CPU
    {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.D ebug|Any CPU.Build.0 = Debug|Any
    CPU
    {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.R elease|Any CPU.ActiveCfg =
    Release|Any CPU
    {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.R elease|Any CPU.Build.0 =
    Release|Any CPU
    EndGlobalSectio n
    GlobalSection(S olutionProperti es) = preSolution
    HideSolutionNod e = FALSE
    EndGlobalSectio n
    EndGlobal
    =============== =============== =============== ===

    This sln will build its projects to Debug Mode. We can update the
    postSolution section to:

    GlobalSection(P rojectConfigura tionPlatforms) = postSolution
    {63A08F02-7E57-40FB-A330-651A4078531B}.D ebug|Any CPU.ActiveCfg =
    Release|Any CPU
    {63A08F02-7E57-40FB-A330-651A4078531B}.D ebug|Any CPU.Build.0 =
    Release|Any CPU
    {63A08F02-7E57-40FB-A330-651A4078531B}.R elease|Any CPU.ActiveCfg =
    Release|Any CPU
    {63A08F02-7E57-40FB-A330-651A4078531B}.R elease|Any CPU.Build.0 =
    Release|Any CPU
    {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.D ebug|Any CPU.ActiveCfg =
    Release|Any CPU
    {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.D ebug|Any CPU.Build.0 =
    Release|Any CPU
    {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.R elease|Any CPU.ActiveCfg =
    Release|Any CPU
    {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.R elease|Any CPU.Build.0 =
    Release|Any CPU
    EndGlobalSectio n

    And build the solution (not the individual projects), to get the Release
    outputs.

    Hope it helps.

    Regards,
    Jialiang Ge (jialge@online. microsoft.com, remove 'online.')
    Microsoft Online Community Support

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    msdnmg@microsof t.com.

    =============== =============== =============== =====
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subs...#notifications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://support.microsoft.com/select/...tance&ln=en-us.
    =============== =============== =============== =====
    This posting is provided "AS IS" with no warranties, and confers no rights.


    Comment

    • =?Utf-8?B?c2lwcHl1Y29ubg==?=

      #3
      RE: Set Project setting in Solution

      Hi Thanks for the reply

      The 50 projects are in 1 solution - the issue is not so much DEBUG/RELEASE
      but the out put path

      <OutputPath>..\ ..\EXE\</OutputPath>

      In DEBUG mode all these paths were changed to above for testing - now we
      need to change for RELEASE - I was looking for an easy way to do that??


      Project1

      <Project ToolsVersion="3 .5" DefaultTargets= "Build"
      xmlns="http://schemas.microso ft.com/developer/msbuild/2003">
      <PropertyGrou p>
      <Configuratio n Condition=" '$(Configuratio n)' == ''
      ">Debug</Configuration>
      <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
      <ProductVersion >9.0.21022</ProductVersion>
      <SchemaVersion> 2.0</SchemaVersion>
      <ProjectGuid>{E 8F17DC3-25E9-4822-8C23-808BFBBF1652}</ProjectGuid>
      <OutputType>Lib rary</OutputType>
      <AppDesignerFol der>Properties</AppDesignerFold er>
      <RootNamespace> DbMetaData</RootNamespace>
      <AssemblyName>D bMetaData</AssemblyName>
      <TargetFramewor kVersion>v2.0</TargetFramework Version>
      <FileAlignment> 512</FileAlignment>
      </PropertyGroup>
      <PropertyGrou p Condition=" '$(Configuratio n)|$(Platform)' ==
      'Debug|AnyCPU' ">
      <DebugSymbols>t rue</DebugSymbols>
      <DebugType>full </DebugType>
      <Optimize>false </Optimize>
      <OutputPath>..\ ..\EXE\</OutputPath>
      <DefineConstant s>DEBUG;TRACE</DefineConstants >
      <ErrorReport>pr ompt</ErrorReport>
      <WarningLevel>4 </WarningLevel>
      </PropertyGroup>
      <PropertyGrou p Condition=" '$(Configuratio n)|$(Platform)' ==
      'Release|AnyCPU ' ">
      <DebugType>pdbo nly</DebugType>
      <Optimize>tru e</Optimize>
      <OutputPath>bin \Release\</OutputPath>
      <DefineConstant s>TRACE</DefineConstants >
      <ErrorReport>pr ompt</ErrorReport>
      <WarningLevel>4 </WarningLevel>
      </PropertyGroup>
      <ItemGroup>
      <Reference Include="System " />
      <Reference Include="System .Data" />
      <Reference Include="System .Xml" />
      </ItemGroup>



      Project 2

      <Project ToolsVersion="3 .5" DefaultTargets= "Build"
      xmlns="http://schemas.microso ft.com/developer/msbuild/2003">
      <PropertyGrou p>
      <Configuratio n Condition=" '$(Configuratio n)' == ''
      ">Debug</Configuration>
      <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
      <ProductVersion >9.0.21022</ProductVersion>
      <SchemaVersion> 2.0</SchemaVersion>
      <ProjectGuid>{D A6168C4-C21D-441A-BF1A-16BD89A50DC1}</ProjectGuid>
      <OutputType>Win Exe</OutputType>
      <AppDesignerFol der>Properties</AppDesignerFold er>
      <RootNamespace> BuildMetaDataFr omDb</RootNamespace>
      <AssemblyName>B uildMetaDataFro mDb</AssemblyName>
      <TargetFramewor kVersion>v2.0</TargetFramework Version>
      <FileAlignment> 512</FileAlignment>
      </PropertyGroup>
      <PropertyGrou p Condition=" '$(Configuratio n)|$(Platform)' ==
      'Debug|AnyCPU' ">
      <DebugSymbols>t rue</DebugSymbols>
      <DebugType>full </DebugType>
      <Optimize>false </Optimize>
      <OutputPath>..\ ..\EXE\</OutputPath>
      <DefineConstant s>DEBUG;TRACE</DefineConstants >
      <ErrorReport>pr ompt</ErrorReport>
      <WarningLevel>4 </WarningLevel>
      </PropertyGroup>
      <PropertyGrou p Condition=" '$(Configuratio n)|$(Platform)' ==
      'Release|AnyCPU ' ">
      <DebugType>pdbo nly</DebugType>
      <Optimize>tru e</Optimize>
      <OutputPath>bin \Release\</OutputPath>
      <DefineConstant s>TRACE</DefineConstants >
      <ErrorReport>pr ompt</ErrorReport>
      <WarningLevel>4 </WarningLevel>
      </PropertyGroup>
      <ItemGroup>




      ""Jialiang Ge [MSFT]"" wrote:
      Hello sippyuconn,
      >
      Are your 50 projects in one solution (sln)? If yes, I may have an easier
      way to build the projects in Release mode.
      >
      First, let's look at a sample sln file:
      >
      =============== =============== =============== ===
      Microsoft Visual Studio Solution File, Format Version 10.00
      # Visual Studio 2008
      Project("{FAE04 EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelWorkbook4 ",
      "ExcelWorkbook4 \ExcelWorkbook4 .csproj",
      "{63A08F02-7E57-40FB-A330-651A4078531B}"
      EndProject
      Project("{FAE04 EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1" ,
      "ClassLibrary1\ ClassLibrary1.c sproj",
      "{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}"
      EndProject
      Global
      GlobalSection(S olutionConfigur ationPlatforms) = preSolution
      Debug|Any CPU = Debug|Any CPU
      Release|Any CPU = Release|Any CPU
      EndGlobalSectio n
      GlobalSection(P rojectConfigura tionPlatforms) = postSolution
      {63A08F02-7E57-40FB-A330-651A4078531B}.D ebug|Any CPU.ActiveCfg =
      Debug|Any CPU
      {63A08F02-7E57-40FB-A330-651A4078531B}.D ebug|Any CPU.Build.0 = Debug|Any
      CPU
      {63A08F02-7E57-40FB-A330-651A4078531B}.R elease|Any CPU.ActiveCfg =
      Release|Any CPU
      {63A08F02-7E57-40FB-A330-651A4078531B}.R elease|Any CPU.Build.0 =
      Release|Any CPU
      {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.D ebug|Any CPU.ActiveCfg =
      Debug|Any CPU
      {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.D ebug|Any CPU.Build.0 = Debug|Any
      CPU
      {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.R elease|Any CPU.ActiveCfg =
      Release|Any CPU
      {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.R elease|Any CPU.Build.0 =
      Release|Any CPU
      EndGlobalSectio n
      GlobalSection(S olutionProperti es) = preSolution
      HideSolutionNod e = FALSE
      EndGlobalSectio n
      EndGlobal
      =============== =============== =============== ===
      >
      This sln will build its projects to Debug Mode. We can update the
      postSolution section to:
      >
      GlobalSection(P rojectConfigura tionPlatforms) = postSolution
      {63A08F02-7E57-40FB-A330-651A4078531B}.D ebug|Any CPU.ActiveCfg =
      Release|Any CPU
      {63A08F02-7E57-40FB-A330-651A4078531B}.D ebug|Any CPU.Build.0 =
      Release|Any CPU
      {63A08F02-7E57-40FB-A330-651A4078531B}.R elease|Any CPU.ActiveCfg =
      Release|Any CPU
      {63A08F02-7E57-40FB-A330-651A4078531B}.R elease|Any CPU.Build.0 =
      Release|Any CPU
      {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.D ebug|Any CPU.ActiveCfg =
      Release|Any CPU
      {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.D ebug|Any CPU.Build.0 =
      Release|Any CPU
      {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.R elease|Any CPU.ActiveCfg =
      Release|Any CPU
      {98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.R elease|Any CPU.Build.0 =
      Release|Any CPU
      EndGlobalSectio n
      >
      And build the solution (not the individual projects), to get the Release
      outputs.
      >
      Hope it helps.
      >
      Regards,
      Jialiang Ge (jialge@online. microsoft.com, remove 'online.')
      Microsoft Online Community Support
      >
      Delighting our customers is our #1 priority. We welcome your comments and
      suggestions about how we can improve the support we provide to you. Please
      feel free to let my manager know what you think of the level of service
      provided. You can send feedback directly to my manager at:
      msdnmg@microsof t.com.
      >
      =============== =============== =============== =====
      Get notification to my posts through email? Please refer to
      http://msdn.microsoft.com/en-us/subs...#notifications.
      >
      Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
      where an initial response from the community or a Microsoft Support
      Engineer within 1 business day is acceptable. Please note that each follow
      up response may take approximately 2 business days as the support
      professional working with you may need further investigation to reach the
      most efficient resolution. The offering is not appropriate for situations
      that require urgent, real-time or phone-based interactions or complex
      project analysis and dump analysis issues. Issues of this nature are best
      handled working with a dedicated Microsoft Support Engineer by contacting
      Microsoft Customer Support Services (CSS) at
      http://support.microsoft.com/select/...tance&ln=en-us.
      =============== =============== =============== =====
      This posting is provided "AS IS" with no warranties, and confers no rights.
      >
      >
      >

      Comment

      • Jialiang Ge [MSFT]

        #4
        RE: Set Project setting in Solution

        Hello Nick,

        I am writing to check the status of the issue on your side. Would you mind
        letting me know the result of the suggestions? Please let me know your
        concerns and I will do my best to find the workarounds for you.

        Have a great day!

        Regards,
        Jialiang Ge (jialge@online. microsoft.com, remove 'online.')
        Microsoft Online Community Support

        =============== =============== =============== ====
        Delighting our customers is our #1 priority. We welcome your comments and
        suggestions about how we can improve the support we provide to you. Please
        feel free to let my manager know what you think of the level of service
        provided. You can send feedback directly to my manager at:
        msdnmg@microsof t.com.

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

        Comment

        • =?Utf-8?B?c2lwcHl1Y29ubg==?=

          #5
          RE: Set Project setting in Solution

          Hi

          Your suggestion did not address my issue

          I was concerned about changing the Output path on each project(50)
          If I have edited the Path for Debug and I want to have that Path for Release
          - I need to edit 50 projects

          I was going to write a script to go thru 50 .csproj file

          Is there an easier way???
          -macro ???
          etc

          Thanks


          ""Jialiang Ge [MSFT]"" wrote:
          Hello Nick,
          >
          I am writing to check the status of the issue on your side. Would you mind
          letting me know the result of the suggestions? Please let me know your
          concerns and I will do my best to find the workarounds for you.
          >
          Have a great day!
          >
          Regards,
          Jialiang Ge (jialge@online. microsoft.com, remove 'online.')
          Microsoft Online Community Support
          >
          =============== =============== =============== ====
          Delighting our customers is our #1 priority. We welcome your comments and
          suggestions about how we can improve the support we provide to you. Please
          feel free to let my manager know what you think of the level of service
          provided. You can send feedback directly to my manager at:
          msdnmg@microsof t.com.
          >
          This posting is provided "AS IS" with no warranties, and confers no rights.
          =============== =============== =============== ====
          >
          >

          Comment

          • Jialiang Ge [MSFT]

            #6
            RE: Set Project setting in Solution

            Hello

            Please try this macro:

            It enumerates all the projects in the solution and reset the output path of
            the release build with
            proj.Configurat ionManager.Item (2).Properties. Item("OutputPat h").Value =
            outputPath

            *************** *************** *************** *************** **
            Public Sub ResetSolutionRe leaseOutput()
            Dim project As Project
            Dim projectObjects As EnvDTE.Projects

            Dim outputPath = "bin\Test"
            'get all the projects in the current solution
            projectObjects = DTE.Solution.Pr ojects

            For Each project In projectObjects
            ResetOutputPath (project, outputPath)
            Next

            End Sub

            Sub ResetOutputPath (ByVal proj As Project, ByVal outputPath As String)
            If (proj.Kind = "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}") Then
            ' a folder
            ' check the sub items
            Dim projectItem As EnvDTE.ProjectI tem
            For Each projectItem In proj.ProjectIte ms
            If Not (projectItem.Su bProject Is Nothing) Then
            ' Recurse, can be an Enterprise project in
            ' Visual Studio .NET 2002/2003 or a solution folder in
            VS 2005
            ResetOutputPath (projectItem.Su bProject, outputPath)
            End If
            Next
            Else

            proj.Configurat ionManager.Item (2).Properties. Item("OutputPat h").Value =
            outputPath
            End If
            End Sub
            *************** *************** *************** *************** **

            Please let me know whether it works for you. If you have any other
            questions or concerns, DON'T hesitate to tell me

            Have a nice weekend!
            Regards,
            Jialiang Ge (jialge@online. microsoft.com, remove 'online.')
            Microsoft Online Community Support

            =============== =============== =============== ====
            Delighting our customers is our #1 priority. We welcome your comments and
            suggestions about how we can improve the support we provide to you. Please
            feel free to let my manager know what you think of the level of service
            provided. You can send feedback directly to my manager at:
            msdnmg@microsof t.com.

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

            Comment

            Working...