1
votes

I have set up an Azure service fabric project in Visual Studio, and created an ASP .net core service. I now need to reference a class library, but no matter what I try I get a 'The dependency could not be resolved error'. Here is my .net core project.json:

{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
  "version": "1.0.0-preview2-final",
  "type": "build"
},
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "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.ServiceFabric": "5.1.163",
"Microsoft.ServiceFabric.Data": "2.1.163",
"Microsoft.ServiceFabric.Services": "2.1.163",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},

"tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},

"frameworks": {
"net46": {
  "dependencies": {
    "ClassLibrary3": {
      "target": "project" }
  }
} 
},

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

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

"scripts": {
}
}

This is the class library's project.json:

{
  "version": "1.0.0-*",

  "dependencies": {
},

"frameworks": {
  "net46": {} 
 }
}

The class library is a .net core class library. What am I missing here?

1
are you using dotnet core RC2? That's required: azure.microsoft.com/en-us/documentation/articles/…LoekD
anything to do with x64?Nick Randell
We've decided not to go with .net Core for the time being. If I get chance, I'll create a new project and see if compiling the class library as x64 helps (I can't remember if I did that or not first time round).Dan O'Leary

1 Answers

0
votes

Make sure the .NET class library is set to explicitly build to x64 and not AnyCPU.