- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.2k
Closed
Labels
Milestone
Description
Description
The .rsp file that is generated may contain NoWarn which, as isn't uncommon, may span lines based on project configuration. For example, in a Directory.Build.props, someone may have specified:
<NoWarn>
  $(NoWarn);
  CS1234;
</NoWarn>In this case, you end up with an error like:
Generating native code
EXEC : error : No files matching ;NU5105;CA1812; [C:\src\myproject.csproj::TargetFramework=net7.0]
  Internal.CommandLine.CommandLineException: No files matching ;NU5105;CA1812;
     at Internal.CommandLine.Helpers.AppendExpandedPaths(Dictionary`2, String, Boolean) in /_/src/coreclr/tools/Common/CommandLine/CommandLineHelpers.cs:line 57
     at ILCompiler.Program.ParseCommandLine(String[]) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 347
     at ILCompiler.Program.Run(String[]) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 427
     at ILCompiler.Program.Main(String[]) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 1150
Reproduction Steps
- Create a simple console application.
- Add <PublishAot>true</PublishAot>to aPropertyGroup.
- Add the following to a PropertyGroupexactly as formatted:<NoWarn> $(NoWarn>; NU5105; </NoWarn> 
- Run dotnet publish.
Expected behavior
Publishes native image.
Actual behavior
Fails because .rsp file has line breaks that make the CLI think the NoWarn values are files e.g. partial response file:
--feature:System.Threading.Thread.EnableAutoreleasePool=false
--feature:System.Text.Encoding.EnableUnsafeUTF7Encoding=false
--stacktracedata
--scanreflection
--nowarn:"
      
      ;NU5105;CA1812;
      CA1716; 
      CA1308; 
      CA1819; 
      CA1710; 
      CA1028; 
      CA1032; 
      CA1063; 
      CA1066; 
      CA1815; 
      CA2007; 
      CA2231; 
      CA2225; 
      CA1714; 
      CA1062; 
      CA1031; 
      CA2000; 
      CA2012; ;
      MSB3245; ;IL2121;1701;1702"
Regression?
No response
Known Workarounds
Add something like this to your project or Directory.Build.targets:
  <ItemGroup>
    <_NoWarn Include="$(NoWarn)" />
  </ItemGroup>
  <PropertyGroup>
    <NoWarn>@(_NoWarn)</NoWarn>
  </PropertyGroup>Configuration
dotnet 7.0 toolset on Windows 11 x64, compiling to net7.0
Other information
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status