Using MSBee with New Projects

Topics: For MSBee Users
Aug 16, 2006 at 11:44 PM
migrated from power toy forums
originally posted by Zurgy
------------------------------------------------------

I can get MSBee to work perfectly with VS2003 projects that have been upgraded by VS2005.

If I write an MSBuild file from scratch how do I incorporate MSBee support? My example is below but when MSBee is invoked it still gets linked against the 2.0 framework.

Thanks,

Ben Lamb.

<Project DefaultTargets="Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX11.CSharp.targets" Condition=" '$(BuildingInsideVisualStudio)' == '' AND '$(TargetFX11)'=='true'" />
<PropertyGroup>
<appname>HelloWorldCS</appname>
</PropertyGroup>
<ItemGroup>
<CSFile Include="consolehwcs1.cs"/>
</ItemGroup>

<Target Name="Compile">
<Message Text="Foo: $(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX1_1.CSharp.targets"/>
<Message Text="Wibble: $(TargetFX1_1)"/>
<Message Text="Wobble: $(BuildingInsideVisualStudio)"/>
<CSC Sources="@(CSFile)" OutputAssembly="$(appname).exe">
<Output TaskParameter = "OutputAssembly" ItemName = "EXEFile" />
</CSC>
<Message Text="The output file is @(EXEFile)"/>
</Target>
</Project>
Aug 16, 2006 at 11:44 PM
originally posted by John DAddamio - MSFT
------------------------------------------------------

Hi Zurgy,

I think you mean that you wrote a .csproj file from scratch? If so, you can try adding the

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

statement before the one for MSBuildExtras.FX1_1.CSharp.targets

However, MSBee wasn't intended to be used this way so you may not succeed. Offhand, I don't see any reason why one can't do this assuming that you followed all the rules (e.g. no partial classes). But, since we didn't intend it to work this way, we can't offer much support if you try it.

Good luck!

John D'Addamio
Aug 16, 2006 at 11:44 PM
originally posted by Zurgy
------------------------------------------------------

Thanks. I should have mentioned I'd tried this. I end up with a 2.0 file.

Cheers for your assistance. The team I'm doing this for was already using msbuild for their .Net 2.0 projects but is having to use some of my code that only runs in the .Net 1.1 world* hence the need for MSBee. Because this code only runs .Net 1.1 at the moment we're going to use Visual Studio 2003 and not upgrade the projects. I needed a build tool, I'll guess they'll have to use Nant.

(* yes of course we want to move everything onto .Net 2.0 but large organisation, takes time, 3rd party dependencies, testing to be done etc.)

Best regards,

Ben.

msbuild /p:TargetFX1_1=true test.targets
Microsoft (R) Build Engine Version 2.0.50727.42
Microsoft .NET Framework, Version 2.0.50727.42
Copyright (C) Microsoft Corporation 2005. All rights reserved.

Build started 01/08/2006 17:19:29.
__________________________________________________
Project "C:\test\test.targets" (default targets):

Target Compile:
Foo: C:\Program Files\MSBuild\MSBee\MSBuildExtras.FX1_1.CSharp.targets
Wibble: true
Wobble:
C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Csc.exe /out:HelloWorldCS.exe co
nsolehwcs1.cs
The output file is HelloWorldCS.exe

Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:00.29