question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PublishSingleFile with RuntimeIdentifiers fail to publish

See original GitHub issue

@johnlarfour commented on Tue Jun 11 2019

linux/amd64 dotnet 3.0.100-preview5-011568

Step to reproduce:

dotnet new console -o app

Replace csproj with:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <RuntimeIdentifiers>linux-x64;win-x86;osx-x64</RuntimeIdentifiers>
    <PublishSingleFile>true</PublishSingleFile>
  </PropertyGroup> 
</Project>
cd app
dotnet publish

Error:

/home/john/dotnet/sdk/3.0.100-preview5-011568/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(133,5): error NETSDK1097: It is not supported to publish an application to a single-file without specifying a RuntimeIdentifier. Please either specify a RuntimeIdentifier or set PublishSingleFile to false. [/home/john/Desktop/app/app.csproj]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

21reactions
livarcocccommented, Jun 13, 2019

You need to specify a single RuntimeIdentifier when publishing with Single File. The error message is correct and accurate in this case.

You can try to either edit your csproj to contain a single RuntimeIdentifier, like this

<RuntimeIdentifier>linux-x64</RuntimeIdentifier>

Or, you can pass the -r parameter to the dotnet publish command.

13reactions
secanacommented, Sep 25, 2019

This is really unexpected behavior. Any plans to change it? Running a dotnet publish for each runtime seems unnecessary if a RuntimeIdentifiers exists which could build for multiple runtimes at once.

Read more comments on GitHub >

github_iconTop Results From Across the Web

It is not supported to publish an app without RuntimeIdentifier
The issue I found to be not specifying the runtime identifier in the project file or through the publish command. When choosing an...
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 >
Breaking change: Automatic RuntimeIdentifier - .NET
Learn about a breaking change in the .NET 7 SDK where a RuntimeIdentifier is automatically added to projects that use certain publish ......
Read more >
Unable to publish single-file application (.NET 5)
1. Close tab publish · 2. Open file "ClickOnceProfile.pubxml", located in Properties\PublishProfiles of project · 3. Make some changes, for ...
Read more >
dotnet publish: specify RuntimeIdentifier
Ever came across this error on publishing a dotnet project that includes ... specify a RuntimeIdentifier or set PublishSingleFile to false.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found