简体   繁体   English

通过 Visual Studio MSIX 打包将 Package 支持框架添加到 .Netcore 3.1 应用程序 (WPF)

[英]Add Package support framework to a .Netcore 3.1 app (WPF) through Visual Studio MSIX packaging

I have a .netcore 3.1 WPF app and I'm using a MSIX packaging project through visual studio for distribution.我有一个 .netcore 3.1 WPF 应用程序,我正在通过 Visual Studio 使用 MSIX 打包项目进行分发。 Is it possible to add PSF to a .netcore 3.1 app?.是否可以将 PSF 添加到 .netcore 3.1 应用程序? Basically what I'm trying to do is, I want the MSIX installer to add a desktop shortcut automatically after the installation is done.基本上我想要做的是,我希望 MSIX 安装程序在安装完成后自动添加桌面快捷方式。 This is the approach I'm following: https://docs.microsoft.com/en-us/windows/msix/psf/create-shortcut-with-script-package-support-framework这是我正在遵循的方法: https://docs.microsoft.com/en-us/windows/msix/psf/create-shortcut-with-script-package-support-framework

I also found this guide on how to add PSF to visual studio: https://docs.microsoft.com/en-us/windows/msix/psf/package-support-framework-vs .我还找到了有关如何将 PSF 添加到 Visual Studio 的指南: https://docs.microsoft.com/en-us/windows/msix/psf/package-support-framework-vs It uses a c++ project to run a.dll, but I think that's only compatible with .net framework and it's not compatible with .netcore.它使用 c++ 项目来运行 a.dll,但我认为这仅与 .net 框架兼容,与 .netcore 不兼容。 Can anyone please help me?谁能帮帮我吗?

You don't need to use the package support framework.您不需要使用 package 支持框架。

The PSF is recommended for cases when IT pros don't have access to the source code of the application and basically, they need an additional launcher (the psflauncher.exe) to execute additional code or redirect API calls before they get to the application.当 IT 专业人员无法访问应用程序的源代码时,建议使用 PSF,基本上,他们需要额外的启动器(psflauncher.exe)来执行额外的代码或重定向 API 调用,然后才能访问应用程序。

In your case, all you need is to add a few lines of code inside your startup/main method of your application to create the shortcut .在您的情况下,您只需要在应用程序的启动/主方法中添加几行代码来创建快捷方式

Remember, the trick is to run this code only the first time the application is launched and if the shortcut isn't already on the desktop.请记住,诀窍是仅在应用程序第一次启动并且快捷方式尚未在桌面上时才运行此代码。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM