BROKEN: C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(473,5): error MSB8070: Cannot find MSVC toolset version '14.31.31103': the folder 'VCToolsInstallDir_170_is_not_defined'

Young, Mark A 0 Reputation points
2023-05-31T19:17:01.3733333+00:00

Old laptop with Win10 had VS 2017,2019 and 2022. Created a KMDF driver that compiles and works for ARM64 and for x64. Moving to new laptop with Win11. Only trying to install VS 2022 but added a few other pieces in VS Installer to handle other things we build beside the driver. I can compile various apps just fine, but the driver does not compile. I mount latest EWDK ISO EWDK_ni_release_svc_prod3_22621_230511-2102.iso which is supposed to be 17.1.6 (Recommended) on MSFT link https://go.microsoft.com/fwlink/?linkid=2237475 but is actually 17.1.5. Also tried the older link. From there I invoke devenv.exe then the driver.sln.

I see VCToolsInstallDir is defined but not VCToolsInstallDir_170 so I manually make this set in the EDWK ISO cmd.exe window before invoking devenv.exe and it works. This must be a MSFT bug. I had a co-worker do a completely fresh install Friday of Win11 Enterprise 21H2 on a new laptop with our default image. He followed my steps without mistakes as I documented them and he has the same issues. The workaround below only partially works but none of them should be needed. I was able to compile a working driver on my old laptop with 2017/2019/2022 and win10 but starting from scratch with VS 2022+win11 cannot be done and I need to get this resolved as I'm behind schedule.

G:> set vct

VCToolsInstallDir=G:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\

VCToolsRedistDir=G:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC\14.31.31103\

VCToolsVersion=14.31.31103

G:> set VCToolsInstallDir_170=%VCToolsInstallDir%

Developer technologies Visual Studio Setup
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,746 Reputation points
    2023-06-02T13:08:43.7266667+00:00

    Hello there,

    We might need more info to conclude whether it is a bug or an environmental issue. You can use tolls like Procmon to analyze this.

    Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity. You can get the tool from here https://docs.microsoft.com/en-us/sysinternals/downloads/procmon

    If you're using MSBuild directly, not with Visual Studio, you should check the places where the WindowsTargetPlatformVersion property might be set. It's usually in the project file, but it could also be in an imported file or in a global settings file such as Directory.build.props.

    MSBuild error MSB8036 https://learn.microsoft.com/en-us/visualstudio/msbuild/errors/msb8036?view=vs-2022

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.