Cannot publish self-contained worker project referencing another
See original GitHub issueWhen trying to publish single file exe for worker projects get error runtime identifier is required, but it was!
This happens when referencing another core 3 console project.
$ dotnet publish -r linux-x64 -c Release --self-contained true
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 102.79 ms for C:\Dev\magnet-filewatcher\src\watcher\watcher.csproj.
Restore completed in 102.79 ms for C:\Dev\magnet-filewatcher\src\worker\worker.csproj.
C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(127,5): error NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. Please either specify a RuntimeIdentifier or set SelfContained to false. [C:\Dev\magnet-filewatcher\src\watcher\watcher.csproj]
Steps to reproduce
- Create new worker project with
dotnet new worker
- Add reference to your another core 3.0 console project with
dotnet add reference
.NET Core SDK (3.0.100)
- Windows 10 X64 es).
Issue Analytics
- State:
- Created 4 years ago
- Reactions:35
- Comments:20 (2 by maintainers)
Top Results From Across the Web
Cannot publish self-contained worker project referencing ...
This happens when referencing another core 3 console project. $ dotnet publish -r linux-x64 -c Release --self-contained true Microsoft (R) Build ...
Read more >error NETSDK1031: It is not supported to build or publish a ...
I am running following command to publish .NET CORE 5.0 web api project using command line on windows 10 box. c:\test\Service>dotnet publish -c ......
Read more >Error generated when executable project references ...
NET SDK 5, an error is generated if an executable project references another executable project and the SelfContained values don't match.
Read more >VS2017 15.3 Net Core 2.0 publish a self-contained app for ...
Using the same project, and publishing with dotnet publish the resulting app works fine. The different output folders contains different System.Threading.dll.
Read more >Publishing A Single EXE File In .NET Core 3.0
NET Core installed so I know I need to build a self contained application for him. Easy, I just run the following command...
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
This is still happening in .NET 5. Any fixes? Specifying the RuntimeIdentifier in the .csproj file is NOT a solution because if you develop on Windows, then deploy for Linux, you’ll need to have two .csproj files for each OS, NOT GOOD.
I had the same problem with NetCore 3.1
This was not working:
Fixed by removing
--self-contained true
(that is the default anyway)