Self-contained publish/build error
See original GitHub issueDescribe the bug
When I try to do a self-contained build and publish of an app I wish to publish to App Service prior to RC2 being on it, I am seeing errors, and as such am blocked from being able to build a self-contained publish package.
To Reproduce
I have an example repository here: https://github.com/bradygaster/TodoApp
It contains two projects in one VS solution. It also contains a setup.ps1
file you can run to see the issue. One of the projects will build and publish just fine, the second will build but when the publish command runs this error is visible:
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21501.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(150,5): error NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set SelfContained to false. [C:\Users\brady\source\TodoApp\TodoApp.API\TodoApp.API.csproj]
Further technical details
My dotnet-version is:
❯ dotnet --version
6.0.100-rc.2.21501.4
And dotnet --info is:
.NET SDK (reflecting any global.json):
Version: 6.0.100-rc.2.21501.4
Commit: 18c7fa28d1
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22000
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-rc.2.21501.4\
Host (useful for support):
Version: 6.0.0-rc.2.21470.23
Commit: 826f81a11a
.NET SDKs installed:
5.0.301 [C:\Program Files\dotnet\sdk]
6.0.100-rc.1.21370.1 [C:\Program Files\dotnet\sdk]
6.0.100-rc.1.21458.32 [C:\Program Files\dotnet\sdk]
6.0.100-rc.2.21467.17 [C:\Program Files\dotnet\sdk]
6.0.100-rc.2.21501.4 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.2.21470.37 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.1.21375.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.2.21470.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-preview.7.21369.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-rc.1.21451.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-rc.2.21470.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
@richlander asked me to file this when I showed him the issue, and that I cc @sfoslund in the issue. Thanks to the team for your hard work!
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
error NETSDK1031: It is not supported to build or publish a ...
error NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier · c# ·.net · asp.net ...
Read more >`RuntimeIdentifier` warning if self-contained is unspecified ...
If you specify a RuntimeIdentifier in your project file or use the -r option with dotnet , the .NET SDK defaults the build,...
Read more >Solved: Publish/Deploy self-contained win-x64 not working
Hi,. I've found a bug in the current version (I reckon). I'm using Esri.ArcGISRuntime.WPF v200.0.0 in a WPF + NET7 application.
Read more >"Publishing failed" error when publishing to Folder with ...
Deployment Mode: Self-Contained; Target Framework: netcoreapp2.0; Target Runtime: win-x64. it always fails and displays this error in Visual ...
Read more >Resolved - Publish failed. Check output for more details.
Guys, I've solved the problem. It seems that I did not set the framework to .NET 4.8 before publishing the project on my...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bradygaster Is this the line that is producing the error? https://github.com/bradygaster/TodoApp/blob/0decfd788b9952633c24afc17e2f3fe978fc1ca7/setup.ps1#L23
As an aside, this command can now be simplified, from:
to
Note: this assumes the command is always run on Windows.
No it was this one: https://github.com/bradygaster/TodoApp/blob/0decfd788b9952633c24afc17e2f3fe978fc1ca7/setup.ps1#L28