I have two visual studio projects:
Project A,
Project B having a file which doesn't compile.
I have a visual studio solution which contains those two projects. I set a project dependency to have A that depends on B. The build order would be B, A.
When visual studio IDE builds the solution, the behaviour is:
Project B starts to compile and fails showing errors,
Project A starts to compile.
When msbuild builds the solution, it compiles project B, shows the errors and doesn't continue by compiling project A. I'm using the following command line to build the solution:
msbuild my.sln /target:Build /property:Configuration=Debug /property:Platform=x64
Why msbuild and visual studio IDE don't have the same behaviour by default?
Is there a simple way to have msbuild continuing on errors without defining a msbuild project file?
(I'm using visual studio 2015 and simple C++ projects)
Related
We're currently making a build environment for some of our projects.
In particular we're using VC++ 6.0 and VS2019 to build some of these projects.
When building our C++ project in VS2019 with the Platform Toolkit set to C++ 2015 v140, MSBuild attempts to use the VC++ 6.0 compiler to build the project. If I switch the Toolkit to any other version it builds with the correct cl.exe.
If I remove the VC98 folder that contains cl.exe from the path environment variable I get a cl.exe can't be found error in VS2019.
So I think there's something hardcoding the 2015 toolkit against the VC6.0 cl.exe.
I've tried installing and reinstalling the additional components in the VS Installer but no luck.
Repair of VS2019 didn't fix it either.
I've tried all versions of Visual Studio back to 2013 same issue.
This looks like an MSBuild issue, it's in the wrong location.
Is there any place where I can view the mapping for the toolkits in MSBuild? I couldn't see much in the registry.
The output when I build shows the following, the version is clearly a very old compiler (the VC6.0 one):
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Affects: Visual C++ in Visual Studio 2015
When I start a build on my project in the VS-Solution it compiles all the project's source files. If I do it again and I have nothing changed, the build is up to date. But if I build from console like:
msbuild c:\path\to\my\project\my-project.vcxproj /t:build /p:configuration=Debug /p:Platform=Win32 /p:VisualStudioVersion=14.0.25425.01
... the sources will be compiled again. (By building again in console, the build is up to date, too. On building after a console-build in VS, the build compiles all the project's source files.)
I noticed that my VS-Version (14.0.25425.01) differs from the showing console output (14.0.25420.1), so I added the /p:VisualStudioVersion=14.0.25425.01-Parameter.
But this did nothing (even the console's output is still to Microsoft (R)-Buildmodul, Version 14.0.25420.1).
Maybe this can be the problem? But if, How do i fix it?
I also noticed via the Windows TaskManager, that the MSBuild.exe-Runtime started by Visual Studio will be active until VS is exited. (In my console, the MSBuild.exe-runtime ends, when the build has finished.)
Another curious thing i've noticed is, that in my console sometimes MSBuild.exe is started from C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE (as always from Visual Studio) and sometimes MSBuild.exe is started from C:\Program Files (x86)\MSBuild\14.0\Bin. By comparing those files, they're identical.
I have machine with VC++ Express Edition installed. And also .Net frameworks 2-4. I want to use msbuild through command line to build a VC++ project.
Issue is the build runs fine for Configuration=Debug;Platform=Win32 but for Configuration=Debug;Platform=x64 it gives an error that:
"….vcproj" (Clean;Build target) (1) ->
(Clean target) ->
vcbuild.exe : error VCBLD0004: Project ….vcproj' does not contain a configuration called 'Debug|x64'.
However if I view .csproj file directly it does have that configuration. I feel the issue is the missing x64 build tools. But while installing VC++ Express Edition it doesn't give an option to include x64 build tools like you get during complete Visual Studio 2008 installation.
So how can I get around that given that, I can't install a complete VS like there is on development environment because of several restriction.
I have problem with MSIL dll after build solution.
I have 2 solution build one by one. Solution are builded on Jenkins with these parameters:
/t:Rebuild /p:Configuration=Release /p:TargetFramework=v4.0 /p:Platform=x86
Solution 1
Project A
Project B
Project C
Solution 2
Project D
Project E
Project F - has project reference to Project A. Project A is not included to Solution 2.
All project has output to common\bin folder. After build ends, in bin folder I find Project A builded in MSIL. Solution 2 replace it these dll.
I use MSBUILD from .NET 4.0.30319 folder.
I remove from solution AnyCPU and Mixed mode. Alse I removed this configuration from each project.
How to tell MSBUILD to build each project in x86 platform?
you are doing the right thing. Its just you need to use /p:PlatformTarget=x86 instead of /p:Platform=x86
I have to compile a Visual C++ solution from command line. I can't do it with devenv.exe but can install .Net Framework SDK. Can I use the solution and project files to compile from the command line? If so how?
If the .net framework SDK comes with msbuild, then just invoke:
msbuild mysolution.sln
That will cause a msbuild project to be generated from the solution, and the msbuild project will in turn instigate a call-out to vcbuild. All solution level and project level dependencies will then be resolved and built in-order as needed.