views:

89

answers:

3

Hi, I have a VS 2008 project. This project's target framework 3.5. Everything is Ok in this situation.

I migrated this project to VS 2010 and I also changed target framework to .Net 4.0. Then I tried to build the project. But I got an error which says me to about to use "NetFx40_LegacySecurityPolicy" switch. So I used that switch and errors related to this switch got away. But this time I encountered a different error which says "The "GenerateResource" task failed unexpectedly. System.InvalidOperationException: The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag.....". I searched this on web but I could not find a solution. Does anybody experiences this problem. Thanks for your help?

A: 

Hi,

I've the same problem.

Did you found a solution for this problem?

Thank you,

Pascal

Pascal
Stack Overflow is a Question and Answer site, not a discussion forum. I know as a new user you can't do much, but if you're having the same problem bookmark this question (with the star below the voting arrows) and you'll be notified of any new answers. Stick around to answer questions and ask your own (different) questions and you'll soon have enough rep to post comments.
ChrisF
A: 

I am also having the exact same problem. I had no idea upgrading from VS 2008, .Net 3.5 to Vs 201, .Net 4.0 would be so difficult. I thought I was past the hard part when we upgraded from VS 2005 & .Net 2.0.

Greg
A: 

On your build server locate msbuild.exe.config in C:\Windows\Microsoft.NET\Framework\v4.0.30319 (you'll also have to change the x64 version if you're on a 64-bit box).

Add the following to the bottom of the config (in the section)

<NetFx40_LegacySecurityPolicy enabled="true"/>

In other words the end of your config should look like:

        </assemblyBinding>
    <NetFx40_LegacySecurityPolicy enabled="true"/>
    </runtime>
    <!-- To define one or more new toolsets, add an 'msbuildToolsets' element in this file. -->
</configuration>
Richard Banks