调试Windows安装程序 - 需要为每个构建版本更改吗? [英] Debugging Windows installer - requires version changes for each build?

查看:68
本文介绍了调试Windows安装程序 - 需要为每个构建版本更改吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows
安装程序项目中调试C#自定义操作DLL,我可以正常启动调试器。但问题是
,我需要多次运行安装程序,而
调试我的C#代码。



问题#1是如果我想要运行相同版本的安装程序(并通过C#代码获取
不同路径),第二次执行会自动将
踢入修复/卸载模式。有没有办法解决这个问题?



问题#2类似:如果我运行安装程序一次并完成安装,那么
重建安装程序项目并尝试运行再次,安装程序中止
,并显示消息"此产品的另一个版本已经安装了
。"您必须先通过"添加/删除程序"卸载(或使用之前版本的保存的
版本),然后才能运行其他试用版。如果我除了更改安装项目的每个
ProductCode并重建它之外什么都不做,那么安装将失败,并显示错误消息"无法安装
,因为已经安装了此产品的较新版本。"
我可以调试吗?



问题#3是如果我在调试器中停止并以
不可预测的方式中止安装程序,它会弄得一团糟注册表,以便我既不能
卸载或安装新的。我需要花费很长时间才能搜索每个相关的
注册表项并手动清除它们。有没有更好的方法来清理
这个烂摊子?



解决方案

我正在回答这个差不多十二年的问题,以防有人需要答案。 


#1 - 这是正常行为,但是你可以从控制面板手动删除安装,然后运行安装项目。


#2 - 这是我采取的避免这一步骤的步骤:


1-增加版本号


2 - 接受新产品代码


3 - 匹配程序集上的版本


4 - 设置"RemovePreviousVersion"" to" True"


这将创建已安装的版本的更新版本,而不是新版本,当您运行它时,它将更新已安装的版本。


I am trying to debug a C# custom action DLL within a Windows Installer project and I can launch the debugger just fine. But the issue is that I need to run the installation program itself multiple times while debugging my C# code.

Problem #1 is that if I want to run the same build of the installer (and take different paths through the C# code), the second execution automatically kicks into repair / uninstall mode. Is there any way around this?

Problem #2 is similar: if I run the installer once and finish installing, then rebuild the installer project and try to run it again, the installer aborts with the message "another version of this product is already installed." You have to uninstall via Add/Remove Programs (or use a saved version of the previous build) before you can run another trial. If I do nothing other than change the setup project's ProductCode each and rebuild it the install will fail with the error message "Unable to install because a newer version of this product is already installed." How can I debug this?

Problem #3 is that if I stop in the debugger and abort the installer in an unpredictable way, it makes a mess of the registry so that I can neither uninstall or install new. It takes me quite a while to search for every related registry key and purge them all manually. Is there any better way to clean up the mess?

解决方案

I'm answering this almost twelve years old question in case somebody needs the answer. 

#1 - That's normal behavior, but you could manually remove the installation from control panel and then run the setup project.

#2 - These are the steps I take to avoid that:

1- Increase the version number

2 - Accept the new product code

3 - Match the version on the Assembly

4 - Set the "RemovePreviousVersion" to "True"

This will create an updated version of the one installed, not a new version, when you run it, it will update the version installed.


这篇关于调试Windows安装程序 - 需要为每个构建版本更改吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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