`npm install weak` on Windows 8.1: error MSB8007: The Platform for project 'weakref.vcxproj' is invalid - windows

Does anybody know why I'm getting:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'weakref.vcxproj' is invalid. Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Platform that doesn't exist for this project. [C:\Users\mark\Desktop\myapp\node_modules\weak\build\weakref.vcxproj]
when attempting to npm install weak on Windows 8.1?
I tried installing Visual Studio C++ 2010 Express, adding C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcpackages as an environment variable and running npm install weak from the Visual Studio Command Prompt (2010) to no avail.
I've also installed the Windows 8.1 SDK but it doesn't seem to ship with a command prompt so I'm not really sure what to do there.

Related

Visual Studio 2022: Cannot open include file: 'ctype.h'

I've got the infamous error message in C++ build: "Cannot open include file: 'ctype.h'". I know a similar question was already asked multiple times, but my case seems different because I am using the latest Visual Studio 2022 and seems to behave differently.
I have a bunch of existing C++ projects, they use plain 32-bit Windows API with DirectX 6, and I used VC++ build tools 2015 and Windows SDK 8.1 to compile it without any issues in previous versions of Visual Studio. Everything was fine in Visual Studio 2019, no special setup was needed, until I uninstalled it and installed Visual Studio 2022.
Now I can open my solutions, it nicely shows they are using C++ build tools 2015, which I installed together with VS2022, and the solutions also shows correctly that they use Windows 8.1 SDK. But Windows 8.1 SDK is not present in VS2022 installation, I installed it separately. I also tried to "repair" VS2022 installation, but that only deleted all my UI preferences, but not fixed anything in build. Also, I tried to reinstall Windows 8.1 SDK, but it said it is already OK.
When looking to Visual Studio, I can't see any place where I can set default include and lib directories, I can only list what is being used right now. VS2022 shows this list:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include
C:\Program Files\Windows Kits\10\Include\10.0.10240.0\ucrt
C:\Program Files (x86)\Windows Kits\8.1\Include\um
C:\Program Files (x86)\Windows Kits\8.1\Include\shared
C:\Program Files (x86)\Windows Kits\8.1\Include\winrt
The actual error message I receive is this:
c:\program files (x86)\windows kits\8.1\include\um\winnt.h(31): fatal error C1083: Cannot open include file: 'ctype.h': No such file or directory
So it says that winnt.h from windows kits 8.1 cannot find ctype.h. And yes, there is no ctype.h in that folder or anywhere around, I can see it only in C:\Program Files\Microsoft Visual Studio\2022\Professional\SDK\ScopeCppSDK\vc15\SDK\include\ucrt
which I think is the folder with VC++ 2015 build tools. So this seems correct, but I am wondering why this folder is not a part of default include directories when VC++ 2015 build tools are set in project settings. Because it seems that VS2022 is correctly picking my Windows 8.1 SDK, but not picking correctly the older C++ compiler.
When I try to add the folder where ctype.h resides to include folders, I receive another type of errors saying that other files are incompatible with these include files. Of course, this system of directories needs to be in sync. So please what is the correct way of using this?
Also, I tried to switch the VC++ build tools to 2022 version. Unfortunately, that also does not fix the issue. And Windows 10 SDK is not installed, the software wants to stay compatible with older Windows, so I don't need it.
I found a bug report which is related: https://developercommunity.visualstudio.com/t/windows-81-sdk-1/151682
Although Microsoft staff declined to accept it as a bug, it is happening for me as well. When I install only Windows 8.1 SDK, no project can be compiled with it. I even tried to create a new Windows API project in VS2022, the project was created, but failed to compile with the same error.
So I tried to install Windows 10 SDK (from VS2022 installed, but that is probably not important) and this added some missing files which now help to compile Windows 8.1 SDK projects. Problem seems to be solved, my old C++ code can now be compiled with Windows 8.1 SDK and both C++ build tools 2015 and 2022.

rust: link.exe not found

I installed the rust compiler and also MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.27) (as an individual component)
This does not seam to be working.
Does rust require anything more which I have not installed? Thank you in advance.
Install the Windows SDK too.
I also didn't want to install all of Visual Studio just to compile rust from the command line.
Based on the info in coder-256's link, I tried running C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat. Then, instead of being unable to find link.exe, I got the error:
note: LINK : fatal error LNK1181: cannot open input file 'advapi32.lib'
Searching Stack for that error led to this answer: Install the Windows SDK
So I installed the Windows 10 SDK, and now (after launching a new cmd window) it works.
Using Win11, here's the specific steps that worked for me (assumes VSCode and Rust are already installed):
Go to the Visual Studio Download site
Download Build Tools for Visual Studio 2019 (version 16.9)
Install
Create a "hello world" Rust project (cargo new hello)
Open project in VSCode
Set path info in launch.json file (located at folder root, may need to create this first)
Type Shift+Ctrl+B to build the Rust project

Ionic / Cordova Windows build picking up incorrect MSBUILD path

I have had to do a few update of Visual Studio on my Windows 10 machine (after some licensing issues).
I use to have Visual Studio Enterprise 2017, which I uninstalled. I now have Visual Studio Professional 2017, and Studio Enterprise 2019 (which I recently installed). I also installed Visual Studio Build Tools 2019 (2).
Now, when I try to build my Ionic project via the command I have always used...
ionic cordova build windows --prod --release -- --archs="x86 x64 arm" --buildConfig=platform_build_files\\windows\\build.config
I now get the error...
Building project: D:\dev\myapp\platforms\windows\CordovaApp.Windows10.jsproj
Configuration : release
Platform : x86
Buildflags : /p:AppxBundle=Never,/p:UapAppxPackageBuildMode=StoreUpload
MSBuildTools : C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
buildProject spawn: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild [ 'D:\\dev\\myapp\\platforms\\windows\\CordovaApp.Windows10.jsproj', '/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal',
'/nologo',
'/p:Configuration=release',
'/p:Platform=x86',
'/p:AppxBundle=Never',
'/p:UapAppxPackageBuildMode=StoreUpload' ] { stdio: 'inherit' }
The system cannot find the path specified.
No valid MSBuild was detected for the selected target: Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild: Command failed with exit code ENOENT
Of course I no longer have a folder C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise as I uninstalled it.
I have removed and readded the windows platform for my Ionic app, but this did not help.
Also, I am not sure if this is related, but when I try to open the CordovaApp.sln in Visual Studio 2019, I get the following...
Not sure if related.
My question is, how can I reset this MSBuild path? I cannot see any environmental variables anywhere for this, I just can't get rid of this old path
Edit 1
I added the env var as suggested:
Opened a new command prompt, but it is still looking for the non-existent path
No valid MSBuild was detected for the selected target: Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild: Command failed with exit code ENOENT
In Visual Studio 2019, creating UWP apps using Javascript is no longer supported, if you want to build UWP apps using web technologies like Cordova. You need to use Visual Studio 2017.
My question is, how can I reset this MSBuild path?
Visual Studio will choose the version of MSBuild without explicit settings, but you can change this by setting environment variables.
Please add the path of MSBuild to the system environment variable, like:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
Best regards.

Visual Studio 2017 does not detect Windows Driver Kit installation

I already have Visual Studio 2017 professional with Desktop Development with C++ installed.
I am trying to build the Virtual Serial project found here:
https://github.com/Microsoft/Windows-driver-samples/tree/master/serial/VirtualSerial
When I try to build it, I get the error:
Severity Code Description Project File Line Suppression State
Error MSB8020 The build tools for WindowsUserModeDriver10.0 (Platform Toolset = 'WindowsUserModeDriver10.0') cannot be found. To build using the WindowsUserModeDriver10.0 build tools, please install WindowsUserModeDriver10.0 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". virtualserial C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets
I cannot find any instructions on installation aside from this website.
https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk
I downloaded the WDK for Windows 10, version 1803.
I closed VS2017 and ran the installer.
When running the installer I got the message in the screenshot below, I clicked Next to continue installing
After running the installer, the project still does not build, with the same error: WindowsUserModeDriver10.0 is not installed.
What am I missing during installation? Is this the correct installer for regular VS2017 (not community edition)?
Thanks,
I know this is old, but I recently fell into this rabbit hole. What worked for me was uninstalling all of the WDKs, rebooting, and installing WDK 1803 (the wdksetup.exe program downloaded from Other WDK downloads shows version 10.0.17134.1 in properties). That WDK installer specifically calls out VS 2017 when you add the Visual Studio integration at the end of the install process.
In my situation, I installed vs2022 with SDK 19041 and WDK 19041.
After some testing, I realized that VS2022 only supports WDK 22621(so on this date). So I installed WDK 22621 and SDK 22621, and problem solved.
If you still can't find Kernel Driver Build option, try run this file C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\10.0.22621.0\WDK.vsix(WDK 19041 only has VS2019). It's a Visual Studio's extension.
According to this: https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware-winpc/windows-wdk-on-visual-studio-2017-community/fdbd2b44-e57a-4849-903d-04001205a764
WDK is not currently supported by visual studio 2017.
This is ridiculous

Error Installing Visual Studio 11 Developer Preview

I'm getting following error both on web install or directly using the ISO image downloaded. how to resolve this?
I had to manually create the directory in C:\Program Files (x86)\Microsoft Visual Studio 11.0, then run the install. It seems the beta installer doesn't create the directory for some reason.

Resources