简体   繁体   English

如何使用依赖于框架的 Windows 应用程序打包项目打包 .NET 6 WPF 应用程序?

[英]How to pack a .NET 6 WPF app using Windows Application Packaging Project with Framework-Dependent?

I have a WPF app App1 (.NET 6 with <TargetFramework>net6.0-windows</TargetFramework> ) and my client would like to distribute it through MS Store so I created a Windows Application Packaging Project and add reference back to App1 .我有一个 WPF 应用程序App1 (带有<TargetFramework>net6.0-windows</TargetFramework> .NET 6),我的客户想通过 MS Store 分发它,所以我创建了一个Windows Application Packaging Project并将引用添加回App1 Everything works well and we can publish our app except with just a Hello World project, the package size is more than 60MB (for neutral arch).一切正常,我们可以发布我们的应用程序,除了一个 Hello World 项目,包大小超过60MB (对于中性架构)。

I understand it is due to it packing the whole .NET 6 with it.我知道这是因为它包含了整个 .NET 6。 Is there a way to publish it using framework-dependent model instead?有没有办法使用依赖于框架的模型来发布它? We don't mind user being asked to download and install it if they don't have it already installed.如果用户尚未安装它,我们不介意要求用户下载并安装它。

Follow these steps to create a framework-dependent MSIX package:按照以下步骤创建依赖于框架的 MSIX 包:

  • Right click on the WPF project (not the Windows Application Packaging Project) in the Solution Explorer in Visual Studio and choose Publish在 Visual Studio 的解决方案资源管理器中右键单击 WPF 项目(不是 Windows 应用程序打包项目),然后选择发布
  • Choose Folder as both target and specific target and accept the default location in the wizard选择文件夹作为目标和特定目标,并接受向导中的默认位置
  • Click on the "Show all settings" link of the created publish profile and set the target runtime to win-x86 or win-x64 depending on your CPU architecture requirements单击创建的发布配置文件的“显示所有设置”链接,然后根据您的 CPU 架构要求将目标运行时设置为win-x86win-x64
  • Make sure that the deployment mode is set to Framework-dependent确保部署模式设置为依赖于框架
  • Click Save点击保存
  • Go to the Windows Application Packaging Project, expand the Dependencies->Applications node, select the referenced WPF application project and set its Publishing Profile property to the Properties\PublishProfiles\FolderProfile.pubxml file that you created in the previous wizard转到 Windows 应用程序打包项目,展开 Dependencies->Applications 节点,选择引用的 WPF 应用程序项目并将其 Publishing Profile 属性设置为您在上一个向导中创建的Properties\PublishProfiles\FolderProfile.pubxml文件
  • Re-publish the Windows Application Packaging Project with the same CPU architecture and configuration you have configured the publishing profile for使用您为其配置发布配置文件的相同 CPU 体系结构和配置重新发布 Windows 应用程序打包项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 .net核心应用程序是否具有与框架相关的部署,并带有附加的nuget包? - Is there framework-dependent deploy of .net core app with added nuget packages? 如何将类库发布为依赖于框架的部署 - How to publish a classlib as framework-dependent deployment 在 Visual Studio 2017 中将 .NET Core 2.2 应用程序发布为依赖于框架的可执行文件 (FDE) - Publish .NET Core 2.2 app in Visual Studio 2017 as framework-dependent executable (FDE) WPF 应用程序的 UWP 打包项目是“SelfContained”吗? - Is a UWP packaging project for a WPF application "SelfContained"? 如何在 Visual Studio 中修复 Windows 应用程序包的目标框架参考 - How to fix target framework reference for windows application pack in visual studio 使用.net应用程序部署打包.net框架 - Packaging up the .net framework with a .net application deployment 仅使用.Net Framework安装WPF应用程序 - Install WPF application using only .Net Framework 如何在 Azure 管道上打包 .net 框架 Web 应用程序 - How to pack .net framework Web App on Azure Pipelines 如何将.NET WPF应用程序转换为Windows窗体? - How to convert .NET WPF application to Windows Forms? 使用 .Net 框架为 Windows 应用程序/Windows 服务创建 Dockerfile - Create a Dockerfile for windows application/Windows Service using .Net framework
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM