For safekeeping:
How to target the 1.1 framework with a VS2k5 project
1. download msbee http://www.codeplex.com/MSBee
2. unzip and run MSBeeSetup.msi
3. import MSBee targets file, this can be done in one of two ways
3.1 Add the MSBee targets file directly to each project.
To import an MSBee .targets file in a VS project file, find the import element for the MSBuild .targets file.
For a C# project, the line you are looking for is shown below.
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Immediately under this line, insert an import of a MSBee language-specific .targets file.
For a C# project, you will want to insert the line below.
<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX1_1.CSharp.targets" Condition=" '$(BuildingInsideVisualStudio)' == '' AND '$(TargetFX1_1)'=='true'" />
3.2 Specify the target with the Custom Targets property of msbuild. This allows you to avoid having to import the MSBee .targets file in each project.
For example in a C# only solution the property would be:
/p:CustomAfterMicrosoftCommonTargets=%ProgramFiles%\MSBuild\MSBee\MSBuildExtras.Fx1_1.CSharp.targets
4. Build the project with the TargetFX1_1 property set to true. The output will be in the [project]\bin\FX1_1 directory.
4.1 If added to the project:
msbuild [project file] /t:Rebuild /p:TargetFX1_1=true
4.2 If using the msbuild property:
msbuild [project file] /p:TargetFX1_1=true /p:CustomAfterMicrosoftCommonTargets=%ProgramFiles%\MSBuild\MSBee\MSBuildExtras.Fx1_1.CSharp.targets
To verify that the project was successfully build against .net 1.1 look at the generated build log.
The CorCompile task will use the 1.1 compiler as shown below:
Target CoreCompile:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Csc.exe ...
To verify a MSBee built project will run with .net 1.1, use Ildasm to view the manifest which shows the version of mcorlib being used by the application:
// Metadata version: v1.1.4322
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
.ver 1:0:5000:0
}
To build a release version use the msbuild propery Configuration, i.e. /p:Configuration=Release
See the MSBee docs for more options and for building mixed language solutions.
Labels: Development