.NET 5 ClickOnce在PublishDir中创建重复的部署

发布于 2025-01-23 04:35:03 字数 687 浏览 0 评论 0 原文

我正在使用 MSBUILD (版本17.1.0+AE57D105C,从VS 2022开发人员命令提示符)将ClickOnce .NET 5应用程序发布到使用命令行的UNC路径。因此,我正在运行按

>msbuild /t:publish -p:PublishProfile=.\Properties\PublishProfiles\ClickOnceProfile.pubxml /p:PublishDir=\\some\unc\path\

预期的数量,这将许多文件移至 \\ some \ unc \ path 。如果在.NET 5之前进行此操作,我通常会期望文件类似,

\\some\unc\path\setup.exe
\\some\unc\path\Application Files\MyApp_1_0_0_9\SomeLibrary.dll.deploy

但是如果我使用上面的命令,或者如果我从Visual Studio中发布,我还会在 PublishDir的根源中获得一堆文件

\\some\unc\path\SomeLibrary.dll

鉴于这不是在较早版本中发生的,我认为这些文件是多余的,并且它们只是噪音。但是为什么创建它们?我可以摆脱它们吗?

I'm using msbuild (version 17.1.0+ae57d105c, from a VS 2022 Developer Command Prompt) to publish a ClickOnce .NET 5 application to a UNC path using the commandline. As such, I'm running what amounts to

>msbuild /t:publish -p:PublishProfile=.\Properties\PublishProfiles\ClickOnceProfile.pubxml /p:PublishDir=\\some\unc\path\

As expected, this moves a lot of files to \\some\unc\path. If I did this prior to .NET 5, I would generally expect to files like

\\some\unc\path\setup.exe
\\some\unc\path\Application Files\MyApp_1_0_0_9\SomeLibrary.dll.deploy

but if I use the command above, or if I publish from Visual Studio, I also get a bunch of files in the root of PublishDir,

\\some\unc\path\SomeLibrary.dll

Given that this didn't happen in earlier versions, I'm assuming these files are redundant, and that they're just noise. But why are they created? Can I get rid of them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一城柳絮吹成雪 2025-01-30 04:35:03

根据我的经验,这是一个错误,当您将< prublishdir> < prublishurl> 设置为.pubxml配置文件中的相同值时发生。这似乎是一件合理的事情,因为根据这些文档

Publishurl是将应用程序发布到IDE的位置。

MSBUILD系统使用PublishDir选项指定输出的位置

这听起来像是要设置两个标签,如果您想从VS内部和命令行发布这两个标签。但是,如果将它们都设置为相同的值,则会获取所有重复的文件。如果我将< publishdir> 设置为某个随机临时目录,则在击中vs中的发布按钮时,我将不再获得重复文件。

我已经使用Microsoft

In my experience this is a bug which occurs when you set <PublishDir> and <PublishUrl> to the same value in your .pubxml profile. Which seems like a reasonable thing to do, since according to these docs

PublishUrl is the location where the application will be published to in the IDE.

and

The MSBuild system uses the PublishDir option to specify the location for output

That makes it sound like you should set both tags if you want to publish both from within VS and from the command line. However if you do set them both to the same value, you get all the duplicate files. If I set <PublishDir> to some random temporary directory, I no longer get the duplicate files when hitting the Publish button in VS.

I've raised this with Microsoft here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文