.NET 4.0/4.5 targeting

Topics: Setup
Jan 13, 2014 at 11:44 PM
Current codebase targets .NET Framework 2.0. Are you planning to add 4.0/4.5 specific builds? Or should we just get the source and build it ourselves?
Jan 14, 2014 at 3:49 PM
I have not planned on it, but am open to it. Are you aware of a simple way to create different builds of the same code base against different .NET versions?
Jan 19, 2014 at 1:34 AM
Yes, there is a simple way. Create a copy of the project file, change TargetFrameworkVersion, add new project to a solution and create new build configurations.
Jan 19, 2014 at 7:43 PM
Edited Jan 19, 2014 at 7:44 PM
Thanks. I have updated the solution with new projects for both the base library and the editor library targeting the .NET 4 runtime. I believe the .NET 4.5 and 4.51 libraries use the same base libraries as 4.0 so I shouldn't need to create separate builds for those as well. Is that your understanding? If not, then I will likely find another way to do this using MSBuild as having a separate project for every framework iteration seems very inefficient.
Marked as answer by dahall on 9/1/2015 at 10:12 AM
Jan 31, 2014 at 8:20 PM
In my experience, it's often unnecessary to create multiple project files to perform multi-targeting. Instead, we let MSBuild do the work for us.
msbuild MySolution.sln /ToolsVersion:2.0 /t:Rebuild /p:Configuration=Release
msbuild MySolution.sln /ToolsVersion:3.5 /t:Rebuild /p:Configuration=Release
msbuild MySolution.sln /ToolsVersion:4.0 /t:Rebuild /p:Configuration=Release
msbuild MySolution.sln /ToolsVersion:12.0 /t:Rebuild /p:Configuration=Release
The "12.0" isn't a typo. MSBuild used to be part of the .NET Framework. It now ships with Visual Studio. In VS2013, it's called MSBuild 12.0.
Marked as answer by dahall on 9/1/2015 at 10:12 AM