我应将项目的目标处理器体系结构更改为什么? [英] To What Should I Change the Targeted Processor Architecture of my Project?

查看:86
本文介绍了我应将项目的目标处理器体系结构更改为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个要提交到Windows应用商店的.NET Core Winforms应用(使用C#).按照

我尝试创建程序包,但由于出现此错误消息而失败:

严重性代码描述项目文件行抑制状态错误处理器的架构之间不匹配.正在建立的项目"MSIL";和处理器的架构参考"C:\ Users \ bclay \ source \ repos \ F4F_Core \ F4F_Core \ bin \ x86 \ Release \ netcoreapp3.1 \ win-x86 \ F4F_Core.dll","x86".这种不匹配可能会导致运行时失败.请考虑通过更改项目的目标处理器体系结构配置管理器,以便调整处理器体系结构在您的项目和参考之间,或依赖具有与目标匹配的处理器体系结构的引用项目的处理器体系结构.WapProjTemplate1 C:\ Program文件(x86)\ Microsoft VisualStudio \ 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)'==''或'$(VisualStudioVersion)'& lt;"15.0"< VisualStudioVersion> 15.0</VisualStudioVersion></PropertyGroup>< ItemGroup Label ="ProjectConfigurations">< ProjectConfiguration Include ="Debug | x86"><配置>调试</配置><平台> x86</平台></ProjectConfiguration>< ProjectConfiguration Include ="Release | x86"><配置>发布</配置><平台> x86</平台></ProjectConfiguration>< ProjectConfiguration Include ="Debug | x64"><配置>调试</配置>< Platform> x64</Platform></ProjectConfiguration>< ProjectConfiguration Include ="Release | x64"><配置>发布</配置>< Platform> x64</Platform></ProjectConfiguration>< ProjectConfiguration Include ="Debug | ARM"><配置>调试</配置><平台> ARM</平台></ProjectConfiguration>< ProjectConfiguration Include ="Release | ARM"><配置>发布</配置><平台> ARM</平台></ProjectConfiguration>< ProjectConfiguration Include ="Debug | ARM64"><配置>调试</配置><平台> ARM64</平台></ProjectConfiguration>< ProjectConfiguration Include ="Release | ARM64"><配置>发布</配置><平台> ARM64</平台></ProjectConfiguration>< ProjectConfiguration Include ="Debug | AnyCPU"><配置>调试</配置><平台> AnyCPU</平台></ProjectConfiguration>< ProjectConfiguration Include ="Release | AnyCPU"><配置>发布</配置><平台> AnyCPU</平台></ProjectConfiguration></ItemGroup>< PropertyGroup>< WapProjPath Condition ='''$(WapProjPath)'==''''> $(MSBuildExtensionsPath)\ Microsoft \ DesktopBridge \</WapProjPath></PropertyGroup><导入项目="$(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>始终</AppxBundle></PropertyGroup>< PropertyGroup Condition =''''$(Configuration)| $(Platform)'=='Debug | ARM''>< AppxBundle>始终</AppxBundle></PropertyGroup>< PropertyGroup Condition =''''$(Configuration)| $(Platform)'=='Debug | x64''>< AppxBundle>始终</AppxBundle></PropertyGroup>< PropertyGroup Condition ="'$(Configuration)| $(Platform)'=='Release | ARM''>< AppxBundle>始终</AppxBundle></PropertyGroup>< PropertyGroup Condition ="'$(Configuration)| $(Platform)'=='Release | x86'"< AppxBundle>始终</AppxBundle></PropertyGroup>< PropertyGroup Condition ="'$(Configuration)| $(Platform)'=='Release | ARM64'''>< AppxBundle>始终</AppxBundle></PropertyGroup>< PropertyGroup Condition =''''$(Configuration)| $(Platform)'=='Debug | ARM64''>< AppxBundle>始终</AppxBundle></PropertyGroup>< PropertyGroup Condition =''''$(Configuration)| $(Platform)'=='Debug | AnyCPU''>< AppxBundle>始终</AppxBundle></PropertyGroup>< PropertyGroup Condition ="'$(Configuration)| $(Platform)'=='Release | AnyCPU'"< AppxBundle>始终</AppxBundle></PropertyGroup>< PropertyGroup Condition ="'$(Configuration)| $(Platform)'=='Release | x64'">< AppxBundle>始终</AppxBundle></PropertyGroup>...< ItemGroup>< ProjectReference Include =".. \ F4F_Core \ F4F_Core.csproj">< SkipGetTargetFrameworkProperties>真实</SkipGetTargetFrameworkProperties></ProjectReference></ItemGroup><导入项目=" $(WapProjPath)\ Microsoft.DesktopBridge.targets"/></Project> 

我没有更改这些(处理器体系结构)值中的任何默认设置.我需要更改什么才能使包成功创建?

选择项目>主项目的属性显示如下:

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

因此,如您所见,配置和平台被认为是"N/A".因此不可编辑.

更新

在创建应用程序包"中,在此过程中,我保留了默认的中性/发行版(任何CPU)"选择如下所示:

更新2

此答案[https://social.msdn.microsoft.com/Forums/windowsapps/en-US/461f4b46-f928-40da-8e49-7fd0f4754fd4/uwpmismatch-between-processor-architecture?forum=wpdevelop]Microsoft论坛指示任何"表示不".不应选择,而应选择"x86"

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

为清楚起见,平台"是指上面的下拉菜单中只有一项:活动(任何CPU)"

更新3

根据NicoZhu的要求,我为此问题向Visual Studio发送反馈",我打开了该项目,并立即对此表示欢迎:

更新4

所以我注意到Visual Studio中有一些通知.有人说,要开发UWP应用程序,我必须打开开发人员模式".所以我做到了...

打开后,我得到了:

VS重新启动后,我再次尝试创建App Package,但是得到了这个提示:

...但是我不知道应用清单中的错误是什么,因此如果没有这些知识就无法修复它们.

错误信息msg是否引用Package.appxmanifest中的值?

更新5

接下来是该解决方案及其两个项目的各种属性.

解决方案:

Winforms .NET Core应用程序的属性:

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

更新6

did 下面的更新答案创建了程序包,但是当我尝试运行Windows Packaging App时,我得到了一个错误:两个项目中的处理器体系结构不匹配.请参阅我的后续问题

右键单击软件包模板项目->发布->创建应用程序包->侧载->跳过软件包签名

仅检查x86体系结构.

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)' &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>

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.

UPDATE

While in the "Create App Packages" process, I retained the default "Neutral / Release (Any CPU)" selection as shown here:

UPDATE 2

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)"

UPDATE 3

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:

UPDATE 4

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?

UPDATE 5

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:

UPDATE 6

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.

这篇关于我应将项目的目标处理器体系结构更改为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆