Skip to content

AOT publish without Windows 11 SDK installed produces unclear error #120294

Closed

Description

@YC

Description

When AOT publishing without Windows 11 SDK installed, the compilation fails with an unclear error message.

Variable is set to invalid string:
$(CppLinker)="The system cannot find the file specified.%3bC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\link.exe"

Reproduction Steps

  1. Install Visual Studio 2022.
    Deselect (any instance of) Optional Component Windows 11 SDK under Desktop development with C++.
  2. Create project:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Library</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <PublishAot>true</PublishAot>
    <InvariantGlobalization>true</InvariantGlobalization>
  </PropertyGroup>
</Project>
  1. Publish using command:
dotnet publish .\p.csproj -r win-x64 -c release

Expected behavior

Error message indicating that Windows 11 SDK needs to be installed.

Actual behavior

Target .NET 8

$ dotnet publish .\p.csproj -r win-x64 -c release
Restore complete (0.5s)
    info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  p failed with 1 error(s) (4.0s) → bin\release\net8.0\win-x64\p.dll
    C:\Users\steve\.nuget\packages\microsoft.dotnet.ilcompiler\8.0.20\build\Microsoft.NETCore.Native.targets(370,5): error MSB3073: The command ""The system cannot find the file specified.;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\link.exe" @"obj\release\net8.0\win-x64\native\link.rsp"" exited with code 123.

Build failed with 1 error(s) in 5.1s

Target .NET 10

$ dotnet publish .\p.csproj -r win-x64 -c release
Restore complete (1.0s)
    info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  p failed with 1 error(s) (9.3s) → bin\release\net10.0\win-x64\p.dll
    C:\Users\steve\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.0-rc.1.25451.107\build\Microsoft.NETCore.Native.targets(396,5): error MSB3073: The command ""The system cannot find the file specified.;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\link.exe" @"obj\release\net10.0\win-x64\native\link.rsp"" exited with code 123.

Build failed with 1 error(s) in 11.0s
   1:7>Target "SetupOSSpecificProps" in file "C:\Users\steve\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.0-rc.1.25451.107\build\Microsoft.NETCore.Native.Windows.targets" from project "C:\source\p.csproj" (target "WriteIlcRspFileForCompilation" depends on it):
       Using "Exec" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
       Task "Exec"
         "C:\Users\steve\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.0-rc.1.25451.107\build\findvcvarsall.bat" x64
         The system cannot find the file specified.
         C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\#
         C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64
       Done executing task "Exec".
       C:\Users\steve\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.0-rc.1.25451.107\build\Microsoft.NETCore.Native.Windows.targets(138,7): message : Property reassignment: $(CppLinker)="The system cannot find the file specified.%3bC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\link.exe" (previous value: "link") at C:\Users\steve\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.0-rc.1.25451.107\build\Microsoft.NETCore.Native.Windows.targets (138,7) [C:\source\p.csproj]
       C:\Users\steve\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.0-rc.1.25451.107\build\Microsoft.NETCore.Native.Windows.targets(139,7): message : Property reassignment: $(CppLibCreator)="The system cannot find the file specified.%3bC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\lib.exe" (previous value: "lib") at C:\Users\steve\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.0-rc.1.25451.107\build\Microsoft.NETCore.Native.Windows.targets (139,7) [C:\source\p.csproj]
$ .\findvcvarsall.bat x64
The system cannot find the file specified.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\#
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64

Regression?

No response

Known Workarounds

Install Windows 11 SDK

Configuration

$ dotnet --version
10.0.100-rc.1.25451.107
$ dotnet --list-sdks
9.0.305 [C:\Program Files\dotnet\sdk]
10.0.100-rc.1.25451.107 [C:\Program Files\dotnet\sdk]

Windows 10 22H2 x64

Other information

No response

Activity

  1. added
    untriaged
    on Oct 1, 2025
  2. added
    needs-area-label
    on Oct 1, 2025
  3. MihuBot commented on Oct 1, 2025

    @MihuBot

    I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):

  4. added and removed
    needs-area-label
    on Oct 1, 2025
  5. dotnet-policy-service commented on Oct 1, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
    See info in area-owners.md if you want to be subscribed.

  6. added this to the 11.0.0 milestone on Oct 1, 2025
  7. removed
    untriaged
    on Oct 1, 2025
  8. added a commit that references this issue on Apr 1, 2026
    8ea503f
  9. locked and limited conversation to collaborators on May 1, 2026
  10. added a commit that references this issue on Jul 15, 2026
    f78b733
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions