Error building Visual Studio 2010 Silverlight 4 projects on Windows 7 with XP Mode

末鹿安然 提交于 2019-12-06 04:14:26

Have you added <loadFromRemoteSources enabled="true"/> in your configuration file?

Enabling loadFromRemoteSources is also explained on http://social.msdn.microsoft.com/Forums/en-US/webdevelopmentprerelease/thread/ea9b9cab-cbfd-496d-8a81-7b3dd06e8c23 along with another option; set the environment variable COMPLUS_EnableLegacyCASPolicy.

Edit: (copy and paste from the above URL as the post got taken down)

David DeWinter - MSFT (Wednesday, May 20, 2009 2:10 AM)

Caveat: I'm not on the security team but will attempt to answer this nonetheless...

What's happening here is that the build tasks for Silverlight are attempting to load an assembly that, in previous versions of the CLR, would classify it as a partial trust assembly based on its evidence (e.g. its zone) according to CAS policy.

In CLR 4.0, CAS policy is totally deprecated and is not even enabled by default. Under the circumstances, though, it appears the CLR throws an Exception when what would be a partial trust load in CLR 2.0 is a full trust load in CLR 4.0.

The loadFromRemoteSources switch the Exception message refers to is in the runtime element under configuration and looks like this:

<runtime>
  <loadFromRemoteSources enabled="true|false" />
</runtime>

This will not enable legacy CAS policy but will allow you (or, in this case, the build system) to load remote assemblies with the same permissions as the host AppDomain. In this case it seems as though you could modify the configuration for the build system (which I assume in this case would be Visual Studio: %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config) to enable this switch.

If you don't want to modify that configuration then you can set the environment variable COMPLUS_EnableLegacyCASPolicy to 1, which will enable CAS Policy that was present in CLR 2.0 and also allow Silverlight to load this task.

Hope that helps. David, Blog - http://blogs.rev-net.com/ddewinter/ Twitter - @ddewinter

It should work if you add <loadFromRemoteSources enabled="true"/> to devenv.exe.config. More info at http://msdn.microsoft.com/en-us/library/dd409252%28VS.100%29.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!