3

I am having issues creating a .NET Core 1.1 Web Application. I've found postings outlining similar issues other people have had, but they either have a slightly different issue, or have an accepted answer that didn't work for me, or that doesn't have enough details for me to actually implement. I'm going to post step-by-step what I have installed and what I'm doing to create the application, and hopefully someone can tell me what I'm doing wrong.

I have Microsoft Visual Studio Professional 2015 with Update 3 installed:

About Microsoft Visual Studio

I've installed the .NET Core 1.1 SDK:

.NET Core 1.1 SDK

I’ve also installed the tools (Preview 2) for .NET Core 1.1 for Visual Studio 2015:

Tools (Preview 2) for .NET Core 1.1

I opened Visual Studio 2015 and created a new Web API project targeting .NET Core:

New Project

I modified the solution's global.json to target .NET Core 1.1:

global.json

I modified the project.json to target .NET Core 1.1:

project.json

I ran Update-Package in the package manager console:

Update-Package

I ran "dotnet restore" in the package manager console:

dotnet restore

And here I can see things going wrong...I'm getting a bunch of "Unable to resolve" errors...which, of course, means my subsequent "dotnet build" action fails:

dotnet build

So...why is it failing to find the dependencies. And/or, what exactly do I do to fix this? Any help would be appreciated.

1 Answer 1

1

1. Check if you have installed SDK for both x86 and x64 - in other words check both Program Files and Program Files (x86).

From my experience, you need them both - and don't ask me why because I don't know.


2. Check your configuration of NuGet manager - I'm using two sources and everything works fine for me (probably first one is enough):


3. Clean up your Temp folder and NuGet cache folders:

  • c:\Users\ ?? \.nuget\packages\
  • c:\Users\ ?? \AppData\Local\NuGet\


4. You can edit project.json file manually and then run Restore packages (right click on References).

Here is my working configuration (you can just copy-paste it into your project.json):

  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.1.0-preview4-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.1.0-preview4-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.1.0-preview4-final",
      "type": "build"
    }
  },

  "tools": {
    "BundlerMinifier.Core": "2.2.306",
    "Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.1.0-preview4-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },
Sign up to request clarification or add additional context in comments.

4 Comments

Quick update: I had previously only installed the SDK for x64. Installing it for x86 as well does not fix the issue.
do all steps ;) I had similar problem a few days ago and clearing the NuGet cache was the solution in my case.
In the meantime I have added my working configuration as an example, please refer it.
I was missing those entries in my NuGet manager, after adding those I am down to one error left that doesn't have to do with resolving dependencies, which is a call to IApplicationBuilder.UserBrowserLink(). I don't actually use this and removing it allows my app to build. Thanks for the help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.