Jon Skeet said:
But presumably that should stop it from compiling C# 3 code, which is
what I meant - sorry.
Mmm... doesn't seem to be doing anything on my machine
Unless that's interacting with the difference between MSBuildToolsPath
and MSBuildBinPath...
Jon,
Here's the output of a rebuild of a VS2008 solution containing two projects:
1. is a VS2008 project (wftaT1) targeting V3.5
2. is a VS2005 project (volsvs) added to the VS2008 solution.
In project 2, I changed ToolsVersion= "3.5" into "2.0", so now the first
line of .csproj looks like this:
<Project DefaultTargets="Build"
xmlns="
http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="2.0">
------ Rebuild All started: Project: wfaT1, Configuration: Debug x86 ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702
/platform:x86 /errorreport
rompt /define
EBUG;TRACE /reference:"C:\Program
Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll"
/reference:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll"
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll
/reference:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full
/filealign:512 /out
bj\x86\Debug\wfaT1.exe
/resource
bj\x86\Debug\wfaT1.Form1.resources
/resource
bj\x86\Debug\wfaT1.Properties.Resources.resources /target:winexe
/win32manifest:app.manifest Form1.cs Form1.Designer.cs Program.cs
Properties\AssemblyInfo.cs Properties\Resources.Designer.cs
Properties\Settings.Designer.cs
Compile complete -- 0 errors, 0 warnings
wfaT1 -> E:\Develop\VS2008Proj\wfaT1\wfaT1\bin\x86\Debug\wfaT1.exe
------ Rebuild All started: Project: volsvs, Configuration: Debug Any
CPU ------
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig
/nowarn:1701,1702 /platform:x86 /errorreport
rompt /warn:4
/define
EBUG;TRACE
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll
/debug+ /debug:full /optimize- /out
bj\Debug\volsvs.exe /target:exe
Program.cs Properties\AssemblyInfo.cs
Compile complete -- 0 errors, 0 warnings
volsvs -> E:\Develop\vs2005proj\volsvs\volsvs\bin\Debug\volsvs.exe
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========
See, the project (1) is build using csc.exe V3.5 (C# 3), while for (2),
csc.exe is V2.
The great thing here is that you can mix project versions, you can change
project settings from within the VS2008 IDE, the "ToolsVersion" will not be
touched.
Things to keep in mind when setting the ToolsVersion="2.0", are:
- the project file does not become a true VS2008 project file, it remains an
imported project file, and
- CSC V2 does/can not add a manifest to the resulting exe (for exe targets),
this is a problem when targeting Vista and W2K8. You should never run
manifest-less applications on Vista and up, so, here you'll have to add a
manifest by running mt.exe after each build.
Willy.