有谁征服了VS2019中的Visual Studio安装程序项目? [英] Has anyone conquered the Visual Studio installer project in VS2019?

查看:172
本文介绍了有谁征服了VS2019中的Visual Studio安装程序项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我整个下午一直在搜索,发现有很多人问这个问题,在所有地方,有几个人会用同样的方式回答这个问题,然后世界其他地方就有十几条评论以及关于这些答案如何解决的OP.因此,我将在这里包括我已经尝试过的内容,如果您的解决方案是做我已经尝试过的事情之一,那么我会很难过.

I've been googling this all afternoon and I found any number of people ask the question, and all of the place a few people would answer it with the same things, and then there's a dozen comments by the rest of the world and the OP about how those answer don't fix it. So I'm going to include what I've tried here, and if your solution is to do one of the things I've already tried, I'm going to be very sad.

我在Visual Studio 2019中有一个解决方案,该解决方案具有一个类库,一个wpf应用程序和一个安装项目(使用安装项目扩展名). WPF应用程序当然也引用了一堆程序集,但是其中一个来自我在另一个解决方案中维护的另一个项目.在将编译后的dll从自己的项目更新到此项目后,我将其复制/粘贴.没什么棘手的,一切正常.

I have a solution in Visual Studio 2019 that has a class library, a wpf application, and a setup project (using the setup project extension). The WPF app also references a bunch of assemblies of course, but one of those is from another project I maintain in a different solution. I copy/paste the compiled dll after I update it from its own project to this one. Nothing tricky, everything works.

问题是安装程序.如果我先构建所有内容,然后构建安装程序,则它会产生预期的MSI.如果我在Visual Studio中右键单击该项目,然后选择安装",那么一切就完美了.

The problem is the installer. If I build everything and then build the installer, it produces an MSI as expected. If I right click on the project in Visual Studio and choose "Install", everything is perfect.

问题是在我对两个代码项目进行了一些更新之后,然后我都构建了两个项目并构建了安装项目,如果我右键单击以安装它,那就很完美了.如果我运行MSI,它并不总是更新目标文件.如果删除目标文件,它将使用新文件创建它们,但不会正确覆盖旧文件.

The problem is after I make some updates to either of the code projects, I then build both and build the setup project, and again if I right click to install it's perfect. If I run the MSI though, it doesn't always update the target files. If I delete the target files it will create them with the new ones, but it won't overwrite the old ones correctly.

  1. AssemblyVersion和AssemblyFileVersion每次都递增,并与"Version"同步.安装项目的属性.我对它们进行了广泛的测试,无法100%正常运行的新安装程序已使用正确更新的版本号更新了其中的dll.
  2. 当我更改版本"在设置之后,它要求更改ProductCode的GUID.我说是的,它更改了代码.我也没有这样做就进行了测试,众所周知,这会使情况变得更糟.
  3. "RemovePreviousVersions";设置为"true"在安装程序项目中

如果我右键单击该项目,然后选择安装",升级现有安装似乎是100%可靠的.

If I right click the project and choose "Install" it seems to be 100% reliable at upgrading the existing installation.

如果我直接运行MSI,它似乎100%不可靠,而且永远无法正确解决.

If I run the MSI directly it seems to be 100% unreliable and never gets it right.

请注意,它似乎通常但不总是将WPF应用程序升级,并且如果我记得要更新其版本,那么我会带入另一个项目dll,但是类库(由WPF应用程序引用)几乎从来没有有效.

Side note, it does seem to usually but not always get the WPF application upgraded and the other project dll I bring in if I remember to update its version, but the class library (which is referenced by the WPF application) almost never works.

有人能可靠地工作吗?

推荐答案

对于将来所有发现此问题的人来说,这是最后一个字:

For all the people finding this in the future, here's the final word:

构建项目可能不一致,正如我上面提到的,这在互联网上都有很好的记录.您没有做错任何事情-只是不一致.

The build project can be inconsistent, this is well documented all over the internet as I have above. You're not doing anything wrong - it is just inconsistent.

停止尝试解决它是否影响到您的项目并继续进行下去(在此一项工作正常之前,我已经进行了十二个项目).共识似乎是使用WiX,但我不在这里讨论替代方案.就我个人而言,我将着手进行WiX学习.

Stop trying to solve it if it's affecting your project and move on (I've had a dozen projects before this one work just fine). The consensus seems to be to use WiX, but I'm not here to discuss the alternatives. Personally I am going to embark on the WiX learning curve though.

这篇关于有谁征服了VS2019中的Visual Studio安装程序项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆