MSBuild - MSB4019 Due to invalid path (Visual Studio 2019) - visual-c++

I am getting below error, while building C++ solution on VS2019 via command prompt.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.ToolsetLocation.props(50,3): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160Platforms\Win32\Platform.props" was not found. Confirm that the expression in the Import declaration "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160Platforms\Win32\Platform.props" is correct, and that the file exists on disk.
After observing it is very clear that there is an issue with the path created internally at some props file. It is not very clear why and from where this is coming up.
Any pointers would be of great help.
Thanks in advance.

MSBuild - MSB4019 Due to invalid path (Visual Studio 2019)
There is some errors when you install VS2019.
To fix it, please try this:
1) Open VS Installer, and make sure that you have installed v142 Build Tool.
Or run this on an elevated command prompt (admin): npm install --global --production windows-build-tools. If you don't have npm, I recommend installing it, otherwise this won't work.
2) I found that v160Platforms does not have \, is that the same as you description?
Please create a new environment variables called VCTargetsPath and put its value to this:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\
3) do a fix in vs installer or just update your VS if it is not thee latest version.
Then use developer command prompt for VS2019 as administrator to run your command.
In addition, you can use -verbosity:detailed in command line to see the detailed build log to check whether there is a obvious error. More info you can check this similar issue.

This was not due to the installation issues. This was caused due to VCTargetsPath passed to the MSBuild.exe. In VS2017, it was expecting the VCTargetsPath to be passed in the build command whereas it failed with construction of invalid path if we pass the value in VS2019. Hence after removing the VCTargetsPath from the command all worked well for me.

I ran into the exactly same problem today. The system env path of VCTargetsPath misses a slash at the end.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\ **<--- end slash**

Related

LNK1104 error when building node-gyp project in Visual Studio 2015

I've tried everything, I have the proper version of Python (Python27), Windows SDK 8.1 is installed, Visual C++ is also installed, but the build still fails. I'm using Visual Studio 2015 Community editor btw. When I try to execute node-gyp buildfrom cmd I get the following error:
> C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.t
argets(44,5): error MSB8020: The builds tools for v140 (Platform Toolset = 'v14
0') cannot be found. To build using the v140 build tools, either click the Proj
ect menu or right-click the solution, and then select "Update VC++ Projects..."
. Install v140 to build using the v140 build tools. [C:\Users\Programming PC\Do
cuments\GitHub\node-addon-examples\1_hello_world\node_0.10\build\hello.vcxproj]
This error prompted me to go into to Visual Studio and see if the project can at least build and run from there, it doesn't.
Please help I looked at all of the other questions pertaining to this issue but none of their solutions have helped me.
Took a lot of research but I found the solution(s). First, to get rid of the MSB8020 error either add the VisualStudioVersion environment variable and set it to your version of visual studio or execute node-gyp build with this flag /p:VisualStudioVersion=14.0 (In my case).
I actually got different errors after I solved this one and I believe they are well worth mentioning.
Error MSB4175 then showed up, basically indicating that it cannot find Microsoft.Build.Tasks.v12.0.dll (Do a search on this .dll to find out where its usually located), copy and paste it to the path that it's looking for it in.
Now here is the kicker, the last error that interrupts node-gyp is because of a missing .lib file. Npm doesn't create the following file ...\.node-gyp\4.3.1\Debug\node.lib. So you need to go here and download a node.lib and mkdir Debug\ and put node.lib in there.
Afterwards node-gyp should build without errors.

Visual C++ 2012 missing mspdb110.dll

I am trying to compile on cmd using cl and it says that I'm missing mspdb110.dll.
Anyone know how to fix this?
Edit: I added this file path to PATH C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin and the file is a standard hello world program
If you are trying to execute cl.exe from the command line, you need several environment variables added/modified. See here for further details:
Command line compile using cl.exe?
The version mentioned in that post is VS2010, for VS2012, you should be running 'Developer Command Prompt for VS2012', which will set the variables for you.

installing Help viewer without installing visual studio

I want to take some of MSDN help files offline on a windows machine which does not have visual studio installed on it. the problem is that I cannot find a way to get and install Help Library manager and Help viewer without installing the visual studio or sql server.
How can I install them without installing the visual studio or sql server?
I just wrote an answer on how to do this for an older question, which can be found here.
For convenience, here are the essential steps to get Help Viewer 2.2 to run without going to the trouble of installing a complete copy of Visual Studio 2015:
Most of the files required by HlpViewer.exe can be found on the Visual Studio DVD in two different MSI packages. By passing some additional command line arguments to msiexec, it's quite easy to install them manually:
msiexec.exe /i help3_vs_net.msi VS_SETUP=1
msiexec.exe /i vs_minshellcore.msi MSIFASTINSTALL="7" VSEXTUI="1"
While this installs most necessary files, it doesn't account for all of them ... to keep things simple, I copied the rest of them from a working installation on another computer:
C:\ProgramData\Microsoft\HelpLibrary2
Essentially only contains a CatalogType.xml and some empty directories.
C:\Program Files (x86)\Microsoft Help Viewer\v2.2\CatalogInfo\VS11_en-us.cab
Moreover, it's necessary to provide the application with a valid ContentStore path by importing the following .reg file:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Help\v2.2\Catalogs\VisualStudio14]
"LocationPath"="%ProgramData%\\Microsoft\\HelpLibrary2\\Catalogs\\VisualStudio14\\"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Help\v2.2\Catalogs\VisualStudio14\en-US]
"SeedFilePath"="C:\\Program Files (x86)\\Microsoft Help Viewer\\v2.2\\CatalogInfo\\VS11_en-us.cab"
"catalogName"="Visual Studio Documentation"
Finally, I created a new Application Shortcut and changed its Target: to read as follows:
"C:\Program Files (x86)\Microsoft Help Viewer\v2.2\HlpViewer.exe" /catalogName VisualStudio14 /launchingApp Microsoft,VisualStudio,14
Et voilà!, with that HlpViewer.exe should finally execute without any problems!
In MSDN to USB v2.5, you don't have to have any Visual Studio IDE installed:
https://stackoverflow.com/a/66595500/3268088
I know its old question. I just run into a problem involving Help Viewer.
my recovery steps are :
get sqlexress installer (if you haven't got one)
after extracting the files, check its folder and find for "help" folder
I got mine "SQLEXPRWT_x64_ENU\redist\VisualStudioShell\Help\x64"
run install.exe with administration priveleges (Run as Administrator)
all done.

Duplicate Menu Items VS 2012

anyone ever run into this issue with VS 2012?
I've tried resetting my development environment back to default and that did not resolve anything. This is really frustrating.
I had the same problem in Visual studio 2011. I fixed it using /setup.
I'm still in the dark about the cause. DevEpxress? ReSharper? VSCommands? The combination?
The fix:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE>devenv.exe /safemode /setup
after that I started Visual Studio:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE>devenv
I just resolved the issue by deleting the devenv.CTM
From the path C:\ProgramData\Microsoft\VisualStudio\12.0\1033
Hope this will help.
Seems answer to this a bit deeper than people says above. Need to delete registry key and the config file and perform application reset to apply solid fix:
(Paths are question of version ran, but I'm sure who ever reads this can figure what path their installations are at.)
File: C:\ProgramData\Microsoft\<version>\12.0\<countrycode>\WDExpress.CTM
Registry Key: HKEY_CURRENT_USER\Software\Microsoft\<version>\<vernum>_Config\Menus
Express: "C:\Program Files\Microsoft Visual Studio <vernum>.0\Common7\IDE\WDExpress.exe" /resetuserdata
Other Versions: "C:\Program Files\Microsoft Visual Studio <vernum>.0\Common7\IDE\devenv.exe" /resetuserdata
This seems to fix the issue permanently (used 60 mins, lol, what a waste).
Open cmd in admin mode
Change dir to dev instal path
Run below command . ( but it will reset your initial settings , like c# preference setting on starting – that’s not a big issue I think )
Devenv.exe /resetuserdata

Include stdlib.h :No such file or directory in vc++

I compiled my c++ program in the directory
D:\Program Files\Microsoft Visual Studio 9.0\VC\bin
But stdlib.h is present in the path.
D:\Program Files\Microsoft Visual Studio 9.0\VC\include
While compiling my program, it throws the following error in the command prompt.
fatal error c1083:cannot open include file:"stdlib.h":No such file or directory
NMAKE : fatal error U1077 :'.\c1.exe' : return code '0x2
How to solve this issue.Please take a look into it.
Thanks.'
If you compile from the command-line, you should use the Visual Studio Command Prompt as it sets common environment variables that are used for compiling.
If for some reason you insist on using cmd.exe then you have to either add the include paths to the INCLUDE environment variable or you have to give the compiler the command-line parameter /IC:\Path\to\include
Details are available on MSDN
edit: well since this got recently upvoted I might as well add what I forgot last time. If you want to set up the environment variables that the Visual Studio Command Prompt uses you can just execute the vcvarsall.bat which is located in a directory like C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC for details consult the relevant MSDN page
Make sure you have the right platform toolset selected.
Project -> properties -> configuration properties -> Platform toolset
If you move a project from computer to computer via a flash drive or something, it can have an invalid toolset selected. That can cause intellisense to tell you that.

Resources