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

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

About this issue

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

Most upvoted comments

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