I have created a .NET Core Winforms app (using C#) that I want to submit to the Windows app Store. Following what it says here, I added a Windows Application Packaging Project to my solution:
I tried creating the Package, but it failed with this err msg:
Severity Code Description Project File Line Suppression State Error There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Users\bclay\source\repos\F4F_Core\F4F_Core\bin\x86\Release\netcoreapp3.1\win-x86\F4F_Core.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. WapProjTemplate1 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 2124
So it says to "consider changing the targeted processor architecture of your project through the Configuration Manager"
This is what Configuration Manager shows:
It allows me to add a New or Edit the existing:
...but I don't know what I should try to add or change here.
The parts of the WapProjTemplate1.wapproj file that may be relevant are:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x86">
<Configuration>Release</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|AnyCPU">
<Configuration>Debug</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|AnyCPU">
<Configuration>Release</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>235c6e85-cf17-455c-93b8-efdd1826a90e</ProjectGuid>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.14393.0</TargetPlatformMinVersion>
. . .
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
. . .
<ItemGroup>
<ProjectReference Include="..\F4F_Core\F4F_Core.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
</ProjectReference>
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
</Project>
I did not change any default settings in these (processor architecture) values. What do I need to change to get the package to successfully create?
Selecting Project > Properties for the main project shows this:
Selecting Project Properties for the Windows Application Packaging Project shows this:
So as you can see, the Configuration and Platform are considered "N/A" and are thus non-editable.
While in the "Create App Packages" process, I retained the default "Neutral / Release (Any CPU)" selection as shown here:
This answer [https://social.msdn.microsoft.com/Forums/windowsapps/en-US/461f4b46-f928-40da-8e49-7fd0f4754fd4/uwpmismatch-between-processor-architecture?forum=wpdevelop] on a Microsoft forum indicates that "Any" should not be selected, but rather "x86"
But when I change the main project's target from Any to x86, it doesn't change the value above:
To be clear, the "Platform" dropdown above only has one item in it: "Active (Any CPU)"
In accord with NicoZhu's request that I "send feedback with Visual Studio for this issue," I opened the project and was immediately greeted by this:
So I noticed there were some notifications in Visual Studio. One said that in order to develop UWP apps, I had to turn on Developer Mode. So I did that...
After that was turned on, I got:
Ater VS restarted, I tried again to Create App Package, but got this:
...but I don't know what the errors in the app manifest are, so can't fix them without that knowledge.
Is the err msg referring to the values in Package.appxmanifest?
The various properties for the solution as a whole and for its two projects follows.
The solution:
The Winforms .NET Core app's properties:
The Windows Application Packaging Project's properties:
The updated answer below did create the packages, but when I then tried to run the Windows Packaging App, I got an err re: mismatched processor architectures in the two projects. Please see my follow-up question here.
During the testing with blank project, I could reproduce this issue, and we suggest you send feedback with Visual Studio for this issue. And currently we have a workaround that edit the Winform platform target as x86 (not Platform dropdown), publish application package template as x86 release package.
Update
Right click winform project-> Properties-> build- >Platform.
Right the package template project -> Publish -> Create app packages-> Sideloading-> Skip package signing
Only check x86 Architecture.