visual-studio - 在安装时安装 Visual C++ Redistributables 2005
问题描述
在我的 Windows 服务(Visual Studio 安装项目)的安装过程中,我仍然需要安装 Microsoft C++ 2005 Redistributables。我已经有在后台安装这些包的程序。该编程有效。现在我想在安装 Windows 服务时调用这个程序。但是我总是收到错误消息“正在安装另一个程序,请等待安装完成,然后再次尝试安装软件。” . 我已经尝试过 ProjectInstaller 类的所有方法(OnBeforeInstall、OnAfterInstall、Commit)——没有任何效果。但是在默认的先决条件中我不能选择这个包,因为它太旧了。
我该如何解决这个问题?
非常感谢!:)
解决方案
安装时可以按照以下步骤进行Microsoft C++ 2005 Redistributables
安装:
- 按照此文档为您的设置项目创建自定义操作。
- 在安装方法中添加这些代码
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
Process myProcess = new Process();
myProcess.StartInfo.FileName = @"{Your Directory}\vcredist_x86.EXE";
myProcess.StartInfo.Arguments = "/Q"; //install automactically
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
myProcess.StartInfo.Verb = "runas"; //run exe as administrator(Important!)
myProcess.Start();
}
推荐阅读
- c++ - 在 kubuntu 上安装 Qt 4.4.3 版出现错误:缩小转换
- java - 尝试在空对象引用上调用虚拟方法“void android.view.View.setAnimation(android.view.animation.Animation)”
- swift - 如何在 PencilKit 的 PKCanvasView 中禁用铅笔绘图,仅用于查看目的
- c# - 尝试为 API 编写 POST 方法,我无法在“邮递员”上获得结果
- javascript - 在php中提交表单后,未加载成功消息模式
- java - 如何在 Itext Pdf 文档中为不同页面设置不同的页脚
- pdf - 如何在 Crystal Reports 中更改 PDF 文件的名称?
- java - 如何从使用 mysql 中该行的 sum(1) 接收到的数据创建一个新列
- elasticsearch - 将 Elasticsearch 普通查询转换为 BoolQuery 不起作用
- android - 如何实现此图像中显示的卡片视图(正文中的图像链接)