3

I have created a asp.net core (windows) project with asp.net identity targeting .NET 4.62.

Then I created a class library (windows) project targeting .NET 4.62.

To the class library I added the nuget:

  • mstest.testframework
  • dotnet-test-mstest

I referenced the asp.net core mvc application from the class library.

That worked without error but I can not reference any class from that asp.net core web project? The namespaces are not found.

What do I wrong?

Project.json from asp.net core project

{     
  "dependencies": {
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
    "Microsoft.AspNetCore.Authentication.Cookies": "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.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.Session": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": {
      "version": "1.0.0",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "System.ComponentModel.Annotations": "4.1.0"
  },  

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "net462": {}
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
Govert
  • 16,387
  • 4
  • 60
  • 70
Elisabeth
  • 20,496
  • 52
  • 200
  • 321
  • What does the project.json file look like for the web project? Specifically, the `frameworks` section? – Will Ray Aug 29 '16 at 22:54
  • Update my question with project.json! – Elisabeth Aug 30 '16 at 06:42
  • This is not supported yet, I believe support will come soon. – leppie Aug 30 '16 at 06:47
  • @leppie any link/source? – Elisabeth Aug 30 '16 at 15:51
  • 4
    @Elisabeth: https://twitter.com/davkean/status/770631232874962945 Literally from the horse's mouth :D – leppie Aug 30 '16 at 15:56
  • I can't even get it to target .NET 4.6.2. Every time I change frameworks to net462 I get this error: Framework not installed: .NETFramework,Version=v4.6.2. I've installed .NET 4.6.2 on my machine, and I'm using it in other projects -- is there something extra I need to do to use it with ASP.NET Core projects? – Mike Jan 08 '17 at 04:20

0 Answers0