WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

Self contained apps fail to build with AnyCPU & RIDs

Open mattleibow opened this issue 3 years ago • 7 comments

Describe the bug

When building a self contained app that uses a RID instead of the platform, the build fails:

C:\Users\mattl.nuget\packages\microsoft.windowsappsdk\1.1.1\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(42,5): error : The platform 'AnyCPU' is not supported for Self Contained mode.

@Scottj1s I believe this is similar to another issue before with copying things. I copied the changes you made in the _GetProjectArchitecture target and it works here too.

image

Steps to reproduce the bug

    <IsUnpackaged>true</IsUnpackaged>
    <WindowsPackageType Condition="'$(IsUnpackaged)' == 'true'">None</WindowsPackageType>
    <WindowsAppSDKSelfContained Condition="'$(IsUnpackaged)' == 'true'">true</WindowsAppSDKSelfContained>
    <SelfContained Condition="'$(IsUnpackaged)' == 'true'">true</SelfContained>

Expected behavior

Builds

Screenshots

No response

NuGet package version

1.1.1

Packaging type

Unpackaged

Windows version

No response

IDE

No response

Additional context

No response

mattleibow avatar Jun 28 '22 11:06 mattleibow

@mattleibow The check needs to include "Any CPU" as well. When building a .sln a .metaproj gets generated that converts "Any CPU" to "AnyCPU" but if you build the .proj file directly this doesn't happen and this check breaks.

sbanni avatar Jun 28 '22 20:06 sbanni

This AnyCPU vs Any CPU might affect the other locations as well then? AnyCPU is used a lot in the targets generally.

mattleibow avatar Jun 30 '22 14:06 mattleibow

This AnyCPU vs Any CPU might affect the other locations as well then? AnyCPU is used a lot in the targets generally.

Yes, there is already another bug I filed here where I am hitting this issue. Would be a good idea to scrub the the whole repo.

sbanni avatar Jun 30 '22 16:06 sbanni

Discussion/3026 helped me to solve this issue. Just add the platform parameter to your command with -p:Platform=....

gary-89 avatar Dec 02 '22 15:12 gary-89

In most modern frameworks - such as maui - we use RIDs. So, it does work with Platform, but I am explicitly not using it.

mattleibow avatar Jan 11 '23 03:01 mattleibow

Related to https://github.com/microsoft/WindowsAppSDK/issues/4008

mattleibow avatar Nov 30 '23 22:11 mattleibow