MSVCToolchain 1.0.1

dotnet add package MSVCToolchain --version 1.0.1                
NuGet\Install-Package MSVCToolchain -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MSVCToolchain" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MSVCToolchain --version 1.0.1                
#r "nuget: MSVCToolchain, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MSVCToolchain as a Cake Addin
#addin nuget:?package=MSVCToolchain&version=1.0.1

// Install MSVCToolchain as a Cake Tool
#tool nuget:?package=MSVCToolchain&version=1.0.1                

MSVCToolchain

MSVCToolchain extends the build process for building native C++ projects using the MSVC compiler. By default, the .NET CLI does not support C++ projects due to missing compiler paths and extensions, which are instead a part of the Visual Studio C++ toolset.

This package is designed to be imported in a .csproj file format to add support for building C++ projects on Windows through both the .NET CLI and MSBuild. This can be used to build standalone C++ projects or to build C++ projects as part of a larger .NET solution.

Below is a simple example of how to build a simple C++ executable using the MSVC toolchain:


<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
  </PropertyGroup>

  <ImportGroup>
    <PackageReference Include="MSVCToolchain"
                      Version="1.0.1"
                      PrivateAssets="All" />
  </ImportGroup>

  
  <PropertyGroup>
    <MSVCPlatform>x86</MSVCPlatform>
    <MSVCOutputType>Exe</MSVCOutputType>
  </PropertyGroup>

  
  <ItemGroup>
    <CompilerArgs Include="/GS /sdl" />
    <PreprocessorDefines Include="/D WIN32" />
  </ItemGroup>

</Project>

Below is an example of how to build a native C++ project against the .NET SDK using the MSVC toolchain:


<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
  </PropertyGroup>

  <ImportGroup>
    <PackageReference Include="MSVCToolchain"
                      Version="1.0.1"
                      PrivateAssets="All" />
  </ImportGroup>

  
  <PropertyGroup>
    <SDK40Version>4.8</SDK40Version>
    
    <SDK40KitsPath>$([MSBuild]::GetRegistryValueFromView(
      'HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\NETFXSDK\$(SDK40Version)',
      'KitsInstallationFolder',
      null,
      RegistryView.Registry32
    ))</SDK40KitsPath>
  </PropertyGroup>

  
  <PropertyGroup>
    <MSVCPlatform>x86</MSVCPlatform>
    <MSVCOutputType>Dll</MSVCOutputType>
  </PropertyGroup>

  
  <ItemGroup>
    <CompilerArgs Include="/FS" />
    <PreprocessorDefines Include="/D WIN32" />
    
    <IncludePaths Include="$(SDK40KitsPath)Include\um" />
    <LibPaths Include="$(SDK40KitsPath)Lib\um\$(MSVCPlatform)" />
  </ItemGroup>

</Project>

License

This project is licensed under the Apache-2.0 License.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 146 5/4/2024
1.0.1-alpha.0 71 5/4/2024
1.0.0 122 5/4/2024