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.

'dotnet publish' with --runtime argument won't produce stand alone app

See original GitHub issue

I am informed (for now) that the way to build a stand alone app (opposed to shared library) is to add runtimes to your project.json and to invoke ‘dotnet publish’ with --runtime choosing one of them. This does not seem to work on today’s CLI. Repro:

  1. dotnet new
  2. notepad project.json, add runtimes tag like so:
"runtimes": {
    "win7-x64": {},
    "win7-x86": {}
  },
  1. dotnet restore
  2. dotnet build
  3. dotnet publish -r win7-x64

Result: C:\source\test3>dotnet publish -r win7-x64 ‘C:\source\test3’ cannot be published for ‘<no framework provided>’ ‘win7-x64’

Adding -f netstandard1.5 doesn’t help.

The resultant output of publishing without -r is:

 Directory of C:\source\test3\bin\Debug\netstandard1.5\publish

03/28/2016  07:49 PM    <DIR>          .
03/28/2016  07:49 PM    <DIR>          ..
03/28/2016  07:57 PM                 0 test3.deps
03/28/2016  07:57 PM            83,051 test3.deps.json
03/28/2016  07:57 PM             4,608 test3.dll
03/28/2016  07:57 PM            11,776 test3.pdb
03/28/2016  07:57 PM               135 test3.runtimeconfig.json
               5 File(s)         99,570 bytes

I did notice that dotnet --info says my RID is win10-x64, but using that instead doesn’t help.

C:\source\test3>dotnet --info .NET Command Line Tools (1.0.0-beta-002071)

Product Information: Version: 1.0.0-beta-002071 Commit Sha: cf616770ca

Runtime Environment: OS Name: Windows OS Version: 10.0.10586 OS Platform: Windows RID: win10-x64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:23 (10 by maintainers)

github_iconTop GitHub Comments

5reactions
TheRealPiotrPcommented, Mar 30, 2016

@billwert can you share the solution so other folks have access?

0reactions
stajscommented, Sep 14, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

Self-Contained Single-File does not produce a single file
I have a small .Net 5 console application with no dependencies on third party components. I have set it up to publish as...
Read more >
c# - Publishing a standalone exe file with .Net Core 3.0 and ...
Short version .NET Core doesn't use app.config , you'll have to upgrade to the new config system or manually manage the files.
Read more >
Publish a self-contained .NET app on Azure DevOps
Tutorial to build and publish a console application including the .NET (Core) framework from Azure DevOps Pipelines.
Read more >
Making a tiny .NET Core 3.0 entirely self-contained single ...
Here is a . NET Core 3.0 Hello World app. Now I'll open the csproj and add PublishTrimmed = true. And I will...
Read more >
Dotnet build linux. The answer you're looking for is basically
NET Core only … This guide explains setting up a production-ready ASP. If you're executing in command line 'dotnet build --configuration Release' I...
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