Imported Project DotNet.Props Was Not Found

2019-08-20 06:08发布

Someone please. Anyone. I've been fretting over this issue the last two days. I've read other issues that are similar. But they are not exact.

The error message is: The imported project

"C:\ProgramFiles\dotnet\sdk\1.04\Microsft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

I am trying to run an Angular2 ASP.NET core app developed using Visual Studio Express For Web 2015 that was working perfectly, before I installed Visual Studio 2017. I think the issues is the program is looking for a version of .NET core that somehow got removed. Here is my proj.json

{
  "userSecretsId": "aspnet-Angular2-b6820071-fb17-4201-b6fd-407054319783",

  "dependencies": {
    "Microsoft.NETCore.App": "1.0.0-rc2-3002702",
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-
 final",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Razor.Tools": {
  "version": "1.0.0-preview1-final",
  "type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
  "version": "1.0.0-preview1-final",
  "type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
  "version": "1.0.0-preview1-final",
  "type": "build"
},
  "tools": {
        "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    },
    "Microsoft.Extensions.SecretManager.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    }
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8"
      ]
    }
  },
  "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%" ]
    },
    "EntityFramework": "6.1.3",
    "Microsoft.EntityFrameworkCore": "1.1.1"
}

Here's a screenshot of the error message I receive when attempting to merely open the application:

enter image description here

And here is the error message in the console when attempting to run the program:

enter image description here

I'd appreciate your guidance. Thanks, CM

1条回答
贪生不怕死
2楼-- · 2019-08-20 06:45

To continue using project.json based projects in VS 2015, you need to add a global.json file with the following contents at the solution level (directory hierarchy at or above project.json):

{
  "sdk": {
    "version": "1.0.0-preview2-1-003177"
  }
}

Replace 1.0.0-preview2-1-003177 with the latest 1.0.0 preview 2 version installed on your machine - you can find this version as a subfolder of C:\Program Files\dotnet\sdk.

查看更多
登录 后发表回答