How to get MSVC MergeModules v142 in VisualStudio 2022? - visual-studio

I work on an open-source application that is built in VisualStudio using the v142 toolset. This toolset is choosen over the newer v143 toolset because
some external libraries provide binary distributions for v142
github actions provide a runner containing v142
New developers of course start with VisualStudio 2022 CE. They just have to install the correct toolset and the compilation succeeds as expected. However, when building the installer (using Wix) it complains that the merge module for v142 is not available:
error LGHT0103 : The system cannot find the file 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.29.30133\MergeModules\Microsoft_VC142_CRT_x86.msm'.
Even installing the package Microsoft.VisualStudio.Component.VC.Redist.MSM via the VisualStudio installer did not bring the v142 merge modules in. They are only available for the v143 toolset.
Is there some way to get the missing merge modules?
Or would it be OK to use the v143 merge modules while everything else is v142?
Find the complete list of installed packages for VS 2022 here:
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.VisualStudio.Component.TypeScript.TSServer",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
"Microsoft.VisualStudio.Component.JavaScript.TypeScript",
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
"Microsoft.VisualStudio.Component.TextTemplating",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.VisualStudio.Component.Debugger.JustInTime",
"Component.Microsoft.VisualStudio.LiveShare.2022",
"Microsoft.VisualStudio.Component.IntelliCode",
"Microsoft.VisualStudio.Component.VC.CoreIde",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Graphics.Tools",
"Microsoft.VisualStudio.Component.VC.DiagnosticTools",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
"Microsoft.VisualStudio.Component.VC.ASAN",
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
"Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Component.VC.Redist.MSM",
"Microsoft.VisualStudio.Component.VC.14.29.16.11.x86.x64"
]
}

This appears to be a bug in the Visual Studio 2022 installer: The merge modules component should be tied to which toolsets are installed, but it appears to install only the latest/current toolset's merge modules. The same is true for Visual Studio 2019; it appears that version is the only way to get the merge modules installed.
That said, merge modules are not recommended. The preferred method is to use the redistributable packages.

Related

CMake and Visual Studio: failed to run MSBuild.exe

I'm trying to build the OpenCV's source files and generate a Visual Studio project using CMake. I'm facing a problem that seems not solved neither with these given following recommendations: here - select the Visual Studio's correct version (e.g. v16 2019) when building with CMake, install MSBuild.exeand add its location to the system PATH -, here - install Windows SDK - and here - install required workload in Visual Studio regarding CMake/C++ and reboot it.
Then I ask for your kind help. I'm currently working with:
OS: Windows 8.1 Pro 64 bits
CMake (GUI) Version 3.17.2, located at C:\Program Files\CMake\bin
Microsoft Visual Studio 2019 version 16.6.0
MSBuild. exe version 16.6.0, located at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
OpenCV 4.3.0, located at D:\opencv;
sdksetup.exe version 8.100, located at C:\Program Files (x86)\Microsoft SDKs\Windows Kits\8.1\StandaloneSDK
My Path in my system's environment variables is: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\MinGW\bin;C:\Program Files\CMake\bin\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\;C:\Program Files (x86)\Microsoft SDKs\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\
I open the CMake with admin rights, then select "Visual Studio 16 2019" as generator, and I always got the following error pop-up when clicking in the "Configure" button:
Error in configuration process, projects files may be invalid.
I tried to do it with two different CMakeLists.txt, a simple one and a complete one.
The simple script
# cmake needs this line
cmake_minimum_required(VERSION 3.1)
# Define project name
project(opencv_example_project)
# Find OpenCV, you may need to set OpenCV_DIR variable
# to the absolute path to the directory containing OpenCVConfig.cmake file
# via the command line or GUI
find_package(OpenCV REQUIRED)
# If the package has been found, several variables will
# be set, you can find the full list with descriptions
# in the OpenCVConfig.cmake file.
# Print some message showing some of them
message(STATUS "OpenCV library status:")
message(STATUS " config: ${OpenCV_DIR}")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
# Declare the executable target built from your sources
add_executable(opencv_example example.cpp)
# Link your application with OpenCV libraries
target_link_libraries(opencv_example PRIVATE ${OpenCV_LIBS})
In this case, the status bar warned:
CMake Error at CMakeLists.txt:5 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft(R) Build Engine versÆo 16.6.0+5ff7b0c9e para .NET Framework
Copyright (C) Microsoft Corporation. Todos os direitos reservados.
The complete script
Which can be found here https://github.com/opencv/opencv/blob/master/CMakeLists.txt. I took care to delete all CMakeCache files and to delete cache inside CMake-GUI.
In this case, the status bar warned:
CMake Error at CMakeLists.txt:106 (enable_language):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft(R) Build Engine versÆo 16.6.0+5ff7b0c9e para .NET Framework
Just to finish: in "About" section inside Microsoft Visual Studio, we can see which Workloads were loaded:
Microsoft Visual Studio Community 2019
Version 16.6.0
VisualStudio.16.Release / 16.6.0 + 30114.105
Microsoft .NET Framework
Version 4.8.03761
Installed Version: Community
Visual C ++ 2019 00435-60000-00000-AA905
Microsoft Visual C ++ 2019
Test Adapter for Google Test 1.0
Enables Visual Studio testing tools with recorded unit tests for Google Test. The terms of use and Third Party Notices are available in the extension's installation directory.
ASP.NET and Web Tools 2019 16.6.936.3669
ASP.NET and Web Tools 2019
Microsoft Visual C ++ 1.0 wizards
Microsoft Visual C ++ wizards
IntelliCode 1.0 extension
Detailed IntelliCode Extension Information for Visual Studio
Tools C # 3.6.0-4.20251.5 + 910223b64f108fcf039012e0849befb46ace6e66
C # components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Basic Tools 3.6.0-4.20251.5 + 910223b64f108fcf039012e0849befb46ace6e66
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Studio tools for CMake 1.0 (interesting)
Visual Studio tools for CMake (uhmm okay)
NuGet Package Manager 5.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Visual Studio Code 1.0 Debug Adapter Host Package
Interoperability layer to host Visual Studio Code debug adapters in Visual Studio
Microsoft Visual Studio 1.0 VC package
Microsoft Visual Studio VC package
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Visual C ++ for Multiplatform Mobile Development (Android) 16.0.30014.67
Visual C ++ for Multiplatform Mobile Development (Android)
Thanks a lot!

How to specify the Visual Studio platform toolset during install

I'm using Visual Studio 2019 and I need to install several libraries using a specific platform toolset.
Right now I have three platform toolsets intalled: Visual Studio 2015 (v140), Visual Studio 2017 (v141) and Visual Studio 2019 (v142).
Is there a way to specify the platform toolset dirung the installation of a package? By default vcpkg is using the latest tools (v142 in my case).
This works great:
vcpkg install grpc:x86-windows-static
I tried this:
vcpkg install grpc:x86-windows-static-v141
which doesn't work as expected.
You will probably need to create a new triplet the existing files are %vcpkgroot%\vcpkg\triplets and use them as reference. You will probably need to set the following cmake set from the vcpkg readme about tirplets

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

Include VC++ 2015 runtime (x86) + (x64) in One-Click install application

Issue
I have developed my application in Visual Studio 2015 but when I use the One-Click install and install the application on my clients machine. It needs to have the VC++ 2015 runtime (x86) + (x64) installed.
I have tried looking in the prerequisites but the files do not seem to be in there for me to add.
Is there a way for me to somehow tag on VC++ 2015 runtime (x86) + (x64) to my application so when the client installs it, it will also install the runtime.
There are three ways to do this:
build your app with MT instead of MD
include the vc_redist package in your package, in the after-install section execute the vc_redist package
find a newer packager which support vc2015
vc_redist_2015

Creating a NuGet package for Windows 7.1 SDK

I've been creating NuGet packages for some of my libraries. The goal is to have my Jenkins build server use a CoApp .autopkg script to build a NuGet package that I can then use in other projects.
The issue is that the build server uses the standalone Windows 7.1 SDK rather than Visual Studio 2010. I guess this is a separate Platform Toolset? So essentially, I can't use the packages compiled by the build server in my Visual Studio 2010 projects? Do people normally install a copy of Visual Studio on their build servers?
Are you using nuget.exe pack to create packages? You shouldn't need visual studio to run nuget.exe.
Here is a link to nuget.exe pack command reference - http://docs.nuget.org/docs/reference/command-line-reference#Pack_Command

Resources