I am trying to compile a Visual Studio 2019 project or solution using msbuild. But when I'm running a command, an error pops up in the command line
MSBUILD : error MSB1009: Project file does not exist.
Key: TestProject.sln
Here code that im using in .bat file:
set pathMSBuild = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\"
#echo off
cls
cd %pathMSBuild%
msbuild C:\TestProject\TestProject\TestProject.sln
pause
I don't understand why this is happening because I have specified the correct path to the project on the disk and I have it there. Any ideas why its happens?
Related
I just want to change the exe file Visual Studio compilation path change
I am doing it like this now. i created a bat file that copied file. I have added visual studio build events. I wonder if there is an easier way.
meanwhile the exe file is being copied to the network drive
I had this problem in a different context (Elixir/Phoenix, Rust), but the root cause was the same: cl.exe could not be found during compilation.
My setup was:
Windows 10, x64
Visual Studio Community 2017 already installed, but only for C# development
For some reason the solution with installing the Visual C++ Build Tools (as #cozzamara suggested) did not work. Stops during installation with some obscure error message. Guess it did not liked my existing Visual Studio installation.
This is how I solved it:
Start up the Visual Studio Installer
Check the Desktop development with C++ (screenshots here)
Execute following command before compiling:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
From this on the command cl.exe works. Alternatively (and more conveniently for development) start the application 'Developer Command Prompt for VS 2017' or 'x64 Native Tools Command Prompt VS 2017'.
Share
I solved the problem by writing code like this in the Post build field, I just ensured that the exe was copied to the field I wanted
COPY $(TargetPath) "\x.x.x.x\ortak\yakup\TestApp.exe"
pause
$(TargetPath) = It gives the location where the exe exited, along with the exe name
"C:\yakup\project\TestApp.exe" like
I'm running the following:
D:\GitRecompile>"c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" MyFolder\MyApp.sln /build "Debug"
It gives no error, no results, nothing. Almost like I just hit enter from the command line.
I'm trying to do a batch rebuild of several BizTalk Projects from the command line to make sure all code was checked-in corretly.
I also tried:
D:\GitRecompile>c:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild MyFolder\MyApp.sln /p:Configuration=Debug
It ran, but got a lot of errors, such as xxx.xsd.cs could not be found. BizTalk creates the .cs from the .xsd at build time; so it seems like the build should have created those files.
I am trying to build this project which generates a minified css file for my website, I moved the project files to a new PC with a new version of Visual Studio (2017 from 2010) and after some small issues I got solved, I am now feeling stumped. This is the error:
Error The command "C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe
"C:\Users\Dennis\Documents\Visual Studio
2017\Projects\minify-CSS\minify-CSS\MSbuild\msbuild.xml"
/p:ConfigurationName=Release" exited with code 9009.
I know the error is in the path, there's a space in the path and there's no citation marks around the path. I don't know why VS2017 fails at this. I navigated to the msbuild folder in the command prompt and ran the build command manually, the project compiled just fine. Anyone know where I can correct this so the path is put in citation marks, or otherwise get around this?
I got it to work. I opened the project file and found this line:
<PostBuildEvent>$(MSBuildBinPath)\msbuild.exe "$(ProjectDir)MSbuild\msbuild.xml" /p:ConfigurationName=$(ConfigurationName)</PostBuildEvent>
I just added citation marks around the first part and it started working. Like this
<PostBuildEvent>"$(MSBuildBinPath)\msbuild.exe" "$(ProjectDir)MSbuild\msbuild.xml" /p:ConfigurationName=$(ConfigurationName)</PostBuildEvent>
I use syntax like "%SDK_PATH%\sdk_dir\test.vcxproj" in .sln file.
And it is work fine for me from IDE.
But msbuildl does not understand this syntax and will emit a error MSB3202 ("The project file was not found.") when I use it from command line:
msbuild test.sln /p:Configuration=Debug
Is there a way to resolve this issue?
I want to create a batch file that builds several Visual Studio 2010 projects. My project property sheet is setup to use opencv, and building from Visual Studio works fine, but when I run the MSBuild command from cmd, it doesn't find the OpenCV header files. I get many of the following messages:
c:\proj\libproj\cvtrack.cpp(26): fatal error C1083: Cannot open include file: 'cv.h': No such file or directory [C:\proj\libproj\libproj.vcxproj]
Any ideas?
I fixed this by adding the following parameter to the MSBuild command, /p:Configuration=Release
, and then changein the project's Release properties.