Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Solution with 1 Project(VC++), In *.vcxproj file OutDir is set to fixed path as below:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>C:\Program Files\MainEnviroment\bin\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>

If i execute below command then dll will be outputed to "D:\Sample\bin" folder. This is OK:
[devenv.exe *.sln /build "debug|any cpu" /out "c:\buildlog.txt"]
However i want to able to specify a OutDir to output dll to. Such as:
[devenv.exe *.sln /build "debug|any cpu" /OutDir "C:\Program Files\MainEnviroment\bin\" /out "c:\buildlog.txt"]
Note: if I use MSBuild then the above problem can be solved. However, for my own reasons I didn't use it.

So is there any option that allows specifying OutDir in the above command?
Or is there any way which using devenv to build Solution to specified OutDir?

I wish the experts can suggest me a way to solve this problem.

Thanks!!

What I have tried:

I searched GG with many key words however i haven't still found solution.
I wish the experts can suggest me a way to solve this problem.
Posted
Updated 24-Nov-21 3:54am
v7
Comments
phil.o 23-Nov-21 6:50am    
This may seem silly, but why don't you use the dedicated editor which is integrated right into Visual Studio? Moreover, the sample you have shown is not valid xml. Please make sure to post acurate informations :)
alex giulio 23-Nov-21 22:26pm    
Dear Phil.o,
Thank for ur feedback,

The context is that I have multiple source branches, where each source branch is having multiple sln. By default, the dlls of the projects must be built to the fixed OutDir path "C/Program Files/MainEnviroment/bin", which contains the environment for other apps to ref to.
Currently, I am developing a tool to automatically build all dlls of a certain source branch into the specified OutDir, for example "C/Program Files/BackupEnviroment/bin". The goal is to be able to build a new environment while the main environment is being referred.

Because the number of projects in a source branch is quite large, it is not possible to manually edit each one in visual.
phil.o 24-Nov-21 3:43am    
Ok I get it. Whenever I have to deal with a large number of projects in a solution, I use the Property Manager[^] feature of Visual Studio. Perhaps it could help you define families for output directories. I hope so.
alex giulio 24-Nov-21 12:32pm    
Thank for your reply!
Yes, i got it.

I think your solution is also quite ok, but for me it will probably be more complicated than I will change the build engine from devenv to msbuild.
Therefore I will choose the solution is to use msbuild.
phil.o 24-Nov-21 12:39pm    
No problem, I'm glad you found something to work with :)

If it were me, I would use MSBuild to build all of the projects where they sit, parse all of the solution and project files to find their configured output folders, and then copy all of the \bin files to the desired location.

I am currently working on an in-house tool that lets us pull code for user-selected apps from TFS, build them with MSBuild, and then create deployment packages (zip files). If it weren't so specific to our own use, I'd write an article about it.
 
Share this answer
 
Use the property manager, like phil.o suggested! Define the output path in a file called Directory.build.props. then put this file in a parent folder above all of your project files.

The beauty of this approach is that this MSBuild will automatically import this .props file in each project, if it can find it either in the project directory, or any directory above that location. So you don't even need to change your existing project files! See Customize your build - MSBuild | Microsoft Docs[^] for more info.
 
Share this answer
 
Comments
alex giulio 24-Nov-21 12:36pm    
Dear Stefan_Lang,

Thank for ur reply,

Yes, i got it.
Currently I have chosen the solution is to change the build engine from devenv to msbuild and this problem has been solved.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900