Legacy Security Policy in Visual Studio 2010 and C

2019-04-09 10:19发布

问题:

I have a project using DevExpress 8.3 (2008.3) which I just recently upgraded to use VS 2010. After doing so, everything compiled fine but I got errors trying to use the designer. I resolved this as described here: NetFx40_LegacySecurityPolicy in design-time mode

by adding <NetFx40_LegacySecurityPolicy enabled="true"/> to my devenv.exe.config.

Designer works fine now, but some of the projects in the solution which have COM references no longer compile, with the exception:

The "ResolveComReference" task could not be instantiated from "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag.

The COM references for those projects are also flagged with a yellow exclamation mark.

The only google result I found for this error was here: http://social.msdn.microsoft.com/Forums/en/vsx/thread/197b8dca-5610-4ac5-86fc-c56d5182e46b

which describes the exact same problem but with no resolution. I tried adding

<GenerateResourceNeverLockTypeAssemblies>true<GenerateResourceNeverLockTypeAssemblies>

as the post suggests but that doesn't have any effect for me.

Anyone know anything about this?

Thanks.

回答1:

I logged into my DX account and found (to my surprise) that DX was offering me an upgrade to a new hotfix version of the same 2008.3 release (even though my subscription is expired). This fixed the problem (and allowed me not to have to use Legacy Security Policy at all).