Skip to content

dotnet build fails when WindowsAppSDK is referenced in console application.  #3548

@ianeuman

Description

@ianeuman

Describe the bug

Building a blank console application with .NET 6 through dotnet cli dotnet build fails with the following error.

MSBuild version 17.5.0+6f08c67f3 for .NET
  Determining projects to restore...
  Restored D:\Repos\WindowsAppSDKDotnet\WindowsAppSDKDotnetConsole\WindowsAppSDKDotnetConsole.csproj (in 216 m
  s).
C:\Users\user\.nuget\packages\microsoft.windowsappsdk\1.2.230313.1\buildTransitive\MrtCore.PriGen.targets(911,5): e
rror MSB4062: The "Microsoft.Build.Packaging.Pri.Tasks.ExpandPriContent" task could not be loaded from the assembly C:\
Program Files\dotnet\sdk\7.0.202\\Microsoft\VisualStudio\v17.0\AppxPackage\\Microsoft.Build.Packaging.Pri.Tasks.dll. Co
uld not load file or assembly 'C:\Program Files\dotnet\sdk\7.0.202\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.B
uild.Packaging.Pri.Tasks.dll'. The system cannot find the path specified. Confirm that the <UsingTask> declaration is c
orrect, that the assembly and all its dependencies are available, and that the task contains a public class that implem
ents Microsoft.Build.Framework.ITask. [D:\Repos\WindowsAppSDKDotnet\WindowsAppSDKDotnetConsole\WindowsAppSDKDo
tnetConsole.csproj]

Build FAILED.

C:\Users\user\.nuget\packages\microsoft.windowsappsdk\1.2.230313.1\buildTransitive\MrtCore.PriGen.targets(911,5): e
rror MSB4062: The "Microsoft.Build.Packaging.Pri.Tasks.ExpandPriContent" task could not be loaded from the assembly C:\
Program Files\dotnet\sdk\7.0.202\\Microsoft\VisualStudio\v17.0\AppxPackage\\Microsoft.Build.Packaging.Pri.Tasks.dll. Co
uld not load file or assembly 'C:\Program Files\dotnet\sdk\7.0.202\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.B
uild.Packaging.Pri.Tasks.dll'. The system cannot find the path specified. Confirm that the <UsingTask> declaration is c
orrect, that the assembly and all its dependencies are available, and that the task contains a public class that implem
ents Microsoft.Build.Framework.ITask. [D:\Repos\WindowsAppSDKDotnet\WindowsAppSDKDotnetConsole\WindowsAppSDKDo
tnetConsole.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.38

Note: I tried with both latest and the preview version.
1.2.230313.1
1.3.230228005-preview1

Steps to reproduce the bug

  1. Create new console application project through visual studio.
  2. Add WindowsAppSDK nuget package as a dependency.
  3. Open the location for the project through powershell.
  4. Build the project through 'dotnet build'.
  5. The build fails.

Expected behavior

The build succeeds.

Screenshots

No response

NuGet package version

Windows App SDK 1.2.5: 1.2.230313.1

Packaging type

Unpackaged

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-DeveloperToolsIssues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integrationbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions