Using Moles with DLR (dynamic)

As several people have found, Moles does not work well with DLR. Check Cameron’s post for this issue.

In order to make it work do the following:

  1. Go to folder C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\
  2. Backup files Microsoft.Moles.VsHost.exe.Config / Microsoft.Moles.VsHost.x86.exe.Config (depending on your application’s platform)
  3. Modify the starup element and set the useLegacyV2RuntimeActivationPolicy to false in the .config file.
  4. Modify the legacyCasPolicy element and set the enabled to false the .config file.
<?xml version="1.0" encoding="utf-8" ?>
  <startup useLegacyV2RuntimeActivationPolicy="false">
    <supportedRuntime version="v4.0" />
    <supportedRuntime version="v2.0.50727" />
     <legacyCasPolicy enabled="false" />

I haven’t done further testing on changing the use of legacy CAS Policy when using Moles & VS Test Framework.

Let me know how it works for you.

1 Comment

Comments have been disabled for this content.