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.
To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.
To set the “MSBuildDisableNodeReuse” variable globally use the “Environment Variables” property page, which is accessed by right-clicking Computer, clicking Properties, and clicking the “Environment Variables” button under the “System Properties” dialog window Advanced tab.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With