Set Project setting in Solution

S

sippyuconn

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
 
J

Jialiang Ge [MSFT]

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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelWorkbook4",
"ExcelWorkbook4\ExcelWorkbook4.csproj",
"{63A08F02-7E57-40FB-A330-651A4078531B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1",
"ClassLibrary1\ClassLibrary1.csproj",
"{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{63A08F02-7E57-40FB-A330-651A4078531B}.Debug|Any CPU.ActiveCfg =
Debug|Any CPU
{63A08F02-7E57-40FB-A330-651A4078531B}.Debug|Any CPU.Build.0 = Debug|Any
CPU
{63A08F02-7E57-40FB-A330-651A4078531B}.Release|Any CPU.ActiveCfg =
Release|Any CPU
{63A08F02-7E57-40FB-A330-651A4078531B}.Release|Any CPU.Build.0 =
Release|Any CPU
{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.Debug|Any CPU.ActiveCfg =
Debug|Any CPU
{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.Debug|Any CPU.Build.0 = Debug|Any
CPU
{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.Release|Any CPU.ActiveCfg =
Release|Any CPU
{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.Release|Any CPU.Build.0 =
Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================

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

GlobalSection(ProjectConfigurationPlatforms) = postSolution
{63A08F02-7E57-40FB-A330-651A4078531B}.Debug|Any CPU.ActiveCfg =
Release|Any CPU
{63A08F02-7E57-40FB-A330-651A4078531B}.Debug|Any CPU.Build.0 =
Release|Any CPU
{63A08F02-7E57-40FB-A330-651A4078531B}.Release|Any CPU.ActiveCfg =
Release|Any CPU
{63A08F02-7E57-40FB-A330-651A4078531B}.Release|Any CPU.Build.0 =
Release|Any CPU
{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.Debug|Any CPU.ActiveCfg =
Release|Any CPU
{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.Debug|Any CPU.Build.0 =
Release|Any CPU
{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.Release|Any CPU.ActiveCfg =
Release|Any CPU
{98195D15-6E19-4798-9FF9-0A2D05F7CF2C}.Release|Any CPU.Build.0 =
Release|Any CPU
EndGlobalSection

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

Hope it helps.

Regards,
Jialiang Ge ([email protected], 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:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#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/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jialiang Ge [MSFT]

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 ([email protected], 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:
(e-mail address removed).

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

sippyuconn

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
 
J

Jialiang Ge [MSFT]

Hello

Please try this macro:

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

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

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

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.ProjectItem
For Each projectItem In proj.ProjectItems
If Not (projectItem.SubProject Is Nothing) Then
' Recurse, can be an Enterprise project in
' Visual Studio .NET 2002/2003 or a solution folder in
VS 2005
ResetOutputPath(projectItem.SubProject, outputPath)
End If
Next
Else

proj.ConfigurationManager.Item(2).Properties.Item("OutputPath").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 ([email protected], 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:
(e-mail address removed).

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top