简体   繁体   中英

Update project target .NET framework

I have a solution, different projects, all of them with Target .NET Framework 3.5. If update one of the projects to target .NET Framework 4 so i can use PLINQ, would it cause problems in any aspect ?

If yes, how may i avoid them please and what should i be aware of ?

Thanks in advance.

Yes you can have different configurations for different projects in the same solution

Solution just makes it easy to have all your related projects together in Visual Studio.

.NET Framework 4 uses a different Runtime, so it might indeed cause problems. 3.5 uses the Runtime version 2, and to be able to use assemblies compiled for the 2.0 Runtime, you'll have to edit the app.config of your main executable (which would have to be 4.0) and add this to the configuration tag (or edit it if the element already exists):

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>

4.0 -> 2.0 references should work that way, but probably not the other way around.

The best solution IMO though would be to upgrade them all to 4.0 if possible. And of course users would need the .NET Framework 4.

References between the projects could become a problem, I'd recommend upgrading all of them if that's possible to remain consistent. See this similar question as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM