Visual Studio 2010迁移问题

时间:2010-10-14 21:28:19

标签: visual-studio-2010

我在Win XP SP3机器上安装了VS 2010并且......

  1. 创建了一个C#Dll项目
  2. 已编译且工作正常
  3. 在项目中添加了一个resx文件,并添加了一些图像
  4. 已编译,现在出现以下错误。
  5.     --------------------------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
    

    然后我试了......

    1. 将以下内容添加到devenv.exe.config,Machine.config
    2. <runtime>
              <NetFx40_LegacySecurityPolicy  enabled="true"/>
      </runtime>
      
      1. 在项目文件中的第一个属性组下添加以下内容。
      2.     <PropertyGroup>
                <GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies>
            </ProjectGroup>
        

        仍然没有运气。我的VS安装有问题吗?我已经修好了一次。

3 个答案:

答案 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>