26 abril 2006

Building Webparts for Sharepoint 2003 with Visual Studio 2005

Yes, it is possible!

Actually jou just have to enable Visual Studio 2005 to generate .NET 1.1 applications. There is a Microsoft-Community add-in for MSBuild that enables this: MSBuild Extras - Toolkit for .NET 1.1 "MSBee". You can download it from http://msdn.microsoft.com/vstudio/downloads/tools/msbee/default.aspx (you will get a MSI file).

Once you have installed it, this 2 steps will be enough to compile webparts for Sharepoint 2003:

[1] Open you project file with a text editor (notepad for example), and do the following (in the MSBee help file you will find the same but with a VB project):

To import an MSBee .targets file in a C# 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 the MSBee language-specific target 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'" />

[2] Open the Visual Studio Command and compile with MSBuild: msbuild [project file] /t:Rebuild /p:TargetFX1_1=true. This generates the binaries under bin\FX1_1\Debug (see the picture).

Maybe you will find usefull to build the solution until no errors are found and afterwards call a script that calls to MSBuild and copies the binaries to the IIS Virtual Directory (usually located at server\\c\inetpub\wwwroot\bin).

I haven't found the way to build the solution inside Visual Studio, yet. I guess it is not that easy (from the help file: "At this time, we are not planning to add IDE support."). Comments are welcome if you know how!

04 abril 2006

Blogging again

Today I start this blog... for the first time I'm going to blog about technology (guess... my profession!).