Building Web Applications

Topics: For MSBee Users
Feb 2, 2007 at 2:58 PM
Converted a C# solution to VS2005 sp1, and successfully built it using MSBuild/MSBee and configured to run in VS2005 as and external tool. It was all very easy :)

I reconfigured the output directory to be ~/bin using the command line switch (/p:BaseFX1_1OutputPath=bin). Only problem I had was with a web application in the solution, where the build kept putting the output in the ~/bin/debug directory, instead of the ~/bin directory which is the norm for Web Applications.

This is because the MSBee common build file (MSBuildExtras.Fx1_1.Common.targets) doesn't seem to distinguish between web application projects and other projects so appends $(Configuration) on the end of the outputPath.

In the end I fixed by putting the following at the very end of the .csproj for the web application, just before the closing </project> tag.

<project ...
<OutputPath Condition=" !HasTrailingSlash('$(OutputPath)') ">$(OutputPath)\</OutputPath>

Has anyone else come accross this and/or know of a more elagant way of solving it?
Oct 3, 2007 at 7:37 PM
Is there such a thing as a .csproj for the web application? My VS2005 doesn't create one.
Oct 5, 2007 at 7:08 PM
VS2005 did not have a web application project when it was introduced. Later the "Web Application Project" was introduced as a seperate add-on, and not with Service Pack 1 for VS 2005 it is included.

Oct 8, 2007 at 8:42 PM
Ish, thanks so much for your help on this. It's just what I needed.

Mark "catfood" from Cleveland, Ohio USA
Oct 11, 2007 at 4:05 PM
So here I am with the following results from running my build with diagnostics. It looks as though I am getting the C# compiler from .NET 2.0 as well as the runtime assemblies from .NET 2.0. See below for an excerpt from my .csproj file. Same result if I switch MSBee and "standard" CSharp.targets references.

I imagine I need to be using the C# compiler and runtime assemblies from .NET 1.1. Do you know what's going on?

Target "CoreCompile" in file "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.CSharp.targets":
Building target "CoreCompile" completely.
Output file "obj\Debug\TissService.dll" does not exist.
Using "Csc" task from assembly "Microsoft.Build.Tasks, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Csc"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /unsafe- /checked- /nowarn:1701,1702 /nostdlib- /errorreport:prompt
/warn:4 /baseaddress:285212672 /define:DEBUG;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\assembly\GAC\Microsoft.Vbe.Interop\\Microsoft.Vbe.Interop.dll /debug+ /debug:full /filealign:4096
/optimize- /out:obj\Debug\TissService.dll /resource:obj\Debug\TissService.Global.resources /resource:obj\Debug\TissService.Tiss.resources /target:library
/warnaserror- AssemblyInfo.cs Global.asax.cs Tiss.asmx.cs
The "Csc" task is using "Csc.exe" from "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe".
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

Done executing task "Csc".

From the .csjproj file:

<EmbeddedResource Include="Tiss.asmx.resx">
<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX1_1.CSharp.targets" Condition=" '$(BuildingInsideVisualStudio)' == '' AND
'$(TargetFX11)'=='true'" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Dec 2, 2008 at 12:27 PM
Mark - you need to rearrange the order between the import-tags. MSBUILD chooses the LAST assigned property when building, so you need to put the MSBEE-import AFTER the regular <import>-tag.
All according to the MSBEE-documentation :)

You have:
<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX1_1.CSharp.targets" Condition=" '$(BuildingInsideVisualStudio)' == '' AND
'$(TargetFX11)'=='true'" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

You need:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX1_1.CSharp.targets" Condition=" '$(BuildingInsideVisualStudio)' == '' AND
'$(TargetFX11)'=='true'" />

(As a start, I would remove the import-conditions for the MSBEE-improt tag. If you get it working, you can put back the condition later. By doing this you make an easier  start..)