AOT publish from `dotnet publish` generates error message, but seems to complete anyway

Open
#115,153 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
50/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp
Domain
build-system

Research direction

Start by reproducing dotnet publish -r win-x64 <myproj>.csproj on the reported Windows and .NET 9 configuration. Then inspect microsoft.dotnet.ilcompiler\9.0.4\build\findvcvarsall.bat and the logged Exec invocation; done means publish no longer emits vague error output when the result is usable, or reports an actionable failure.

Written by the indexing model from the issue text.

Description

area-NativeAOT-coreclr backlog-cleanup-candidate no-recent-activity
Description

When running dotnet publish on my project it will generate the following output:

The input line is too long.
The syntax of the command is incorrect.

After sleuthing with diagnostics, it seems to be coming from an attempt to run a packaged version of findvcvarsall.bat

                   Task "Exec" (TaskId:389)
                     Task Parameter:StandardOutputImportance=Low (TaskId:389)
                     Task Parameter:Command="D:\.nuget\packages\microsoft.dotnet.ilcompiler\9.0.4\build\findvcvarsall.bat" x64 (TaskId:389)
                     Task Parameter:ConsoleToMSBuild=True (TaskId:389)
                     Task Parameter:IgnoreExitCode=True (TaskId:389)
                     "D:\.nuget\packages\microsoft.dotnet.ilcompiler\9.0.4\build\findvcvarsall.bat" x64 (TaskId:389)
                     The input line is too long. (TaskId:389)
                     The syntax of the command is incorrect. (TaskId:389)
                     The command ""D:\.nuget\packages\microsoft.dotnet.ilcompiler\9.0.4\build\findvcvarsall.bat" x64" exited with code 255. (TaskId:389)
                     Output Property: _FindVCVarsallOutput=The input line is too long.;The syntax of the command is incorrect. (TaskId:389)
                     Output Property: _VCVarsAllFound=255 (TaskId:389)
                   Done executing task "Exec". (TaskId:389)
                   Task "Error" skipped, due to false condition; ('$(_VCVarsAllFound)' == '1') was evaluated as ('255' == '1').

Reproduction Steps

syntax of command run:

dotnet publish -r win-x64 .\<myproj>.csproj
Expected behavior

It should complete without errors or warnings that are vague or unactionable.

Actual behavior

As described, it indicates something is wrong, but doesn't say what that something is, even though it "seems" to produce a working output. (This does NOT inspire one with much in the way of confidence in said output!)

Regression?

No response

Known Workarounds

No response

Configuration

.NET 9
Windows 10 Version 22H2 (OS Build 19045.5737) [All Updates applied]
AMD64
[Unknown if related to this config only, I have no other configs to try]

Other information

No response

Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.