3

I am not sure what i have done recently. But this was working until a week ago. Suddenly when i tried to compile the project. It is giving me 8463 compilation errors. few of them are given below.

enter image description here

Please help me out if any of you have faced this before. I am using .net core app 1.0.0 . But 1.0.1 is also installed on my PC.

When i try to compile using dotnet build cli i get the following error message.

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

  1. The project has not been restored or restore failed - run dotnet restore
  2. The project does not list one of 'win7-x64' in the 'runtimes' section.
  3. You may be trying to publish a library, which is not supported. Use dotnet pack to distribute libraries.

I ran dotnet restore already. I am not sure about 2nd point. Because it was working before on the same machine.

Also i don't have any runtimes section mentioned in the project.json

UPDATE :

As mentioned in other posts. I added

  "runtimes": {
        "win7-x64": { }
      }

But didn't work.

Project.Json :

{
  "userSecretsId": "aspnet-IdentityServer-db76f1cf-15a8-4dc0-8200-221a224b454c",
  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.DependencyInjection": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
    "Microsoft.Extensions.Caching.Abstractions": "1.0.0",
    "Microsoft.Extensions.Caching.Memory": "1.0.0",
    "System.Security.Cryptography.Algorithms": "4.2.0",
    "Serilog": "2.2.1",
    "Serilog.Sinks.Literate": "2.0.0",
    "Serilog.Extensions.Logging": "1.0.0",
    "IdentityServer4": "1.0.0-beta5",
    "IdentityManager.V2.Entities": "1.0.0-*",
    "IdentityManager.V2.Data": "1.0.0-*",
    "Microsoft.AspNetCore.Authentication.Google": "1.0.0",
    "Microsoft.AspNetCore.Authentication.Facebook": "1.0.0",
    "Microsoft.AspNetCore.Authentication.Twitter": "1.0.0",
    "Serilog.Sinks.Seq": "3.0.1",
    "System.Runtime": "4.1.0"
  },
  "tools": {
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net452+win81"
      ]
    }
  },

  "runtimes": {
    "win7-x64": {}
  },

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

  "runtimeOptions": {
    "gcServer": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}
Venkata Dorisala
  • 4,783
  • 7
  • 49
  • 90
  • Possible duplicate of [Can not find runtime target for framework .NETCoreApp=v1 compatible with one of the target runtimes](http://stackoverflow.com/questions/37590604/can-not-find-runtime-target-for-framework-netcoreapp-v1-compatible-with-one-of) – Set Sep 30 '16 at 12:39
  • I tried that solution.. But didn't work for me. – Venkata Dorisala Sep 30 '16 at 12:47
  • Could you post your project.json? – svick Sep 30 '16 at 13:23
  • 2
    It failed for me to restore `IdentityServer4` and `IdentityManager` packages. Bumping up `IdentityServer4` and commenting out `IdentityManager` packages did the trick. – Ignas Sep 30 '16 at 16:19
  • Restore is working fine since begining. But when i compile or update any nuget package then getting all the wierd 8529 compilation errors.. – Venkata Dorisala Oct 03 '16 at 10:46
  • @Ignas I think identity manager is not for their core product rather for IdSrv 3. I just noticed your old references in project.json when I read your comment on updating the packages... I don't think you need the dnxcore50 call too ... – Muqeet Khan Jan 07 '17 at 09:25

1 Answers1

6

When we update packages, it will remove "type": "platform" from
"Microsoft.NETCore.App": { "version": "1.1.0", "type": "platform" }

in Project.json file. after update it looks like "Microsoft.NETCore.App": "1.1.0" . Solution of this error is update the Json file with this line e.g

"Microsoft.NETCore.App": { "version": "1.1.0", "type": "platform" }

Aamir
  • 695
  • 10
  • 11