MSIX Azure DevOps MSIX Build and Package task failing on latest image 20210525.0. Error NETSDK1004

%3CLINGO-SUB%20id%3D%22lingo-sub-2422132%22%20slang%3D%22en-US%22%3EMSIX%20Azure%20DevOps%20MSIX%20Build%20and%20Package%20task%20failing%20on%20latest%20image%2020210525.0.%20Error%20NETSDK1004%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2422132%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20anyone%20else%20using%20Azure%20Devops%20Pipelines%20to%20create%20their%20MSIX%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EStarting%2027th%20May%20as%20the%20Build%20Agent%20pool%20started%20to%20update%20to%20the%20latest%20image%20are%20MSIX%20build%20pipeline%20started%20to%20fail%20on%20MSIX%20Build%20and%20Package%20task.%20As%20of%20last%20week%20we%20have%20a%20100%25%20failure%20rate.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3EI've%20reported%20it%20as%20an%20issue%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Factions%2Fvirtual-environments%2Fissues%2F3501%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%26nbsp%3B%3C%2FA%3Ebut%20I'm%20surprised%20not%20to%20see%20more%20people%20reporting%20it%20as%20an%20issue.%20I've%20tried%20it%20with%20two%20different%20solutions%20and%20get%20the%20same%20result%20with%20both.%26nbsp%3B%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3EThe%20error%20is%26nbsp%3B%22error%20NETSDK1004%3A%20Assets%20file%20'D%3A%5Ca%5C8%5Cs%5Cxxxxxx.Packager%5Cobj%5Cproject.assets.json'%20not%20found.%20Run%20a%20NuGet%20package%20restore%20to%20generate%20this%20file.%20%5BD%3A%5Ca%5C8%5Cs%5Cxxxxxx.Packager%5Cxxxxxxx.Packager.wapproj%5D.%22%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3ERunning%20the%20same%20command%20line%20with%20the%20latest%20version%20of%20MSBuild%20locally%20is%20fine.%26nbsp%3B%3C%2FP%3E%3CP%20data-unlink%3D%22true%22%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2451367%22%20slang%3D%22en-US%22%3ERe%3A%20MSIX%20Azure%20DevOps%20MSIX%20Build%20and%20Package%20task%20failing%20on%20latest%20image%2020210525.0.%20Error%20NETSDK10%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2451367%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1068098%22%20target%3D%22_blank%22%3E%40JulesB%3C%2FA%3E%26nbsp%3BPlease%20add%20a%20Nuget%20Restore%20task%20to%20your%20pipeline%20to%20fix%20this%20issue.%20The%20MSIX%20Packaging%20build%20task%20does%20not%20do%20that%20automatically.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2452433%22%20slang%3D%22en-US%22%3ERe%3A%20MSIX%20Azure%20DevOps%20MSIX%20Build%20and%20Package%20task%20failing%20on%20latest%20image%2020210525.0.%20Error%20NETSDK10%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2452433%22%20slang%3D%22en-US%22%3EObviously%20given%20the%20error%20message%20that's%20the%20first%20thing%20I%20did%20but%20it%20didn't%20fix%20the%20issue.%20Also%20should%20be%20pointed%20out%20that%20prior%20to%20the%2020210525.0%20Azure%20agent%20image%20coming%20into%20play%20that%20error%20did%20not%20occur.%20I%20have%20build%20less%20than%2010%20minutes%20apart%20where%20the%20one%20on%20the%20previous%20image%20succeeded%20and%20the%20one%20on%20that%20image%20failed.%20Nothing%20had%20changed%20between%20builds%2C%20other%20than%20the%20image%20they%20ran%20on%2C%20I%20literally%20just%20re-queued%20it%20as%20I%20initially%20thought%20it%20was%20a%20glitch%20and%20then%20the%20next%20build%20worked%20as%20it%20happened%20to%20run%20on%20on%20agent%20using%20the%20previous%20image.%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20you%20look%20on%20the%20linked%20issue%20I%20created%20on%20Github%20(%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Factions%2Fvirtual-environments%2Fissues%2F3501%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Factions%2Fvirtual-environments%2Fissues%2F3501%3C%2FA%3E)%20you%20can%20see%20in%20the%20end%20the%20answer%20was%20to%20run%20a%20Build%20task%20before%20the%20Build%20and%20Package%20task%20with%20the%20MS%20Build%20parameter%20%2Ft%3ARestore.%20Unfortunately%20it%20took%20me%2014%20days%20to%20work%20this%20out%20as%20it%20wasn't%20obvious%20to%20me%20and%20I%20only%20hit%20on%20it%20due%20to%20a%20comment%20on%20a%20out%20of%20date%20blog%20post%20from%203%20years%20ago%20about%20.Net%20core%20which%20my%20project%20isn't.%3C%2FLINGO-BODY%3E
Occasional Contributor

Is anyone else using Azure Devops Pipelines to create their MSIX?

 

Starting 27th May as the Build Agent pool started to update to the latest image are MSIX build pipeline started to fail on MSIX Build and Package task. As of last week we have a 100% failure rate. 

 

I've reported it as an issue here but I'm surprised not to see more people reporting it as an issue. I've tried it with two different solutions and get the same result with both. 

 

The error is "error NETSDK1004: Assets file 'D:\a\8\s\xxxxxx.Packager\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [D:\a\8\s\xxxxxx.Packager\xxxxxxx.Packager.wapproj]."

 

Running the same command line with the latest version of MSBuild locally is fine. 

 

2 Replies

@JulesB Please add a Nuget Restore task to your pipeline to fix this issue. The MSIX Packaging build task does not do that automatically.

Obviously given the error message that's the first thing I did but it didn't fix the issue. Also should be pointed out that prior to the 20210525.0 Azure agent image coming into play that error did not occur. I have build less than 10 minutes apart where the one on the previous image succeeded and the one on that image failed. Nothing had changed between builds, other than the image they ran on, I literally just re-queued it as I initially thought it was a glitch and then the next build worked as it happened to run on on agent using the previous image.

If you look on the linked issue I created on Github (https://github.com/actions/virtual-environments/issues/3501) you can see in the end the answer was to run a Build task before the Build and Package task with the MS Build parameter /t:Restore. Unfortunately it took me 14 days to work this out as it wasn't obvious to me and I only hit on it due to a comment on a out of date blog post from 3 years ago about .Net core which my project isn't.