6

I get stung on a recurring basis by this, and of course always at the worst moment. When I edit a xaml file, I receive this error

(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.)

I added the recommended elements in devenv.exe.config

<configuration>
  <runtime>
    <loadFromRemoteSources enabled="true" />
  </runtime>
</configuration>

which is supposed to get rid of that, but does not work for me. Should I add this elsewhere ? How does the system knows in the first place that this was downloaded from the internet ? How can I get rid of that warning ?

nicolas
  • 9,549
  • 3
  • 39
  • 83

3 Answers3

7

I added the XML to other config files as well (XDesProc.exe.config and XDesProc.exe.appx.config) and it solved the problem for me:

  1. Go to C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE

  2. Open the files XDesProc.exe.config, devenv.exe.config, and XDesProc.exe.appx.config using a text editor (likely requires administrator mode)

  3. Find </runtime> and before it, add <loadFromRemoteSources enabled="true"/> (If you copy/paste, make sure the doublequotes come through as ASCII or VS will have a fit)

(Source: http://www.sehajpal.com/index.php/2010/10/how-to-solve-loadfromremotesources-error-in-vs-2010/)

(Similar question: WPF designer fails to load in VS 11 beta)

Community
  • 1
  • 1
Jared Thirsk
  • 1,237
  • 17
  • 17
3

This might be what I've run into on occasion when you paste in files from an unsafe source (the internet). Whatever resources you're loading might be blocked. In Windows Explorer, select Properties from the context menu of these assemblies or files. At the bottom of this dialog, click the button Unblock if available. It should work then.

erodewald
  • 1,815
  • 20
  • 45
0

I was able to solve this using these steps:

  1. Goto this path in your windows explorer : C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE
  2. Open the devenv.exe.config file in notepad or any editor of your choice.
  3. Search for this element closing tag in the file:
  4. Before this element closing tag, Copy and paste the below configuration switch
  5. Save and close the config file

These steps are taken from here: http://www.sehajpal.com/index.php/2010/10/how-to-solve-loadfromremotesources-error-in-vs-2010/

digitguy
  • 1,014
  • 2
  • 12
  • 29