How to pass linker options to msbuild via command line?
msbuild
Solution
Inside the projectfile the linker options are set in an `ItemGroup` so you cannot simply add or override this from the commandline. Instead you'll have to make msbuild include them which can only be done by importing another msbuild file. This functionality is supported: if you set the `ForceImportBeforeCppTargets` on the commandline, msbuild will import the file it points to.
Practically: create this file, let's call it c:\props\profile.props
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<Link>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
</Project>
Then build your (unmodified) project like this:
msbuild myProject.vcxproj /p:ForceImportBeforeCppTargets=c:\props\profile.props
Problem
Is it possible to pass options to linker via comamnd line of msbuild? For example I want to set VC linker option /PROFILE. How to do it without changing of C++ project file? PS: Visual Studio Express 2012.