I have project that have to be build with different framework versions including .net 1.1. To build project with .net 1.1 I need to change Project's ToolsVersion to 2.0, but for other frameworks it must be set to 4.0
Is it possible to implement such behavior in Visual Studio?
Something like this in csproj fi开发者_开发百科le:
<Project ToolsVersion=" if $(Configuration) == DOT_NET1_1 THEN '2.0' ELSE '4.0'">
No. The ToolsVersion attribute is set automatically by the version of Visual Studio used to open the project file. The properties that the ToolsVersion controls are reserved and cannot be modified by msbuild. I don't have experience with compiling in .NET 1.1, so I don't know if this is the most elegant solution, but:
In lieu of constantly changing this attribute, the only thing I can think of is to create two different project files, one for compiling in .NET 1.1 and the other for compiling in the other frameworks. They can both reference the same source files, referenced dlls, etc, just be sure not to have them in the same solution, or Visual Studio 2010 will try to upgrade the project file with the older ToolsVersion.
精彩评论