Search code examples
c#visual-studiomsix

Visual Studio trying to package app using MSIX, "project.assets.json not found" error


I have a visual studio solution (2202 V17.5.4), made up of three sub-projects for my app, and then an extra project for the MSIX deployment toolset, using Microsoft.Windows.SDK.BuildTools V10.0.22621.756. the app is C# .NET 7.0.

My app and its projects all build and run fine. The MSIX project also builds fine. So now im trying to package up my application for deployment.

When I go do a right-click on the MSIX project > publish > create App Package, I get the following error

Error Assets file 'XXXXredactedXXXX\obj\wappublish\win-x64\project.assets.json' not found. Run a NuGet package restore to generate this file.   MSIXDeployment  C:\Program Files\dotnet\sdk\7.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets

I'm not sure if this is relevant, but when I do a dotnet restore, it skips the MSIXProject:

XXXXredactedXXXX\MSIXDeployment\MSIXDeployment.wapproj : warning NU1503: Skipping restore for project 'XXXXredactedXXXX\MSIXDeployment\MSIXDeployment.wapproj'. The project file may be invalid or missing targets required for restore [XXXXredactedXXXX.sln]
Determining projects to restore...
  All projects are up-to-date for restore.

I have been scratching my head with this for a while now. I did find a related post from 2019 and tried the suggestions, but non of them worked for me. Would anyone be able to shed some light?


Solution

  • I solved this by adding a x64 platform in the Configuration Manager for each project within the Solution.

    1. open Build > Configuration Manager
    2. add a new platform "x64" for each project (copy from Any CPU without creating new solution platforms)
    3. do this for debug and release configurations