I have a solution of mixed VB.NET and C++ projects. When using Visual Studio 2005 you can set the "Tools->Option->Projects and Solutions->VC++ Directories" to help the compiler find your include files. When building the same solution with MSBuild I don't see how to pass these settings. The C++ won't compile without this path specified. When building this solution form Visual Studio it build perfectly.
What is the way to pass this path for MSBUild?
Edit: Looks like MSBuild doesn't pass the path (or the /u switch) to vcbuild. Starting from VCBuild instead fails on dependency.
Click on System and Security and then on System. In the left pane, click on Advanced system settings. At the very bottom of the pop up, click on Environment Variables. Edit the Path variable and append the folder's path that contains the MSBuild.exe to it (e.g., ;C:\Windows\Microsoft.NET\Framework64\v4.
MSBuild lets you set properties on the command line by using the -property (or -p) switch. These global property values override property values that are set in the project file. This includes environment properties, but does not include reserved properties, which cannot be changed.
If you've already installed it and want to change the location, you must uninstall Visual Studio and then reinstall it. In the Shared components, tools, and SDKs section, select the folder where you want to store the files that are shared by side-by-side Visual Studio installations.
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio. Select the Configuration Properties > C/C++ > General property page. Modify the Additional Include Directories property.
You can use /p[roperty]:useenv=true
switch to forward environment variables in newer versions of MSBuild. See full article here http://blogs.msdn.com/b/vcblog/archive/2010/01/11/vcbuild-vs-c-msbuild-on-the-command-line.aspx
...and also you may like to append %INCLUDE% and %LIB% to your variables to avoid overwriting of them
set INCLUDE=C:\Libraries\LibA\Include;%INCLUDE%
set LIB=C:\Libraries\LibA\Lib\x86;%LIB%
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