我在Win XP SP3机器上安装了VS 2010并且......
--------------------------Compile Error----------------------------- The "GenerateResource" task failed unexpectedly. System.InvalidOperationException: The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag. at System.AppDomain.SetupDomainSecurity(AppDomainHandle appDomain, ObjectHandleOnStack appDomainEvidence, IntPtr creatorsSecurityDescriptor, Boolean publishAppDomain) at System.AppDomain.InitializeDomainSecurity(Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, Boolean generateDefaultEvidence, IntPtr parentSecurityDescriptor, Boolean publishAppDomain) at System.AppDomain.Setup(Object arg) at System.AppDomain.nCreateDomain(String friendlyName, AppDomainSetup setup, Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, IntPtr parentSecurityDescriptor) at System.AppDomainManager.CreateDomainHelper(String friendlyName, Evidence securityInfo, AppDomainSetup appDomainInfo) at System.AppDomainManager.CreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup appDomainInfo) at System.AppDomain.InternalCreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup info) at System.AppDomain.CreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup info) at Microsoft.Build.Tasks.GenerateResource.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) TestClassLibrary
然后我试了......
<runtime> <NetFx40_LegacySecurityPolicy enabled="true"/> </runtime>
<PropertyGroup> <GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies> </ProjectGroup>
仍然没有运气。我的VS安装有问题吗?我已经修好了一次。
答案 0 :(得分:2)
app.config设置:
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
<legacyCasPolicy enabled="true"/>
</runtime>
为我工作
江东
答案 1 :(得分:1)
我遇到了同样的问题,只是修复Visual Studio 2010并没有解决问题。
但是,在我完全删除Visual Studio并重新安装后,问题就消失了。值得一试:))
答案 2 :(得分:0)
转到Visual Studio安装文件夹
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
并在“devenv.exe.config”文件中输入以下内容。
<runtime><NetFx40_LegacySecurityPolicy enabled="false"/></runtime>