I had spent last few days on getting the project build scripts written using MSBuild script (http://msdn.microsoft.com/en-us/library/dd393573.aspx) + MSBuild tasks from MSBuild Community Tasks project (http://msbuildtasks.tigris.org/) on non development environments which does not have Visual Studio 2008, SQL Server 2008 and I faced tough time to make them work. I thought of sharing here my exploration though the attempt is not fully successful in resolving the issues. I have following information to share from the process of resolving the issues …

Source code (web deployment files) resides in VSS and MSBuild Community Tasks provides tasks to do operations on VSS like VssGet, VssCheckout, VssCheckin, VssUndoCheckout, VssLabel, VssAdd, Version .. etc.

Development environments will have all the required software to run the Build Scripts except MSBuild Community Tasks.

QA or any other environments usally will not have development software so we need to install light weight versions of these softwares like .NET Framework, Software SDKs which will give SDK Tools and related dlls.

I tried different options and got into many issues related to 32-bit/64-bit software installations, GAC installated software … etc

  • Don’t use assemblies installed in GAC when you are shipping them as a bundle. Good thing is have those assemblies referred from some folder within the bundle or have build steps to register those assemblies to GAC.
  • Ensure you are using either 32-bit or 64-bit softwares whereever it is required. For example I am using VSS which is 32-bit and I installed .NET Framework 2.0 SDK for 64 bit as my machine is 64-bit and when I run my build script I endeded up getting following error
    • Retrieving the COM class factory for component with CLSID {783CD4E4-9D54-11CF-B8EE-00608CC9A71F} failed due to the following error:  80040154
  • Installing both 32-bit/64-bit MSBuild Extension Pack in the machine at the same time will make build script variables (MSBuildExtensionsPath) by default refer the 64-bit installation path (C:\Program Files\MSBuild) instead of 32-bit (C:\Program Files (x86)\MSBuild). This will create problem in case  if your build script expects them for 32-bit installation path. To avoid this situation you need to set system environment variable explicitly otherwise you will face following issue
    • Error MSB4036: The “VssGet” task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is “public” and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the “C:\Windows\Microsoft.NET\Framework64\v2.0.50727” directory.

Some of the links that I used for my exploration …

I tried installing Visual Studio 2005/2008 SDKs to get various .NET Framework Tools (http://msdn.microsoft.com/en-us/library/d9kh6s92.aspx) mainly related to Build and deployment (Visual Studio command prompt which can recognize MSBuild command which is used part of the build scripts) so that I can use minimal installation on non development environments.

For pushing DB objects between source and destination databases using console exe (C# code, exe intern used in a batch file) and following SQL Server Management Objects are needed.

  • Microsoft.SqlServer.Smo.dll (Database, Server classes)
  • Microsoft.SqlServer.SmoExtended.dll (Transfer class)
  • Microsoft.SqlServer.SqlEnum.dll (CompatibilityLevel Enum)
  • Microsoft.SqlServer.Management.Sdk.Sfc.dll (used by Smo.dll)
  • Microsoft.SqlServer.ConnectionInfo.dll (SqlConnectionInfo, ServerConnection classes)

Management objects will by default come with SQL Server 2008 full installation or using Microsoft SQL Server 2008 Feature Pack. Feature Pack is a collection of stand-alone install packages that provide additional value for SQL Server 2008. Different feature packs can be installed using below link, for Ex: Microsoft SQL Server 2008 Management Objects alone …

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=8824

Some DB objects which are maintained in VSS are taken to the local file system and based on file modified time stamp we had run on target database directly using MSBuild Extension Pack. MSBuild Extension Pack provides a collection of over 400 MSBuild tasks which can operate on …

  • System Items: Active Directory, Certificates, COM+, Console, Date and Time, Drives, Environment Variables, Event Logs, Files and Folders, FTP, GAC, Network, Performance Counters, Registry, Services, Sound
  • Code: Assemblies, AsyncExec, CAB Files, Code Signing, DynamicExecute, File Detokenisation, GUID’s, Mathematics, Strings, Threads, Xml, Zip Files
  • Applications: BizTalk 2006 / 2010, Email, IIS6, IIS7, MSBuild, SourceSafe, SQL Server 2005, SQL Server 2008, StyleCop, Twitter, Team Foundation Server, Visual Basic 6, Windows Virtual PC, WMI

Get MSBuild Extension Pack from http://msbuildextensionpack.codeplex.com/

Btw … MSBuild Extension Pack and MSBuild Community Tasks are two different collections of MSBuild tasks. You can install both of them and choose to use whichever suits your needs.

Latest version of MSBuild Extension Pack 3.5.9.0 and MSBuild Extension Pack 4.0.3.0 supports .NET 3.5 and 4.0. The older version SDC Task Library (http://sdctasks.codeplex.com/) is meant for .NET 2.0 which has around 300 build tasks and there is no active support for this version now.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s