Venkata Dorisala
Venkata Dorisala

Reputation: 5085

getting weird compilation errors - .Net Core

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%" ]
  }
}

Upvotes: 3

Views: 721

Answers (1)

Aamir
Aamir

Reputation: 695

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" }

Upvotes: 6

Related Questions