Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 我应该如何更改项目的目标处理器体系结构?_Windows_Uwp_Visual Studio 2019_Cpu Architecture_Configurationmanager - Fatal编程技术网

Windows 我应该如何更改项目的目标处理器体系结构?

Windows 我应该如何更改项目的目标处理器体系结构?,windows,uwp,visual-studio-2019,cpu-architecture,configurationmanager,Windows,Uwp,Visual Studio 2019,Cpu Architecture,Configurationmanager,我已经创建了一个.NET核心Winforms应用程序(使用C#),我想将其提交到Windows应用商店。按照上面的说明,我在解决方案中添加了一个Windows应用程序打包项目: 我尝试创建包,但失败,错误消息: 严重性代码说明项目文件行抑制状态 错误-服务器的处理器体系结构不匹配 正在构建的项目“MSIL”和 参考 “C:\Users\bclay\source\repos\F4F\u Core\F4F\u Core\bin\x86\Release\netcoreapp3.1\win-x86\F

我已经创建了一个.NET核心Winforms应用程序(使用C#),我想将其提交到Windows应用商店。按照上面的说明,我在解决方案中添加了一个Windows应用程序打包项目:

我尝试创建包,但失败,错误消息:

严重性代码说明项目文件行抑制状态 错误-服务器的处理器体系结构不匹配 正在构建的项目“MSIL”和 参考 “C:\Users\bclay\source\repos\F4F\u Core\F4F\u Core\bin\x86\Release\netcoreapp3.1\win-x86\F4F\u Core.dll”, “x86”。这种不匹配可能会导致运行时失败。请考虑 通过更改项目的目标处理器体系结构 配置管理器,以便调整处理器架构 在项目和引用之间,或者依赖于 使用与目标应用程序匹配的处理器体系结构进行引用 项目的处理器架构。WapProjTemplate1 C:\Program 文件(x86)\Microsoft Visual Studio Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 2124

所以它说“考虑通过Configuration Manager更改项目的目标处理器体系结构”

这是Configuration Manager显示的内容:

它允许我添加新的或编辑现有的:

…但我不知道我应该在这里添加或更改什么

WapProjTemplate1.wapproj文件中可能相关的部分包括:

<?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)' &lt; '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>

15
调试
x86
释放
x86
调试
x64
释放
x64
调试
手臂
释放
手臂
调试
ARM64
释放
ARM64
调试
任意CPU
释放
任意CPU
$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\
235c6e85-cf17-455c-93b8-efdd1826a90e
10.0.18362.0
10.0.14393.0
. . .
0

选择Windows应用程序打包项目的项目属性会显示以下内容:

如您所见,配置和平台被视为“不适用”,因此不可编辑

更新 在“创建应用程序包”过程中,我保留了默认的“中立/发布(任何CPU)”选择,如下所示:

更新2 这个答案[https://social.msdn.microsoft.com/Forums/windowsapps/en-US/461f4b46-f928-40da-8e49-7fd0f4754fd4/uwpmismatch-between-processor-architecture?forum=wpdevelop]在Microsoft论坛上显示,不应选择“Any”,而应选择“x86”

但是,当我将主项目的目标从Any更改为x86时,它不会更改上面的值:

需要明确的是,上面的“平台”下拉列表中只有一项:“活动(任何CPU)”

更新3 根据NicoZhu的要求,我“向Visual Studio发送有关此问题的反馈”,我打开了项目,并立即收到以下信息:

更新4 所以我注意到在VisualStudio中有一些通知。有人说为了开发UWP应用程序,我必须打开开发者模式。所以我就这么做了

打开后,我得到:

重新启动后,我再次尝试创建应用程序包,但得到以下结果:

…但我不知道应用程序清单中的错误是什么,因此在没有这些信息的情况下无法修复它们

err msg是否引用Package.appxmanifest中的值

更新5 整个解决方案及其两个项目的各种属性如下所示

解决方案:

Winforms.NET核心应用程序的属性:

Windows应用程序打包项目的属性:

更新6
下面更新的答案确实创建了包,但当我尝试运行Windows打包应用程序时,我遇到了一个错误:两个项目中的处理器架构不匹配。请参阅我的后续问题。

在使用blank project进行测试期间,我可以复制此问题,我们建议您就此问题向Visual Studio发送反馈。目前,我们有一个变通方法,可以将Winform平台目标编辑为x86(而不是平台下拉列表),将应用程序包模板发布为x86发布包

更新

右键单击winform项目->属性->构建->平台。

在程序包模板项目->发布->创建应用程序包->侧加载->跳过程序包签名上单击鼠标右键

仅检查x86体系结构


谢谢你,尼科朱;您能否提供一些分步说明,说明如何“将Winform平台目标编辑为x86(不是平台下拉列表),将应用程序包模板发布为x86发布包”?您的更新确实创建了包,但当我尝试运行Windows打包应用程序时,我得到一个错误:这两个项目中的处理器架构不匹配。请参阅我的后续问题