Installing manually

Feb 2, 2011 at 11:54 PM

When I installed the extension from the Visual Studio 2010 Extensions Manager, the installation ran, but I never saw the custom visualizer in the Watch window. So, I tries to install manually by dropping the DLL into C:\Program Files\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\Visualizers

When I next ran the debugger, I got a Visual Studio error that said:

Could not load file or assembly 'file:///C:\Program Files\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\Visualizers\MvcRouteVisualizer.dll' or one of its dependencies. Operation is not supported.

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Program Files\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\Visualizers\MvcRouteVisualizer.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///C:\Program Files\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\Visualizers\MvcRouteVisualizer.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

According to these MSDN articles (http://msdn.microsoft.com/en-us/library/dd409252%28VS.100%29.aspx, http://msdn.microsoft.com/en-us/library/ee890038.aspx), downloaded assemblies are by default blocked from loading into Visual Studio. To allow them, edit Visual Studio's config file and add an element:

Edit devenv.exe (default location: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE ) and add this line inside the <runtime> element:

<loadFromRemoteSources enabled="true" />

Save the file, restart Visual Studio and now the MvcRouteVisualizer should open when you click the magnifying glass icon in the Watch window.

May 11, 2012 at 12:04 AM
Edited May 11, 2012 at 12:06 AM

I also hit the same error you referred to above, however I have to admit you lost me when you talked about editing the deven.exe.  I'm sure it can be done, I've just never done it before.  None-the-less, I thought I'd share these simple steps I read on MSDN.  They worked like a charm and I can now use the visualizer.

To unblock a Web assembly

  1. Close Visual Studio.

  2. Using Windows Explorer, browse to the assembly that you downloaded from the Web.

  3. Right-click the assembly, and from the shortcut menu, select Properties.

    The Properties dialog box opens.

  4. On the General tab, click the Unblock button to indicate that this assembly is trusted

    The Unblock button will not appear if the assembly is already unblocked and available.

  5. Click OK to close the Properties dialog box.

  6. Restart Visual Studio and open your project.

    You should now be able to browse to the assembly in the Choose Items or Add Reference dialog boxes.