jceddy
jceddy

Reputation: 1947

Problems creating .NET Core 1.1 Web Application

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.

Upvotes: 3

Views: 303

Answers (1)

Lukasz Mk
Lukasz Mk

Reputation: 7350

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

Upvotes: 1

Related Questions