0
votes

I am trying to setup a VSTS build definition for a Service Fabric project and I can't get the build to get further than the 'Build' step.

Currently the project structure looks like this:

- Application
  - Service Fabric Project 1 (Web API)
  - Service Fabric Project 2 (Stateful Service)
  - Application Project Folder
  - Angular Project

I am just trying to build the Web API Service Fabric Project. I have followed this guide and used the 'Azure Service Fabric Application' template and my build definition looks like this: BuildDefinition

And the error I get is:

C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(323,5): Error : Assets file 'd:\a\3\s\ApplicationName.Security.Gateway\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file 'd:\a\3\s\ApplicationName.Security.Gateway\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [d:\a\3\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\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(165,5): Error : Assets file 'd:\a\3\s\ApplicationName.Security.Gateway\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.

I downloaded the logs and also found this error during the Nuget Restore process:

2017-09-22T15:35:53.8340398Z d:\a\3\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\3\s\Application.Application\Application.Application.sfproj : warning NU1503: Skipping restore for project 'd:\a\3\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, IEnumerable1 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(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 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.WhereEnumerableIterator1.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.

All the builds work without issue on our local machines under both Release and Debug build.

Any help would be greatly appreciated.

Build logs can be downloaded here.

1
Can you show the whole build log here? Or can you share your project in one drive?Marina Liu
@Marina-MSFT I will share build log once back at work tomorrow. Thanks for help.Mark Atkinson
Are you using vs2017 host?Mardoxx
Yes, Default Queue is set to Hosted VS2017. Will upload build logs shortly.Mark Atkinson
@Marina-MSFT build logs can be downloaded here: fundstreamza-my.sharepoint.com/personal/marka_fundstream_co_za/…Mark Atkinson

1 Answers

0
votes

This turned out to be a rather obvious issue that was hiding in plain sight. I was targeting a CSPROJ Service Fabric stateful project as the service fabric 'application', and not the actual SFPROJ application that brings the service fabric projects together, this caused all sorts of issues including the above, and also an issue where we couldn't package the service fabric projects (csproj's) individually as they are essentially console projects and not the required SFPROJ format.

I hope this is clear enough for anyone who runs into this issue too.