从使用 Wix 创建的 MSI 运行卸载时,我需要在尝试删除任何文件之前强制终止在后台运行的进程。主要应用程序由一个托盘图标组成,它反映了监视本地 Windows 服务的 bg 进程的状态(用 C# 制作,尽管这可能与进一步的相关性不大)。
我首先尝试了以下方法:
<File Id='FooEXE' Name='Foo.exe' Source='..\Source\bin\Release\Foo.exe' Vital='yes' />
...
<InstallExecuteSequence>
<Custom Action="CloseTray" Before="InstallValidate" />
</InstallExecuteSequence>
...
<CustomAction Id="CloseTray" ExeCommand="-exit" FileKey="FooEXE" Execute="immediate" Return="asyncWait" />
Run Code Online (Sandbox Code Playgroud)
确认应用程序关闭对话框后,托盘图标立即关闭,但卸载完成后,Foo.Exe 任务仍然出现在taskmgr 上。另外,还给出了以下错误消息:

这就是为什么,然后我尝试了这个:
<InstallExecuteSequence>
<Custom Action="Foo.TaskKill" Before="InstallValidate" />
</InstallExecuteSequence>
...
<CustomAction Id="Foo.TaskKill" Impersonate="yes" Return="asyncWait" Directory="WinDir" ExeCommand="\System32\taskkill.exe /F /IM Foo.exe /T" />
Run Code Online (Sandbox Code Playgroud)
获得相同结果后,尝试:
<Property Id="QtExecCmdLine" Value='"[WinDir]\System32\taskkill.exe" /F /IM Foo.exe'/>
...
<InstallExecuteSequence>
<Custom Action="MyProcess.TaskKill" Before="InstallValidate" />
</InstallExecuteSequence>
...
<CustomAction Id="MyProcess.TaskKill" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore"/>
Run Code Online (Sandbox Code Playgroud)
我从这里获取的示例:How to Kill …
我有一个Visual Studio插件,它有一个代码编辑器窗口,此窗口中的代码显示为用户着色.我正在使用这个项目http://colorizeoutput.codeplex.com/作为我的基础,在visual studio中创建选项来管理代码编辑器应该显示的颜色:

在代码编辑器中,结果如下所示:

问题是,这些令牌的默认颜色在Dark主题上不能很好地显示:

我发现当视觉工作室主题在这里发生变化时如何跟踪事件,以及如何找出视觉工作室主题在发生时被选择的内容(我也发现了如何确定当前正在运行的Visual Studio的版本,在上一步中打开正确的注册表项)我唯一的问题是如何以编程方式将其中一个选项的值设置为我想要的,例如,如何为XXXX设置"项目前景"颜色关键字代码?
我正在按照此示例为VSTO创建一个excel加载项的自定义右键单击自定义菜单,并在特定条件下显示它(右键单击Excel命名表的范围内).
当我在命名表格范围外单击鼠标右键时,我从示例中修改的代码版本就像一个魅力:

但是当您在命名表范围内右键单击时,它不会显示:

我想它与快速分析功能有关,干扰了我的自定义上下文菜单覆盖.这是我在ThisAddin.cs中使用的代码:
void Application_SheetBeforeRightClick(object worksheet, Excel.Range range, ref bool cancel)
{
GetCellContextMenu().Reset(); // reset the cell context menu back to the default
// If the selected range belongs within a named excel table we display the refresh menu item at the right click context menu.
if (true) //range.IntersectsWithAnyExcelTable()) <-- this code works fine but I commented it out for the purpose of showing the problem (in this case the custom popup meny should appear ALWAYS):
{ …Run Code Online (Sandbox Code Playgroud)