我正在将图书馆从.Net 4.5
迁移到.net core
。我已经有了.xproj
,但是当我运行dotnet build
时,我收到错误:
Microsoft.DotNet.Common.Targets(262,5):错误:对象引用未设置为对象的实例。
这是我的project.json
文件:
{
"version": "1.0.0",
"frameworks": {
"net45": {
"frameworkAssemblies": {
"System.Collections.Concurrent": {
"type": "build"
}
}
},
"netstandard1.6": {
"imports": "dnxcore50",
"dependencies": {
"NETStandard.Library": "1.6.0"
}
}
}
}
我有什么遗失的吗?
答案 0 :(得分:2)
从命令行运行dotnet restore
但是没有从Visual Studio 2015 Update 3运行。我怀疑这与私有nuget feed有关。
答案 1 :(得分:0)
如果在远程服务器上的TFS构建中出现此错误,您仍然可以手动运行dotnet restore
。
例如。我切换到C:\BUILD-AGENT\_work\1\s\RR.CRM
并运行dotnet restore
当VS做这个或不做的时候还不太确定,但是现在它是一个有效的快速修复。
答案 2 :(得分:0)
我在VS2015(社区)中遇到了同样的问题,从头开始创建ASP.NET MVC Core项目并更新到Core 1.1.1。 由于某些未知原因,Nuget不会更新100%的引用;其中一些仍然是“落后”。
您可以在下面找到我的project.json文件
{
"dependencies": {
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.1.0-preview4-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.1.1",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.1",
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.1",
"Microsoft.AspNetCore.Diagnostics": "1.1.1",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.1",
"Microsoft.AspNetCore.Mvc": "1.1.2",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.1",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.1",
"Microsoft.AspNetCore.StaticFiles": "1.1.1",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.1",
"Microsoft.EntityFrameworkCore.SqlServer.Design": {
"version": "1.1.1",
"type": "build"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.1.0",
"type": "build"
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.1",
"Microsoft.Extensions.Configuration.Json": "1.1.1",
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.1",
"Microsoft.Extensions.Logging": "1.1.1",
"Microsoft.Extensions.Logging.Console": "1.1.1",
"Microsoft.Extensions.Logging.Debug": "1.1.1",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.1",
"Microsoft.NETCore.App": {
"version": "1.1.1",
"type": "platform"
},
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.1.0-preview4-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.1.0",
"type": "build"
}
},
"tools": {
"BundlerMinifier.Core": "2.4.337",
"Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0",
"Microsoft.Extensions.SecretManager.Tools": "1.0.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.1.0-preview4-final",
"imports": [
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"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%" ]
}
}
Microsoft.AspNetCore.Razor.Tools
未正确更新。
还必须手动更新Microsoft.VisualStudio.Web.CodeGeneration.Tools
和Microsoft.VisualStudio.Web.CodeGenerators.Mvc
。