1
votes

I created a simple ASP.NET Core application and I want to build it on Windows 10 for Windows 10 and CentOS 7. So my I have this in my project.json file:

"runtimes": {
    "win10-x64": { },
    "centos.7-x64": { },
    "win81-x64":  { }
  },

Without "win81-x64" I got an error:

Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes: 'win81-x64, win8-x64, win7-x64'

After dotnet build command i see this:

Project ListService (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing Compiling ListService for .NETCoreApp,Version=v1.0

Compilation succeeded. 0 Warning(s) 0 Error(s)

Time elapsed 00:00:14.3853704

And command dotnet --info shows:

Product Information: Version: 1.0.0-preview2-003131 Commit SHA-1 hash: 635cf40e58

Runtime Environment: OS Name: Windows OS Version: 6.3.9600 OS Platform: Windows RID: win81-x64

Am I missing something? Also the dotnet publish -r foo-version did not helped.

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.1"
    },
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "runtimes": {
    "win10-x64": { },
    "centos.7-x64": { },
    "win81-x64":  { }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}
1
Are you try use "win10-x64": { }?M. Wiśnicki
Yes, as you can see "win10-x64" is in my project.json filePiotrKowalski
Ohh yes yes , sorry. Put all project.jsonM. Wiśnicki
Ok, I edited the question :)PiotrKowalski
Try edit "Microsoft.NETCore.App": { "version": "1.0.1" } to "Microsoft.NETCore.App": { "version": "1.0.1","type": "platform" }M. Wiśnicki

1 Answers

2
votes

Ok so now it works. What I did was:

  1. I removed "type":"platform" from project.json file

  2. I ran command dotnet build -r centos.7-x64 in cmd from project folder

And now i see

enter image description here