How to fix the error "Windows SDK version 8.1" was not found? - c++

I recently updated visual studio 2015 and now, when i try to build any project it always fails and i get the error
Severity Code Description Project File Line Suppression State
Error MSB8036 The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the
project property pages or by right-clicking the solution and selecting
"Retarget solution". Proj D:\Program Files (x86)\visual studio
2017\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\Toolset.targets 34
I retargeted the solution as it said, and the problem persisted, even though the retargetting was completed.I decided to install visual studio 2017 because of this, and, lo and behold, it did the exact same thing.I'm also using windows 7.
What is the problem and how can i fix it?

I faced this problem too. Re-ran the Visual Studio 2017 Installer, go to 'Individual Components' and select Windows 8.1 SDK. Go back to to the project > Right click and Re-target to match the SDK required as shown below:

I installed the 8.1 SDK's version:
https://developer.microsoft.com/en-us/windows/downloads/sdk-archive
It used 1GB (a little more) in the installation.
Update October, 9 (2020). There's a https error: the sdksetup link is https://go.microsoft.com/fwlink/p/?LinkId=323507
"Save link as" should help.

Another way (worked for 2015) is open "Install/remove programs" (Apps & features), find Visual Studio, select Modify. In opened window, press Modify, check
Languages -> Visual C++ -> Common tools for Visual C++
Windows and web development -> Tools for universal windows apps -> Tools (1.4.1)
and Windows 10 SDK ([version])
Windows and web development -> Tools for universal windows apps -> Windows 10 SDK ([version])
and install. Then right click on solution -> Re-target and it will compile

I had win10 SDK and I only had to do retarget and then I stopped getting this error. The idea was that the project needs to upgrade its target Windows SDK.

I realize this post is a few years old, but I just wanted to extend this to anyone still struggling through this issue.
The company I work for still uses VS2015 so in turn I still use VS2015. I recently started working on a RPC application using C++ and found the need to download the Win32 Templates. Like many others I was having this "SDK 8.1 was not found" issue. i took the following corrective actions with no luck.
I found the SDK through Micrsoft at the following link
https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/ as referenced
above and downloaded it.
I located my VS2015 install in Apps & Features and ran the repair.
I completely uninstalled my VS2015 and reinstalled it.
I attempted to manually point my console app "Executable" and "Include" directories to the C:\Program Files (x86)\Microsoft SDKs\Windows Kits\8.1 and C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools.
None of the attempts above corrected the issue for me...
I then found this article on social MSDN https://social.msdn.microsoft.com/Forums/office/en-US/5287c51b-46d0-4a79-baad-ddde36af4885/visual-studio-cant-find-windows-81-sdk-when-trying-to-build-vs2015?forum=visualstudiogeneral
Finally what resolved the issue for me was:
Uninstalling and reinstalling VS2015.
Locating my installed "Windows Software Development Kit for Windows 8.1" and running the repair.
Checked my "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\8.1" to verify the "DesignTime" folder was in fact there.
Opened VS created a Win32 Console application and comiled with no errors or issues
I hope this saves anyone else from almost 3 full days of frustration and loss of productivity.

Grep the folder tree's *.vcxproj files. Replace <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> with <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> or whatever SDK version you get when you update one of the projects.

For me in the Project Properties Settings General->Target Platform -> Change Windows 8.1 to Windows 10 solved the issue

Install the required version of Windows SDK or change the SDK version
in the project property pages
or
by right-clicking the solution and selecting "Retarget solution"
If you do visual studio guide, you will resolve the problem.

I encountered this issue while trying to build an npm project. It was failing to install a node-sass package and this was the error it was printing. I solved it by setting my npm proxy correctly so that it could reach the npm repo

PROBLEM: I ONLY get this compile-time "Windows SDK version 8.1 not found" error ( and a few other very-hard-to-resolve-nuisance errors -- cannot list them all ) when I export a project from an old version of MS Visual Studio (VS) to the new MS VS (2017), using the new MS VS export/"One-way Upgrade" feature.
SOLUTION: I have since learned to not use this export/upgrade feature and instead just create the new project from scratch -- using all my old source files, of course. Only my project settings have to be rebuilt, to be clear.
This is a bit of a pain, and a shame the export/upgrade feature won't work properly like it used to, but this is is actually easier and faster in the long run. MUCH better than working through a list of spurious errors that really should not have arisen in the first place.
Hope this helps...

Related

Qt VS Tools: error reading VS project settings

I develop an application using Visual Studio 2015 + Qt VS Tools extension. For me it's first time I used Qt (version 5.14.1) in my project. Everything was working fine until something wrong happened.
I was asked to make release version of my application, it worked fine on Windows 10 and Windows 7 64-bit systems. Then I set the project configuration back to Debug x64 to continue my work. First strange thing I noticed - when I double-clicked on *.ui form files in my Solution Explorer, Visual Studio crashed and reloaded without any error, Qt Designer doesn't launch.
What I tried:
First I tried to open Qt Designer externally (from bin folder in Qt directory) and open my form - it worked.
I tried another project made in VS 2015 + Qt VS Tools Extension - same problem.
I tried to remove my Qt Version and re-add it. And here it comes: Error screenshot. It also occurs without using system enviroment variable $(QTDIR).
I reinstalled Qt to my PC (installed version 5.14.2 instead of 5.14.1), same error.
I reinstalled Visual Studio 2015, same error.
I tried to reset my Visual Studio settings and parameters to default, no results.
I installed Visual Studio 2019. The problem is still present.
UPD:
I cleared Visual Studio cache according to these instructions. It didn't work for me.
I removed every Visual C++ Redistributables from my PC and installed the latest version from Microsoft site. It also didn't work.
The error occurs even if no project is opened, so the problem is caused either by Visual Studio 2015, by Qt 5.14, or by Qt VS Tools extension.
P.S. Sorry if my english wasn't perfect. Waiting for any ideas on fixing this problem.
For any future readers who have this problem, start your maintenance tool or Qt installer, e.g. C:\Qt\MaintenanceTool.exe, "Add or remove components", and then make sure Qt/<version>/MSVC is installed, as shown in the image below:
.
Then you'll be able to select that Qt version instead of MinGW, since the Visual Studio extension only supports the MSVC compiler and not MinGW.
Encountered the exact same problem and the only solution I have found was reverting to an older version of the Qt Visual Studio Tools extension.
Visual Studio has been painfully persistent about updating the version even once I installed an older one, so make sure to disable automatic extension updates (Extensions → Manage Extensions → Extension Settings → Uncheck Automatically search for updates/Automatically update extensions).
Hope it helps.
To solve your problem, you need to remove the QTDIR and QMAKESPEC environment variables that remain in Windows after installing older versions of Qt.
Well, after some more procedures that didn't help, I just did clean-reinstallation for my Windows 10. Fortunately, that helped :)

Visual Studio: copy installation folder and setup it up to be auto-detected by Qt Creator

I wiped out an old Windows 10 and replaced it with a new Windows 10 by ISO image.
Before wiping out, I copied the folder of Microsoft Visual Studio 2017 Community Edition on old Windows to an external hard disk:
xcopy /E "C:\Program Files (x86)\Microsoft Visual Studio" D:\
Now after reinstalling Windows 10, I copied the VS 2017 folder from external the hard disk to the C:\Program Files (x86)\ folder of new operating system.
I did so to avoid having to download VS 2017 again on new OS.
The problem is other software, like Qt Creator, cannot auto-detect the VS C/C++ compilers. I guess that's because the VS 2017 isn't added to path.
The questions are:
What path should I add to system path in order to VS 2017 to be auto-detected by other software like Qt Creator?
Is there any script which I can run to automatically integrate the VS 2017 to the rest of the operating system.
To answer the questions in your issue:
Copying the content of C:\Program Files (x86)\Microsoft Visual Studio folder is not a recommended way to install VS.
(The complete installation will not only set the Environment variables but also set the related registry keys and values. A simple copy may break this process)
So we always suggest that users install the VS by vs-installer or offline installation package. (Same like what Zlatomir suggests.)
To your actual requirements:
It seems you're just trying to use VC++ compiler in QT Creator instead of developing QT projects in Visual Studio. So build tools for VS package is enough for you.
See this related issue, if we download Build Tools for VS package with corresponding C++ workload, then we can get the compiler the QT needs. There's no need to install the VS IDE for this situation.
And if we need C++ compiler from VS2017, download the Build Tools for VS2017, if we need C++ compiler from VS2015, download the Build Tools for VS2015 Update3. Link of old version about VS Tools see here.
Update:
From the the link older downloads we can see:
Choose the download button according to which version we need. We can find both VS2017 build tools package and VS2015's there.
Usually programs on Windows don't work after you just copy the installation folder.
So right now there is little you can do to fix it, even if you partially fix, you have no way to know if something else will be broken in the future.
So the recommended solution is to download the installer again and create an offline installer for the next time this happens, you can do that by running the online installer with the following parameters: vs_community.exe --layout c:\vslayout --lang en-US (replace vs_community.exe with the actual name of the online installer file, or rename it), for more options, that might require a smaller download (example if you only need native and don't need .net) check the documentation here for the full set of options you have.

How to properly install StyleCop for Visual Studio 2017 Community?

Well i downloaded the newest version, then installed, checked to instal entire files on local drive. I restarted Visual Studio 2017 Community and rerun it. Unfortunatelly i can't find in menu > tools anything with should be connected with stylecop ( as in tutorial "how to use stylecop"). I am using x64 Windows7. I really really don't know how to to use it.
Go to extensions and updates and search for stylecop in the online area.
Choose the one by Chris Dahlberg.
Close VS and it will install.
open your project up and make sure you have a settings.stylecop file in there.
right click on the project in the solution explorer and you will see a run stylecop option
After reading a comment from the extension creator, it appears that future development is targeted for the SytleCopAnalyzers NuGet package. Using VS 2017, this was easy to get running. Instructions here -> https://github.com/DotNetAnalyzers/StyleCopAnalyzers.

Missing vc_runtimeminimum_x86.msi and installation won't work

I'm currently going through the installation process for Visual Studio 2017 Community Edition to use with C++. Halfway through installation, I get an error stating
"The feature you are trying to use is on a network resource that is unavailable. Click OK to try again, or enter an alternate path to a folder containing the installation package 'vc_runtimeMinimum_x86.msi' in the box below."
If I hit cancel, the procedure continues and at the end tells me that the setup has failed. It gives me the error logs attached at the bottom of this post.
Also, I have uploaded the complete logs on the Microsoft Visual Studio developer help forum here.
I'd like to be able to solve this problem without having to do a re-installation of the OS. So far, I've tried /sfc scannow, repairing through the Visual Studio Installer, and reinstalling the C++ redistributables, but all too no avail.
Any help would be greatly appreciated. Thank you.
The product failed to install the listed workloads and components due to one or more package failures. Incomplete workloads Desktop development with C++
(Microsoft.VisualStudio.Workload.NativeDesktop,version=15.0.26403.0)
Universal Windows Platform development
(Microsoft.VisualStudio.Workload.Universal,version=15.0.26403.0)
Visual Studio extension development
(Microsoft.VisualStudio.Workload.VisualStudioExtension,version=15.0.26208.0)
Incomplete components C# and Visual Basic
(Microsoft.VisualStudio.Component.Roslyn.LanguageServices,version=15.0.26208.0)
C++ profiling tools
(Microsoft.VisualStudio.Component.VC.DiagnosticTools,version=15.0.26208.0)
Graphics debugger and GPU profiler for DirectX
(Microsoft.VisualStudio.Component.Graphics.Tools,version=15.0.26208.0)
JavaScript and TypeScript language support
(Microsoft.VisualStudio.Component.JavaScript.TypeScript,version=15.0.26208.0)
Profiling tools
(Microsoft.VisualStudio.Component.DiagnosticTools,version=15.0.26208.0)
Static analysis tools
(Microsoft.VisualStudio.Component.Static.Analysis.Tools,version=15.0.26208.0)
Universal Windows Platform tools
(Microsoft.VisualStudio.Component.UWP.Support,version=15.0.26403.0)
Universal Windows Platform tools for Cordova
(Microsoft.VisualStudio.ComponentGroup.UWP.Cordova,version=15.0.26403.0)
Universal Windows Platform tools for Xamarin
(Microsoft.VisualStudio.ComponentGroup.UWP.Xamarin,version=15.0.26403.0)
VC++ 2017 v141 toolset (x86,x64)
(Microsoft.VisualStudio.Component.VC.Tools.x86.x64,version=15.0.26208.0)
Visual Studio extension development prerequisites
(Microsoft.VisualStudio.ComponentGroup.VisualStudioExtension.Prerequisites,version=15.0.26208.0)
Visual Studio SDK
(Microsoft.VisualStudio.Component.VSSDK,version=15.0.26208.0) You can search for solutions using the information below, modify your selections for the above workloads and components and retry the installation, or remove the product from your machine. Following is a collection of individual package failures that led to the incomplete workloads and components above. To search for existing reports of these specific problems, please copy and paste the URL from each package failure into a web browser. If the issue has already been reported, you can find solutions or workarounds there. If the issue has not been reported, you can create a new issue where other people will be able to find solutions or workarounds. Package
'Microsoft.VisualCpp.Redist.14,version=14.10.25008,chip=x86' failed to install. Search URL: https://aka.ms/VSSetupErrorReports?q=PackageId=Microsoft.VisualCpp.Redist.14;PackageAction=Install;ReturnCode=1603 Impacted workloads Desktop development with C++
(Microsoft.VisualStudio.Workload.NativeDesktop,version=15.0.26403.0)
Universal Windows Platform development
(Microsoft.VisualStudio.Workload.Universal,version=15.0.26403.0)
Visual Studio extension development
(Microsoft.VisualStudio.Workload.VisualStudioExtension,version=15.0.26208.0)
Impacted components C# and Visual Basic
(Microsoft.VisualStudio.Component.Roslyn.LanguageServices,version=15.0.26208.0)
C++ profiling tools
(Microsoft.VisualStudio.Component.VC.DiagnosticTools,version=15.0.26208.0)
Graphics debugger and GPU profiler for DirectX
(Microsoft.VisualStudio.Component.Graphics.Tools,version=15.0.26208.0)
JavaScript and TypeScript language support
(Microsoft.VisualStudio.Component.JavaScript.TypeScript,version=15.0.26208.0)
Profiling tools
(Microsoft.VisualStudio.Component.DiagnosticTools,version=15.0.26208.0)
Static analysis tools
(Microsoft.VisualStudio.Component.Static.Analysis.Tools,version=15.0.26208.0)
Universal Windows Platform tools
(Microsoft.VisualStudio.Component.UWP.Support,version=15.0.26403.0)
Universal Windows Platform tools for Cordova
(Microsoft.VisualStudio.ComponentGroup.UWP.Cordova,version=15.0.26403.0)
Universal Windows Platform tools for Xamarin
(Microsoft.VisualStudio.ComponentGroup.UWP.Xamarin,version=15.0.26403.0)
VC++ 2017 v141 toolset (x86,x64)
(Microsoft.VisualStudio.Component.VC.Tools.x86.x64,version=15.0.26208.0)
Visual Studio extension development prerequisites
(Microsoft.VisualStudio.ComponentGroup.VisualStudioExtension.Prerequisites,version=15.0.26208.0)
Visual Studio SDK
(Microsoft.VisualStudio.Component.VSSDK,version=15.0.26208.0) Log
C:\Users\Owner\AppData\Local\Temp\dd_setup_20170412231725_117_Microsoft.VisualCpp.Redist.14.log
Details Command executed:
"C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.VisualCpp.Redist.14,version=14.10.25008,chip=x86\VC_redist.x86.exe" /q /norestart /log "C:\Users\Owner\AppData\Local\Temp\dd_setup_20170412231725_117_Microsoft.VisualCpp.Redist.14.log"
Return code: 1603 Return code details: Fatal error during installation.
I ran into this problem as well on a recent build of Win 10 + trying to install latest VS Community. When I entered this state, things appeared to be super broken. Here's the sequence of events that I took which finally worked:
In the installed, select to "download all packages and then install"
Attempt installation
See the popup
With the popup still up, go here: https://support.microsoft.com/en-us/help/17588/fix-problems-that-block-programs-from-being-installed-or-removed and download the tool
Open the tool and then select "Uninstall" on the page it says "do you need help installing or uninstalling"
On the next page with the list, select Microsoft Visual C++ 2015 (whatever) and hit next to "Try Uninstall"
Repeat steps 5 - 6 until I didn't see any "Microsoft Visual C++ 2015" left in the list. Note that the popup is still showing.
Close the popup
Pause the install and Resume it.
I didn't see the pop up again and it appears to have installed correctly.
If you're coming here a year after the solution was marked without any resolution, try that and see if it works around the issue for you.
Here are some other things I tried which didn't work for me. If the above didn't work for you, maybe try some of the following which I collected through some searching:
Going to C:\Program Data\Package Cache, searching for the msi package, giving the installer the literal path to what I found. Installer complains "wrong version"
Using https://support.microsoft.com/en-us/help/17588/fix-problems-that-block-programs-from-being-installed-or-removed after the install failed and then repairing (same error).
Uninstalling VS 2015 packages after install failed and repairing (same error).
Ignoring the error. When I did this, VS didn't have any templates installed and devenv /installvstemplates didn't solve this.
Go to Control Panel--Programs and Features, uninstall the Visual C++ 2015 Redistribute items.
After that, run the tool: https://support.microsoft.com/en-us/help/17588/fix-problems-that-block-programs-from-being-installed-or-removed. Re-run the VS 2017 installer as administrator, then click the icon besides 'Launch' and choose 'Repair' to repair the VS 2017.
This tool from Microsoft (which was mentioned by others here) worked for me, after I had been searching for an answer for days:
https://support.microsoft.com/en-us/help/17588/windows-fix-problems-that-block-programs-being-installed-or-removed
You have to choose the "I have problems uninstalling" and search for your "C++"-components (in your case the 2017 ones).
There are usually the "Minimum runtime" and the "Additional runtime"-components. After I've uninstalled both of them with this tool, I could just install a programm that uses these runtimes (for example Visual Studio) and it would download and install the missing features, after that, everything workes perfect for me.
Try installing all the things from here: https://support.microsoft.com/ms-my/help/2977003/the-latest-supported-visual-c-downloads
Not sure if you just have to install the x86 version or all of them. recommend that you install all of them but remember to uninstall the ones which you already have.
for me was simple to fix this problem.
Uninstall all visual c++ with Revo Uninstaller Pro
Use MPVCI tool. link(https://www.majorgeeks.com/files/details/multipack_visual_c_installer.html)
enjoy it. for me it works.

"LNK1104 Cannot open file 'kernel32.lib' " when Windows SDK version is set to 15063.13

I'm doing C++ in Visual Studio 2017, and just recently updated Windows 10 from Anniversary Update to Creator's Update.
I found out by accident that when I'm compiling a DLL project, I would get the error message:
LNK1104 - cannot open file 'kernel32.lib'
After twiddling a bit in the Project Properties, I noticed if the Windows SDK version is set from 10.0.14393.0 to 10.0.15063.0, the error message appears. If I set it back to 10.0.14393.0, I can compile just fine.
I would like to know why when the Windows SDK version is set to the Creator's Update build version, it's throwing this error message, yet it doesn't if set back to the Anniversary Update's build version?
Thanks.
https://developercommunity.visualstudio.com/content/problem/41913/link-fatal-error-lnk1104-in-empty-c-project.html
The Windows 10 Creators Update SDK made some significant changes to
what is installed as part of the installation to minimize on-disk
footprint. This is a Known Issue that results from that refactoring
work where the "desktop" components of the Creators Update SDK do not
get installed by default. The previous new project logic always
selected the latest Windows 10 SDK, assuming the desktop portions were
installed as part of that installation scenario. We are working on a
fix for a future update.
The workarounds available are as follows:
Select a version of the Windows 10 SDK that's fully installed on the system (i.e. 10.0.14393.0 or earlier) in the Project Properties
Install the 'Windows 10 SDK (10.0.15063.0) for Desktop' component via the Visual Studio Installer. win10sdk-15063desktop.png
Daniel Griffing,
Visual C++ Libraries
I have the same problem, honestly, looks like a bug in VS 2017. Just switch to 10.0.10586.0.