VSTS Nuget 还原失败,出现不兼容的程序集错误
VSTS Nuget Restore Fails with non compatible assembly error
我正在尝试为 Service Fabric 项目设置 VSTS 生成定义,但我无法让生成比 'Build' 步骤更进一步。
目前项目结构如下所示:
- Application
- Service Fabric Project 1 (Web API)
- Service Fabric Project 2 (Stateful Service)
- Application Project Folder
- Angular Project
我只是想构建 Web API Service Fabric 项目。
我遵循 this guide 并使用了 'Azure Service Fabric Application' 模板,我的构建定义如下所示:
我得到的错误是:
C:\Program Files\dotnet\sdk.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(323,5): Error : Assets file 'd:\a\s\ApplicationName.Security.Gateway\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
C:\Program Files\dotnet\sdk.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file 'd:\a\s\ApplicationName.Security.Gateway\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [d:\a\s\ApplicationName.Security.Gateway\ApplicationName.Security.Gateway.csproj]
Build continuing because "ContinueOnError" on the task "ReportAssetsLogMessages" is set to "ErrorAndContinue".
C:\Program Files\dotnet\sdk.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(165,5): Error : Assets file 'd:\a\s\ApplicationName.Security.Gateway\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
我下载了日志,在 Nuget 还原过程中也发现了这个错误:
2017-09-22T15:35:53.8340398Z d:\a\s\Application.Application\Application.Application.sfproj(57,5): error : Unable to find the '..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.1\build\Microsoft.VisualStudio.Azure.Fabric.Application.props' file. Please restore the 'Microsoft.VisualStudio.Azure.Fabric.MSBuild' Nuget package
2017-09-22T15:35:53.8340398Z d:\a\s\Application.Application\Application.Application.sfproj : warning NU1503: Skipping restore for project 'd:\a\s\Application.Application\Application.Application.sfproj'. The project file may be invalid or missing targets required for restore. [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: The "WriteRestoreGraphTask" task failed unexpectedly. [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: NuGet.Commands.RestoreCommandException: PackageTargetFallback and AssetTargetFallback cannot be used together. Remove PackageTargetFallback(deprecated) references from the project environment. [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at NuGet.Commands.AssetTargetFallbackUtility.EnsureValidFallback(IEnumerable1 packageTargetFallback, IEnumerable
1 assetTargetFallback, String filePath) [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.AddPackageTargetFallbacks(PackageSpec spec, IEnumerable1 items) [d:\a\_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a\_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.GetPackageSpec(IEnumerable
1 items) [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() [d:\a\_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a\_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at System.Linq.Enumerable.WhereEnumerableIterator
1.MoveNext() [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.GetDependencySpec(IEnumerable`1 items) [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at NuGet.Build.Tasks.WriteRestoreGraphTask.Execute() [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets]
2017-09-22T15:35:53.8340398Z
2017-09-22T15:35:53.8750823Z NuGet.CommandLine.ExitCodeException: Exception of type 'NuGet.CommandLine.ExitCodeException' was thrown.
2017-09-22T15:35:53.8750823Z at NuGet.CommandLine.MsBuildUtility.d__6.MoveNext()
2017-09-22T15:35:53.8750823Z --- End of stack trace from previous location where exception was thrown ---
2017-09-22T15:35:53.8750823Z at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2017-09-22T15:35:53.8750823Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-09-22T15:35:53.8750823Z at NuGet.CommandLine.RestoreCommand.d__48.MoveNext()
2017-09-22T15:35:53.8750823Z --- End of stack trace from previous location where exception was thrown ---
2017-09-22T15:35:53.8750823Z at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2017-09-22T15:35:53.8762943Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-09-22T15:35:53.8762943Z at NuGet.CommandLine.RestoreCommand.d__43.MoveNext()
2017-09-22T15:35:53.8770357Z WARNING: Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped, only packages.config files will be restored.
2017-09-22T15:35:54.0700174Z Restoring NuGet package Microsoft.ServiceFabric.5.7.198.
在 Release 和 Debug 版本下,所有版本都可以在我们的本地机器上正常运行。
如有任何帮助,我们将不胜感激。
可以下载构建日志here.
事实证明这是一个隐藏在众目睽睽之下的相当明显的问题。
我的目标是一个 CSPROJ Service Fabric 有状态项目作为服务结构 'application',而不是将服务结构项目组合在一起的实际 SFPROJ 应用程序,这导致了包括上述在内的各种问题,还有一个我们无法解决的问题不要单独打包服务结构项目 (csproj),因为它们本质上是控制台项目,而不是所需的 SFPROJ 格式。
我希望这对遇到此问题的任何人来说都足够清楚。
我正在尝试为 Service Fabric 项目设置 VSTS 生成定义,但我无法让生成比 'Build' 步骤更进一步。
目前项目结构如下所示:
- Application
- Service Fabric Project 1 (Web API)
- Service Fabric Project 2 (Stateful Service)
- Application Project Folder
- Angular Project
我只是想构建 Web API Service Fabric 项目。
我遵循 this guide 并使用了 'Azure Service Fabric Application' 模板,我的构建定义如下所示:
我得到的错误是:
C:\Program Files\dotnet\sdk.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(323,5): Error : Assets file 'd:\a\s\ApplicationName.Security.Gateway\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. C:\Program Files\dotnet\sdk.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file 'd:\a\s\ApplicationName.Security.Gateway\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [d:\a\s\ApplicationName.Security.Gateway\ApplicationName.Security.Gateway.csproj] Build continuing because "ContinueOnError" on the task "ReportAssetsLogMessages" is set to "ErrorAndContinue". C:\Program Files\dotnet\sdk.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(165,5): Error : Assets file 'd:\a\s\ApplicationName.Security.Gateway\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
我下载了日志,在 Nuget 还原过程中也发现了这个错误:
2017-09-22T15:35:53.8340398Z d:\a\s\Application.Application\Application.Application.sfproj(57,5): error : Unable to find the '..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.1\build\Microsoft.VisualStudio.Azure.Fabric.Application.props' file. Please restore the 'Microsoft.VisualStudio.Azure.Fabric.MSBuild' Nuget package 2017-09-22T15:35:53.8340398Z d:\a\s\Application.Application\Application.Application.sfproj : warning NU1503: Skipping restore for project 'd:\a\s\Application.Application\Application.Application.sfproj'. The project file may be invalid or missing targets required for restore. [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: The "WriteRestoreGraphTask" task failed unexpectedly. [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: NuGet.Commands.RestoreCommandException: PackageTargetFallback and AssetTargetFallback cannot be used together. Remove PackageTargetFallback(deprecated) references from the project environment. [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at NuGet.Commands.AssetTargetFallbackUtility.EnsureValidFallback(IEnumerable
1 packageTargetFallback, IEnumerable
1 assetTargetFallback, String filePath) [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.AddPackageTargetFallbacks(PackageSpec spec, IEnumerable1 items) [d:\a\_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a\_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.GetPackageSpec(IEnumerable
1 items) [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() [d:\a\_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a\_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at System.Linq.Enumerable.WhereEnumerableIterator
1.MoveNext() [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.GetDependencySpec(IEnumerable`1 items) [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at NuGet.Build.Tasks.WriteRestoreGraphTask.Execute() [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z d:\a_temp\NuGetScratch\tspr1daf.vdl.nugetrestore.targets(131,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() [d:\a_temp\NuGetScratch\temmko3j.dto.nugetinputs.targets] 2017-09-22T15:35:53.8340398Z 2017-09-22T15:35:53.8750823Z NuGet.CommandLine.ExitCodeException: Exception of type 'NuGet.CommandLine.ExitCodeException' was thrown. 2017-09-22T15:35:53.8750823Z at NuGet.CommandLine.MsBuildUtility.d__6.MoveNext() 2017-09-22T15:35:53.8750823Z --- End of stack trace from previous location where exception was thrown --- 2017-09-22T15:35:53.8750823Z at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 2017-09-22T15:35:53.8750823Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 2017-09-22T15:35:53.8750823Z at NuGet.CommandLine.RestoreCommand.d__48.MoveNext() 2017-09-22T15:35:53.8750823Z --- End of stack trace from previous location where exception was thrown --- 2017-09-22T15:35:53.8750823Z at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 2017-09-22T15:35:53.8762943Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 2017-09-22T15:35:53.8762943Z at NuGet.CommandLine.RestoreCommand.d__43.MoveNext() 2017-09-22T15:35:53.8770357Z WARNING: Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped, only packages.config files will be restored. 2017-09-22T15:35:54.0700174Z Restoring NuGet package Microsoft.ServiceFabric.5.7.198.
在 Release 和 Debug 版本下,所有版本都可以在我们的本地机器上正常运行。
如有任何帮助,我们将不胜感激。
可以下载构建日志here.
事实证明这是一个隐藏在众目睽睽之下的相当明显的问题。 我的目标是一个 CSPROJ Service Fabric 有状态项目作为服务结构 'application',而不是将服务结构项目组合在一起的实际 SFPROJ 应用程序,这导致了包括上述在内的各种问题,还有一个我们无法解决的问题不要单独打包服务结构项目 (csproj),因为它们本质上是控制台项目,而不是所需的 SFPROJ 格式。
我希望这对遇到此问题的任何人来说都足够清楚。