问题描述
我有一个带有自定义操作项目的安装程序.
I've got an installer with a custom action project.
我希望在安装时触发操作.
I want the action to fire at install.
动作触发,当我向事件日志写入内容时,它运行良好.
The action fires, when I write something to the event log, it works perfectly.
但我确实需要调试文件,因为操作非常复杂.
But I really need to debug the file since the action is quite complicated.
所以我有以下安装程序类:
So I've got the following installer class:
namespace InstallerActions
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.IO;
[RunInstaller(true)]
// ReSharper disable UnusedMember.Global
public partial class DatabaseInstallerAction : Installer
// ReSharper restore UnusedMember.Global
{
public DatabaseInstallerAction()
{
InitializeComponent();
}
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();
// none of these work
Foo();
}
private static void Foo()
{
}
}
}
安装程序只是在没有警告我的情况下完成,它没有中断,也没有要求我附加调试器.
The installer just finalizes without warning me, it doesn't break, it doesn't ask me to attach a debugger.
我试过调试和发布模式.我错过了什么吗?
I've tried debug and release mode. Am I missing something?
谢谢
-蛇
推荐答案
解决方案是在最后启动 base.Install
.显然 base.Install
之后的代码没有被执行.
The solution is to fire base.Install
as last. Apparently the code after base.Install
is NOT executed.
这篇关于Visual Studio 2008 安装程序,自定义操作.断点不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!