Visual Studio Macros stopped working [duplicate]

2019-08-04 12:38发布

问题:

This question already has an answer here:

  • Macros don't run in Visual Studio 2010 1 answer

My Visual Studio Macros stopped working, with no errors displayed or logged I could find.

(I did think it was something I did to my machine.)

回答1:

Microsoft released a Windows Update that fixed a security issue (MS14-009) that broke Visual Studio Macros.

The workaround, described in KB2934830, is to add

<?xml version="1.0"?>
<configuration>
 <runtime>
  <AllowDComReflection enabled="1"/>
 </runtime>
</configuration>

to your Visual Studio Macros Server .exe.config.

Depending upon your Visual Studio version and Windows bitness, the file is:

64-bit Windows:
\Program Files (x86)\Common Files\Microsoft Shared\VSA\

32-bit Windows:
\Program Files\Common Files\Microsoft Shared\VSA\

VS2k5 (SP1):
8.0\VsaEnv\Vsmsvr.exe.config

VS2k8:
9.0\VsaEnv\Vsmsvr.exe.config

VS2010:
9.0\VsaEnv\Vsmsvr10.exe.config

You'll need to edit the file as an administrator (or otherwise adjust permissions), and it ought to already contain the <configuration><runtime> section.

(Although I gleaned the above from the KB article, my Google searching found this via this.)