Ashley Lee
Ashley Lee

Reputation: 3976

Reference local build of Microsoft.AspNetCore.Mvc in AspNetCore application

How can I reference a local build of Microsoft.AspNetCore.Mvc in my Asp.Net Core application? I'm trying to debug something in the framework. I've pulled down the source and have it compiled, but I can't get my application to see the location to pick-up the code.

My global.json file:

{
  "projects": [
    "src",
    "test",
    "c:/source/repos/mvc/src"
  ],
  "sdk": {
    "version": "1.0.0-preview2-003131"
  }
}

Snippet of my package.json file. The version is the same version as the DLL that is built:

"dependencies": {
    "Microsoft.AspNetCore.Mvc": {
      "version": "1.2.0-preview1",
      "type": "build"
    },

Upvotes: 0

Views: 90

Answers (1)

Joel Harkes
Joel Harkes

Reputation: 11661

If you want to be sure it will use the project reference instead of the nuget reference you can specify the dependency target:

"Microsoft.AspNetCore.Mvc": {
  "version": "1.2.0-preview1",
  "type": "build",
  "target" : "project" //this will make sure it only looks for a project
},

Also make sure you run dotnet restore before you build the project.

Upvotes: 1

Related Questions