Visual Studio 2017 fails to build project using msbuild - visual-studio-2010

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>

Related

Visual Studio Exe App compilation path change

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

Libjna build - LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'

I'm re-posting an issue from github (https://github.com/libffi/libffi/issues/538) I had since last week.
I'm currently having issue getting some JNA libraries built as jar deployables using Ant build script (FYI: https://github.com/thepaul/libjna-java). in order to use the APIs from this library for my other project. (The sole purpose of me going through the hassle building it is to be able to use its API. Due to lack of documentation and absence of existing build artifact provided, I had to do it myself. Importing the whole libjna repo as a project into my other project maybe another approach but I don't think it's appropriate. That said, if there're any better ways to use the libraries in libjna, do let me know!)
So here's what I did trying to build it into deployable jar file:
I already have the source project downloaded.
Tried to compile using Ant (which I downloaded the latest version) on cygwin. Failed because it requires libffi.
So I downloaded libffi source from here (https://github.com/libffi/libffi).
Tried to compile again using Ant. Failed because it couldn't find "/c/Program Files (x86)/Microsoft Visual Studio 9.0/vc/bin/cl" as mentioned in the config.log
So I inspected cc.sh and found that it refers to an older version of Microsoft Visual Studio. I have an existing installation of Visual Studio Express. So I changed the path to "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64" in cc.sh file.
Tried to complile again using Ant. Seemed the fix worked but failed with different error because it couldn't find "mspdbcore.dll". I found this file in "..\x86" so I copy the file across to ..\x64
Tried to compile again using Ant. Failed with similar error but different file because it couldn't find "mspdb140.dll". I found this file in "..\x86" so I copied over
Tried to compile again. Failed with different error because now it says
"LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'"
, although I could confirm this file is definitely in "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\lib\x64"
To tackle this error I tried (in vain):
adding microsoft visual studio paths to PATH
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64
C:\Program Files (x86)\Microsoft Visual
Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\lib\x64
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\Common7\IDE
Downloaded MS Visual Studio 2019 both Community and Professional (couldn't find those dlls for some reason)
Downloaded both mspdb140.dll and mspdbcore.dll separately, config.log says it can't find these files
Note I also did some research online, however:
I don't use visual studio IDE as I"m only trying to build it with Ant, so this post didn't really help much (LINK: fatal error LNK 1104: cannot open file 'LIBCMT.lib')
I don't really understand the answer to this post either (https://social.msdn.microsoft.com/Forums/en-US/cbedc1ba-c50b-499e-aa2e-12b0ce6a40ba/lnk1104-cannot-open-file-libcmtlib?forum=vclanguage)
So this is where I'm stuck.
See latest config log attached.
config.log
Also Ant build log attached.
ant_compile_error.txt
Anyone can help would be much appreciated!
Cheers
Dale

Visual studio cannot build projects error "The target "ResolveCodeAnalysisRuleSet" does not exist in the project."

I was messing around with style cop and scrapped the idea in my project. I deleted the references to style cop and ended up modifying a system file somewhere.
Every project fails to build with the following error:
The target "ResolveCodeAnalysisRuleSet" does not exist in the project. CDRCallMonitor C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets 39
I scrapped my CSharp.Core.targets file and replaced it with the MS one online
https://referencesource.microsoft.com/#MSBuildFiles/C/ProgramFiles(x86)/MSBuild/14.0/bin_/amd64/Microsoft.CSharp.Core.targets
and this doesn't work.
I tried reinstalling msbuild tools and that didn’t help either.
I can't build anything with with msbuild/Visual studio
dotnet build works fine.
If you launch the Visual Studio installer there should be an option to uninstall, modify, or repair.
Give that repair option a go.

After installed Visual Studio 2010 Professional I am getting an error

I have installed VS 2010 Ultimate on Windows 7 Enterprise. It is not working. So I uninstalled that and re-install VS 2010 Professional.
But I am getting an error whenever I open Visual Studio 2010.
Error:
The 'Visual Studio Tools for Applications v3.0 Shell Integration Package' package did not load correctly.
The Problem may have been caused by a configuration change or by the installation of another extension. You can get more information by running the application together with the log parameter on the command line, and then examining the file
'C:\users\Name\AppData\Roaming\Microsoft\VisualStudio\10.0\ActivityLog.xml'.
How to fix this issue? Please help me.
I ran Procmon from Sysinternals on devenv.exe with a filter set to capture file system events only, and only not equal 'success' results.
This brought up some results pointing at a directory where devenv.exe attempted to load Microsoft.VisualStudio.Tools.Applications.Package.dll from. None of those directories contained that file.
Searched for that file and found it under C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.Tools.Applications.Package.dll That location was not among the directories captured by Procmon.
Copied the file to the first location indicated by the error captured by Procmon and voila, problem solved.

Error Code -1073741515 When Using EDITBIN

I'm using EditBin to increase the stack size of an application I'm writing. I have this in the post-build event command line for Visual Studio:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\editbin.exe" /STACK:268435456 "$(TargetPath)"
When I build my project, I get this error:
Error 470 The command ""C:\Program
Files (x86)\Microsoft Visual Studio
10.0\VC\bin\editbin.exe" /STACK:268435456 "[Target Executable]"" exited
with code -1073741515.
I have both of the following in my PATH environment variable:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
The command also works when I run it manually with cmd.exe. Does anyone know what the problem is here?
I had the same issue, how I resolved it:
Ran msbuild.exe <my.sln> /t:<mytargetproject> from a VS2010 command prompt, where <my.sln> is your solution name and <mytargetproject> is the project you are trying to build. For e.g. msbuild.exe helloworld.sln /t:mainproj.
When you do this or at least when I ran this, a dialog box popped up and said "foo.dll" cannot be found, I added the path of that dll to my "PATH" environment variable and the problem was solved! See ChrisF's comment to the question, as it says, the error is that some dll/component is missing.
From the dll name it complained about, I believe this is not contained to VS2010 libs/dlls, for me it was a third-party dll (which I am using and supposed to be available during the build) it was complaining about.
The best solution is to run the vcvarsall.bat located in the root of the visual studio install folder(C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC). That sets up the search folders for all MSVC compiler related tools.
I got this to work for now by copying mspdb100.dll into the same directory as editbin.exe, but this is not an optimal solution because every developer on my team will need to do the same thing.

Resources