簡體   English   中英

APPX4001 警告

[英]APPX4001 warning

以下警告出現在我的 UWP 項目中。 我已經標記了解決方案的示例,但我更感興趣的是為什么在同一平台上創建另一個空項目時不會出現此警告?

APPX4001: Build property AppxBundlePlatforms is not explicitly set and is 
calculated based on currently building architecture. Use 'Create App 
Package' wizard or edit project file to set it.

APPX4001 警告的簡單解決方法請參閱此問題

但我更感興趣的是為什么在同一平台上創建另一個空項目時不會出現此警告?

我搜索了有關此警告的相關信息,發現了類似的問題 請參閱...\\AppxPackage\\Microsoft.AppXPackage.Targets(2459,5): warning ... ,因此該警告似乎是由Microsoft.AppXPackage.Targets文件引發的。 不知道為什么警告有時不顯示它來自哪里,但我認為目標文件是 APPX4001.dll 的原因。

我在C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\MSBuild\\Microsoft\\VisualStudio\\v15.0\\AppxPackage找到了該文件。 (對於vs2017企業版)讓我們檢查一下它拋出警告的內容:

在此處輸入圖片說明

所以很明顯,如果 Condition 中的值為真,它會拋出警告 APPX4001。 這個問題似乎與AppxBundle 所以我創建了一個新的uwp項目並構建它,一切正常。 然后我將此行添加到其 xx.csproj 文件中:

<AppxBundle>Always</AppxBundle>

然后出現同樣的警告:

在此處輸入圖片說明

因此,如果您嘗試build with Appxbundle or set the AppxBundle property in project file則會出現此警告。

這就是新的簡單項目不會顯示此警告的原因。 此警告的簡單解決方法是設置 AppxBundlePlatforms 屬性,請參閱我的答案中的第一行。

希望以上所有內容可以幫助解決為什么會出現警告並解決警告的難題。 如果我誤解了什么,請告訴我:)

也許這個鏈接可以提供幫助。

如文章所述,我嘗試打包我的應用程序(只是使用了沒有簽名的 Sideload 包)。 然后在包裝過程中添加了

<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>

.csproj 文件中的條目並且警告已消失

下面是我的文件。 我還創建了一個空項目,其中沒有出現此警告並比較了這些文件,但我沒有注意到任何有趣的事情

<PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{4D5DB11B-A55F-4255-A1F7-B58D14137F31}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>myapp2</RootNamespace>
<AssemblyName>myapp2</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.15063.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
<PackageCertificateKeyFile>myapp2_TemporaryKey.pfx</PackageCertificateKeyFile>



<PackageCertificateThumbprint>5F6796FA8483D6C4EDA3E24DB0DC18631F615689
</PackageCertificateThumbprint>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'"> 
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<CodeAnalysisRuleSet>MixedRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="lightbuzz-smtp">
  <Version>1.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
  <Version>5.2.3</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
  <Version>12.0.2</Version>
</PackageReference>
<PackageReference Include="Template10">
  <Version>1.1.12</Version>
</PackageReference>
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed">
  <Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="WampSharp">
  <Version>18.3.2</Version>
</PackageReference>
<PackageReference Include="WampSharp.Default">
  <Version>18.3.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<None Include="myapp2_TemporaryKey.pfx" />
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or 
'$(VisualStudioVersion)' &lt; '14.0' ">
<VisualSt udioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import 
Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml
 v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Target Name="AfterBuild">
<Message Importance="High" Text="Thank you for using Template 10. Find out more at 
  http://aka.ms/template10" />
</Target>
</Project>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM