Trying the following sequence:
dotnet new console
dotnet build -r win-x64
dotnet publish --no-build -r win-x64 --self-contained=false
Will generate an inconsistent app. The published output only contains the files for a fw-dependent build, but contains the deps.json and runtimeconfig.json from the self-contained build step. This causes the app to fail at runtime.
This can lead to surprising failures for customers (reported by @ryknuth), especially because:
- Mentioning the RID implicitly generates a self-contained build
- There's no --self-contained=false option on the build step
- Some of the properties may be imported from various csproj files, and the distinction may not be obvious to the customer.
- The failure mode is not intuitive. The app fails with:
Message: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet'.
In this case, I think the publish step should fail with an error, rather than generating a wrong app.
@nguerrera @jeffschwMSFT
Trying the following sequence:
Will generate an inconsistent app. The published output only contains the files for a fw-dependent build, but contains the
deps.jsonandruntimeconfig.jsonfrom the self-contained build step. This causes the app to fail at runtime.This can lead to surprising failures for customers (reported by @ryknuth), especially because:
Message: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet'.In this case, I think the publish step should fail with an error, rather than generating a wrong app.
@nguerrera @jeffschwMSFT