我正在使用 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?
发布评论
评论(1)
根据我的经验,这是一个错误,当您将
< prublishdir>
和< prublishurl>
设置为.pubxml配置文件中的相同值时发生。这似乎是一件合理的事情,因为根据这些文档和
这听起来像是要设置两个标签,如果您想从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 docsand
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.