Reputation: 112
I am currently trying to publish a web application out of VS2015. The solution is building, but when I want to publish I continuously get the error message: "Your project is not referencing the ".NETFrameworkVersion=v2.0" framework. Add a reference to ".NETFramewor, Version=v2.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.
I already tried to change project.json in several ways that were suggested in StackOverflow ansers, but this was not working.
Can someone please help me out?
As a reference, I will add my project.json file and a screenshot of the problem.
Screenshot of the problem: https://i.sstatic.net/KjxDI.jpg
`{
"userSecretsId": "aspnet-KrisnaldoApp-009a51e2-478c-4020-ac03-0a98477155a1",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"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.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.EntityFrameworkCore.SqlServer.Design": {
"version": "1.0.1",
"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.Xml.XmlSerializer": "4.0.11",
"System.Xml.XmlDocument": "4.0.1"
},
"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": {
"imports": [
"portable-net45+win8"
],
"version": "1.0.0-preview2-final"
}
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"System.ServiceModel.Duplex": "4.0.1",
"System.ServiceModel.Http": "4.1.0",
"System.ServiceModel.NetTcp": "4.1.0",
"System.ServiceModel.Security": "4.0.1"
},
"imports": [
"dotnet2.0",
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [
"bower install",
"dotnet bundle"
],
"postpublish": [
"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
]
}
}`
Upvotes: 0
Views: 216
Reputation: 2099
I usually resolve this by clicking on Restore Nuget Packages at the solution level. Also try to save your project.json to a different file, Delete the one in your solution and clean your project and add it back manually. Sometimes these files become locked.
Upvotes: 1