I am trying to create a private nuget package to allow our organisation to share MVC models across mutliple apps. It's my first, and I was inspired by the Chris's answer to this question.
I thought I had it nailed.... it built OK and showed up in my local nuget feed with all the right metadata.
But when I tried to install the package in one of the apps, I get this error:
You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework.
I thought the dependencies were compatible with 4.5. My 4.5 project (the target app) references the same versions of the dependencies.
I spotted one anomaly, which may (not) be relevant: In the project.json file, I have aspnet45 as the framework. But in solution explorer, the references shows a reference to ASP.NET 5.0.
Project.json
{
"version": "1.0.0-*",
"description": "My Shared Class Library",
"authors": [ "MHL" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"System.Collections": "4.0.0.0",
"System.Linq": "4.0.0.0",
"System.Threading": "4.0.0.0",
"System.Runtime": "4.0.0.0",
"Microsoft.CSharp": "4.0.0.0",
"Microsoft.AspNet.Mvc": "5.2.2"
},
"frameworks": {
"aspnet45": {
"frameworkAssemblies": {
"System.ComponentModel.DataAnnotations": "4.0.0.0",
"System.Web": "4.0.0.0"
}
}
}
}
Solution Explorer > References
Questions
- Most importantly, how do I fix this and get it working?
- How come I'm using
aspnet45
in the project json, and the references section in Solution Explorer is showingASP.NET 5.0
? What should I be putting in the
dependencies
,frameworks
andframeworkAssemblies
sections of the `project.json' file? In the code, the only using directives that I require are:using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
Q3 would probably be self-explanatory to a more competent developer. But I'm only just getting to grips with this, so any acompanying explanations / details would be welcomed.