Wednesday, October 14, 2009

Unit testing SharePoint WSS 3.0 x64 bit

Problem
trying to MS unit test code on x64 bit OS with x64 bit WSS 3.0 installed

[TestMethod]
public void TestMethod1()
{
using (SPSite sp = new SPSite("http://localhost:13000/"))
{
Console.WriteLine(
"Site valid");
}
}

Error Message
Test method TestProject1.UnitTest1.TestMethod1 threw exception:

System.IO.FileNotFoundException: The Web application at http://localhost:13000/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add
a new request URL mapping to the intended application..

Solution
http://community.bamboosolutions.com/forums/t/8179.aspx
download nunit (only 32 bit). Nunit will automatically choose which JIT compiler to use to test the code.

Additional Stuff
Code modification to have both nunit and MS test running together
http://www.martinwilley.com/net/code/nunitmstest.html

#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Category = Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute;
#else
using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using TestContext = System.Object;
#endif

Sunday, August 9, 2009

Silent Install

download here

As a contractor and also some of colleges, end up building a lot of virtual environments. So after installing Biztalk 2009 for the nth time. I decided to automate the Biztalk 2009 installation (and also Biztalk 2006 r2 and ESB 2.0 Toolkit). I started looking at some products that where available on line but nothing met my needs. The requirements that I was looking for:

autologin – some packages that are installed require reboot prior to continuing i.e. sql2008
config – all data to be stored in a config file and easily customizable.
non msi – not have to install it on a clean machine.

So I build Silent Install. Its still a work in progress but its stable enough to get the job done.

Benifits
· Same dev installation across all environments.
· No missing components.
· Reproducible production installs

image

Currently there are 4 options available:
· Install Biztalk 2006 R2 Dev on win 2003
· Install Biztalk 2009 Dev on win 2008
· Install Biztalk 2009 ESB Tool Kit 2.0
· Create Custom Install

As seen below
image

Some installations require a reboot, so your credentials are required for auto login.image

How things work

I create a vhd (Virtual Hard Disk) with all install files copied onto it (size is ~14GB I would like to put it on the net but due to the size and legal issues that will never happen).

image

The way it works is that you figure how to silently install each application by itself, create a batch and sometimes additional ini/xml data files as well. Once you have created each batch file you need to determine in which order to run them.

image

This is then stored in the app.config of Silent Install.
<Environment name="Biztalk2006 R2" Description="Install Biztalk 2006 R2 Dev on win 2003">
  <applications>
    <application order="1" value="IIS6" />
    <application order="2" value="SQL2005" />
    <application order="3" value="Visual2005" />
    <application order="4" value="Visual2005Sp1" />
    <application order="5" value="SQL2005Sp3" />
    <application order="6" value="Reboot" />
    <application order="7" value="Wss3Sp1" />
    <application order="8" value="Biztalk2006R2" />
  </applications>
</Environment>
<Environment name="Biztalk2009" Description="Install Biztalk 2009 Dev on win 2008">
  <applications>
    <application order="1" value="Powershell" />
    <application order="2" value="Reboot" />
    <application order="3" value="PowershellUnrestricted" />
    <application order="4" value="IIS7" />
    <application order="5" value="Office2007" />
    <application order="6" value="Visual2008" />
    <application order="7" value="Visual2008TeamExplorer" />
    <application order="8" value="Visual2008Sp1" />
    <application order="9" value="SQL2008" />
    <application order="10" value="Reboot" />
    <application order="11" value="SQL2008" />
    <application order="12" value="Biztalk2009Prerequisites" />
    <application order="13" value="Wss3Sp1" />
    <application order="14" value="Biztalk2009" />
  </applications>
</Environment>
<Environment name="Biztalk2009ESBToolKit20" Description="Install Biztalk 2009 ESB Tool Kit 2.0">
  <applications>
    <application order="1" value="Biztalk2009ESBToolKit20" />
  </applications>
</Environment>

Installing/Progress Screen
Once the install button is clicked you will be directed to the progress tab and installation will start. image

Running and things to do after install
Assumptions
Clean install of the OS and has been fully patch/updated.

Install Biztalk 2006 R2 Dev on win 2003
   · prompted at start asking location of i386 dir (not sure where the registry setting for that is)
After install 
· Configure Windows SharePoint Services (need to read and understand http://www.mindsharpblogs.com/ben/archive/2008/03/08/4411.aspx
· Disable the Shared Memory Protocol (not sure where the registry setting for that is) 
· Configure BizTalk Server

Install Biztalk 2009 Dev on win 2008
After install
· Configure Windows SharePoint Services
· Disable the Shared Memory Protocol
· Configure BizTalk Server

Install Biztalk 2009 ESB Tool Kit 2.0
· Guide on how to install ESB 2.0 toolkit

Future enhancements
· check if a program has already been installed.
· mount ISO

Tuesday, August 4, 2009

Installing Adapter Pack

WCF LOB Adapter SDK SP2

System Requirements

Supported Operating Systems: Windows Server 2003 R2 Enterprise Edition (32-Bit x86); Windows Server 2003 R2 Standard Edition (32-bit x86); Windows Server 2003 Service Pack 2; Windows Server 2008
Supported Platforms: x86 and x64
Prerequisite Software Requirement
You must install this software prior to installing the WCF LOB Adapter SDK.
a. Microsoft .NET Framework 3.5 SP1
b. Microsoft Visual Studio 2005 or Microsoft Visual Studio 2008

Note: You require this only if you want to either build custom adapters or develop solutions that use the adapters built using the WCF LOB Adapter SDK.

c. Microsoft BizTalk Server 2006 R2 or Microsoft BizTalk Server 2009

Note: You require this only if you want to use the adapters with BizTalk.

Start Installation

1. Download the setup files from the Microsoft Download Center at http://go.microsoft.com/fwlink/?LinkID=96184 to a temporary location on your computer.

clip_image001
2. Run WCF LOB Adapter SDK SP2 x86. exe
3. Set extract location and select Unzip.

4. To start the installation wizard, navigate to the folder containing the setup files and click AdapterFramework.msi (for an x86-based platform) or AdapterFramework64.msi (for an x64-based platform).
If a previous version of the WCF LOB Adapter SDK is detected, you will be prompted to upgrade the existing installation. To continue with an upgrade installation, click Ok; otherwise, click Cancel to exit the installation.

clip_image002
5. On the Welcome screen, click Next.

clip_image003
6. If you accept the license agreement, click Next.

clip_image004
7. In the Choose Setup Type dialog box, select the type of installation you want:

  • To install the run time and tools, click Typical.
  • To select the features that you want to install and the installation location, select Custom.

To install the base WCF LOB Adapter SDK run-time features, select Runtime.

To install the WCF LOB Adapter SDK development tools including the Adapter Development Wizard, Visual Studio Plug-in for generating a .NET Proxy (Add Adapter Service Reference Visual Studio Plug-in) and BizTalk Add-in for generating XML Schemas in a BizTalk Project (Consume Adapter Service BizTalk Project Add-in), select Tools.

To install the sample Contoso and Echo adapters, select Samples.

  • To install all the features, click Complete.

clip_image005
8. Click Install.

clip_image006
9. Specify whether you want to receive automatic updates related to the WCF LOB Adapter SDK; select Use Microsoft Update when I check for updates (recommended), click OK

clip_image007

Installing Microsoft BizTalk Adapter Pack 2_0

1. Download the setup files from the Microsoft Download Center at http://www.microsoft.com/downloads/details.aspx?FamilyID=76736BA7-3C05-4436-9353-1C33F9005194&displaylang=en to a temporary location on your computer.

clip_image008
2. Run Microsoft BizTalk Adapter Pack 2_0 Evaluation x86.exe
3. Set extract location and select Unzip. From the root location of the installation CD, double-click AdaptersSetup.msi (for an x86-based platform) or AdaptersSetup64.msi (for an x64-based platform).

clip_image009
4. Read the information on the Welcome screen, and then click Next.

clip_image010
5. Read and accept the end-user license agreement (EULA), and then click Next.

clip_image011
6. In the Choose Setup Type dialog box:

  • To install the most common features, click Typical.
  • To select the adapters you want to install, click Custom, and then proceed to the next step.
  • To install all the features, click Complete.

    Important
    To install only the adapter that you will use to interface with your enterprise application, you should perform a Custom installation.

    Note
    For this release, Typical and Complete options essentially perform the same action.

    clip_image012
    7. Click Install.

    clip_image013
    8. In the Customer Experience Improvement Program dialog box specify I don't want to join the program at this time and click OK.

    clip_image014

    Configure BizTalk for the new Adapters

    Now that the new Adapters have been installed you expect them to appear in BizTalk Administration Console, nope!

    clip_image015

    clip_image016
    1. Right click on Adapters, select New then select Adapter...

    clip_image017
    2. Select the first adapter in the drop down list WCF-SQL and give it the same name of WCF-SQL

    clip_image018
    3. Click OK.

    clip_image019

    4. Click OK.
    5. Repeat steps on 1-4 for each adapter in the drop down list.

  • Monday, August 3, 2009

    ESB 2.0 Toolkit install batch File

    Assumption

    Assumptions are made that everything is installed on the one server.
    The following applications are installed in their default locations

    · Office 2007
    · vs2008
    · sql 2008
    · biztalk 2009
    · WSS 3.0
    · UDDI is not installed.

    Directory setup

    clip_image002[4]

    Biztalk2009 contains the contents of the biztalk 2009 ISO (for the UDDI install).
    BizTalkESBToolKit2_0 contains all the msi required to install ESB 2.0 toolkit plus an unzip.ps1 script.
    BizTalkESBToolKit2_0\projectFiles contains files that which replace source files to build on x86 platform.

    Installing UDDI

    clip_image002

    clip_image004

    clip_image006

    Uncheck Launch Microsoft UDDI Servers Configuration

    clip_image008

    The configuring UDDI dialog will appear select custom configuration. Make sure that require SSL for publication to this UDDI Services site is not selected

    clip_image010

    clip_image012

    clip_image014

    Apply configuration and close configuration window when finished

    SQLXML 4.0 SP1

    Click Run

    clip_image016

    ESB Configuration Tool

    clip_image018

    clip_image020

    clip_image022

    clip_image024

    clip_image026

    Microsoft.Practices.ESB.UDDIPublisher.exe select n
    clip_image028

    Dynamic Resolution Install enter username and password for current user
    clip_image030

    Biztalk ESB UDDI Publishing Service
    image

    Batch File Script

    c:
    "c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -i

    IISRESET

    [BASEINSTALLDIR]Biztalk2009\setup /SetupXml [BASEINSTALLDIR]Biztalk2009\UDDI_x86\Setup.xml
    "C:\Program Files\Microsoft UDDI Services\config\Configuration.exe"

    IISRESET

    [BASEINSTALLDIR]BizTalkESBToolkit2_0\MSChart.exe /passive
    [BASEINSTALLDIR]BizTalkESBToolkit2_0\VsSDK_sfx.exe /passive
    [BASEINSTALLDIR]BizTalkESBToolkit2_0\sqlxml_40_SP1.msi /passive
    "[BASEINSTALLDIR]BizTalkESBToolKit2_0\BizTalk ESB Toolkit 2.0 Docs.msi" /passive
    "[BASEINSTALLDIR]BizTalkESBToolKit2_0\BizTalk ESB Toolkit 2.0-x86.msi" /passive

    BTSTASK Importapp -Package:"c:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Microsoft.Practices.ESB.CORE.msi" /ApplicationName:Microsoft.Practices.ESB /overwrite
    "c:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Microsoft.Practices.ESB.Core.msi" /passive

    BTSTASK Importapp -Package:"c:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Microsoft.Practices.ESB.JMS.msi" /ApplicationName:Microsoft.Practices.JMS /overwrite
    "c:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Microsoft.Practices.ESB.JMS.msi" /passive

    "c:\Program Files\Microsoft BizTalk Server 2009\Tracking\bm.exe" deploy-all -DefinitionFile:"C:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bam\Microsoft.BizTalk.ESB.BAM.Exceptions.xml"
    "c:\Program Files\Microsoft BizTalk Server 2009\Tracking\bm.exe" deploy-all -DefinitionFile:"C:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bam\Microsoft.BizTalk.ESB.BAM.Itinerary.xml"

    cd "C:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bin\"
    ESBConfigurationTool.exe

    cd "c:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bin"
    Microsoft.Practices.ESB.UDDIPublisher.exe
    cd [BASEINSTALLDIR]

    powershell.exe [BASEINSTALLDIR]BizTalkESBToolKit2_0\unzip.ps1 'c:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\ESBSource.zip' 'C:\Projects\Microsoft.Practices.ESB\'

    attrib -r -s -h "C:\Projects\Microsoft.Practices.ESB\\Keys\*.*" /d /s
    attrib -r -s -h "C:\Projects\Microsoft.Practices.ESB\\Source\*.*" /d /s

    [BASEINSTALLDIR]BizTalkESBToolKit2_0\sn.exe -k "C:\Projects\Microsoft.Practices.ESB\Keys\Microsoft.Practices.ESB.snk"

    copy [BASEINSTALLDIR]BizTalkESBToolKit2_0\ProjectFiles\Web.config "C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\ESB.Portal\" /Y
    copy [BASEINSTALLDIR]BizTalkESBToolKit2_0\ProjectFiles\ESB.AlertService.csproj "C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\ESB.AlertService\" /Y
    copy [BASEINSTALLDIR]BizTalkESBToolKit2_0\ProjectFiles\Setup.vdproj "C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\ESB.AlertService.Install\" /Y

    "c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com" "C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\ESB.AlertService\ESB.AlertService.sln" /build Debug
    "c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com" "C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\ESB.UDDI.PublisherService\ESB.UDDI.PublisherService.sln" /build Debug

    "C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\ESB.AlertService.Install\Debug\setup.exe" /passive
    "C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\\ESB.UDDI.PublisherService.Install\Debug\setup.exe" /passive

    cd "C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\"
    Management_Install.cmd

    cd "c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\"
    devenv.exe /InstallVSTemplates "c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\1033\ItineraryDsl.zip"
    devenv.exe /InstallVSTemplates "c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\VisualBasic\1033\ItineraryDsl.zip"

    2006 to 2009 Upgrade failed due to BizTalk Group name changed

       

      If you change the name of your BizTalk group from BizTalk Group to something else i.e. TestBiztalkGroup. The upgrade will fail.

      clip_image001

      Upgrade Prerequisites

    1. If you have Developer Tools and SDK installed as part of your 2006 R2 installation the upgrade requires Microsoft Visual Studio 2008 with Service Pack 1.

      clip_image002

    2. Stop the following Services
      1. World Wide Web Publishing Service
      2. Rule Engine Update Service
      3. Stop All Biztalk Host Instances

      The steps to produce upgrade failure.

      Note: From an administration point of view backup/image all machines and objects that will be effected in the upgrade just in case something goes wrong. Trust me it can happen and has happened.

      clip_image003

      Select Install Microsoft Biztalk Server 2009 on this computer.

      Select Next on the Customer Information dialog.

      Select Yes, I accept the terms of the license agreement then Next on the License Agreement dialog.

      clip_image004

      BizTalk Installation will detect that there is already a BizTalk 2006 R2 installation and will perform an upgrade. Now when you scroll to the bottom of the screen you will notice that there are only 2 databases present BizTalkMgmtDb and BizTalkRuleEngineDB.

      Note: this is where you should stop continuing the upgrade and go back to BizTalk Server Administration and change the custom BizTalk Group name back to BizTalk Group.

      I am continuing to show what will happen.

      Select Next on the Upgrade Summary dialog.

      Select Next on the Redistributable Prerequisites dialog.

      clip_image005

      Select Upgrade on the Summary dialog.

      Everythings looks like it is installing fine until you see this screen

      clip_image006

      Log File Errors

      (I have copied and pasted just the errors as log file is to large)

      [11:36:55 AM Info] Upgrade required for MGMTDB Database=BizTalkMgmtDb Server=BIZT2006TO2009

      [11:36:55 AM Warning] Failed to resolve database: Alias=MSGBOXDB, Error: 0

      [11:36:55 AM Warning] Failed to resolve database: Alias=TRACKINGDB, Error: 0

      [11:36:55 AM Warning] Failed to resolve database: Alias=BAMPRIMARYIMPORTDB, Error: 0

      [11:36:55 AM Warning] Failed to resolve database: Alias=BAMARCHIVE, Error: 0

      [11:36:55 AM Warning] Failed to resolve database: Alias=BAMSTARSCHEMADB, Error: 0

      [11:36:55 AM Warning] Failed to resolve database: Alias=TPMDB, Error: 0

      [11:36:55 AM Info] Resolved database: Alias=RULEENGINEDB.

      [11:36:55 AM Info] Upgrade required for RULEENGINEDB Database=BizTalkRuleEngineDb Server=BIZT2006TO2009

      [11:36:55 AM Warning] Failed to resolve database: Alias=BAMALERTSAPPLICATIONDB, Error: 0

      [11:36:55 AM Warning] Failed to resolve database: Alias=BAMALERTSINSTANCEDB, Error: 0

      [11:43:33 AM Info] MSI command line: ADDLOCAL=Documentation,BizTalk,WMI,Engine,Runtime,MOT,MSMQ,MsEDIAS2,MsEDIAS2StatusReporting,WCFAdapter,InfoWorkerApps,BAMPortal,WcfAdapterAdminTools,AdminTools,AdminAndMonitoring,MonitoringAndTracking,BizTalkAdminSnapIn,HealthActivityClient,BAMTools,PAM,AdditionalApps,SSOAdmin,SSOServer,RulesEngine,WssAdapterWS,OLAPNS,FBAMCLIENT,BAMEVENTAPI INSTALLDIR="C:\Program Files\Microsoft BizTalk Server 2006\" UPGRADE=1 PIDKEY="J6T48XCF7KQCGKDQV8874BJYB" USERNAME="Stargate" COMPANYNAME="Stargate Group" FILESINUSEERROR=""

      [11:43:33 AM Info] MSI command line is ADDLOCAL=Documentation,BizTalk,WMI,Engine,Runtime,MOT,MSMQ,MsEDIAS2,MsEDIAS2StatusReporting,WCFAdapter,InfoWorkerApps,BAMPortal,WcfAdapterAdminTools,AdminTools,AdminAndMonitoring,MonitoringAndTracking,BizTalkAdminSnapIn,HealthActivityClient,BAMTools,PAM,AdditionalApps,SSOAdmin,SSOServer,RulesEngine,WssAdapterWS,OLAPNS,FBAMCLIENT,BAMEVENTAPI INSTALLDIR="C:\Program Files\Microsoft BizTalk Server 2006\" UPGRADE=1 PIDKEY="J6T48XCF7KQCGKDQV8874BJYB" USERNAME="Stargate" COMPANYNAME="Stargate Group" FILESINUSEERROR=""

      [11:45:07 AM Error] AdminUpgrade::PostInstallUpgrade exception ErrorCode:-1061151936 Message:The MessageBox database does not have the correct version.

      [11:45:07 AM Info] AdminUpgrade: aborted message agent updates === Logging started at: 11:45:07 AM Tuesday, 4 August 2009 Build: 3.8.368.0 Calling process: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\EBZ15455.tmp\Setup.exe === The current user is BIZT2006TO2009\Administrator. Computer name: BIZT2006TO2009 OS Version: 5.2 Build: 3790 Service Pack: 2.0 Suite: 274 Product Type: 3

      [11:45:07 AM Info] PostInstall upgrade component for Feature: WMI, returned message: The MessageBox database does not have the correct version.

      [11:45:07 AM Error] PostInstall upgrade component for Feature: WMI failed. Error: c0c01b40

      [11:45:07 AM Info] Called FreeLibrary for WMI. Exiting CallPostInstallDllComponent.

      [11:45:07 AM Error] f:\bt\890\private\source\setup\prod\btssetup\voyager\setuphook\bts04upgrade.cpp(2808): 0XC0C01B40

      [11:45:07 AM Error] Error in postinstall upgrade, Error: Configuration Upgrade component for Feature: WMI returned: The MessageBox database does not have the correct version. ., Hresult: c0c01b40

      [11:45:07 AM Error] f:\bt\890\private\source\setup\prod\btssetup\voyager\setuphook\bts04upgrade.cpp(2684): 0XC0C01B40

      [11:45:07 AM Info] PostHook function completed upgrading to BizTalk Server 2009

      [11:45:07 AM Info] PostHook function failed upgrading to BizTalk Server 2009 with hr = c0c01b40

      [11:45:07 AM Info] Storing recovery info for TaskInfo at stage 3

      [11:45:07 AM Error] f:\bt\890\private\source\setup\prod\btssetup\voyager\setuphook\posthook.cpp(336): 0XC0C01B40

      [11:45:07 AM Info] Posthook function returned: -1061151936.

      [11:45:07 AM Info] Posthook function failed and returned the following error message: Configuration Upgrade component for Feature: WMI returned: The MessageBox database does not have the correct version. .

      [11:45:07 AM Error] Some exception may have occured while performing the post upgrade configuration. The details are : Configuration Upgrade component for Feature: WMI returned: The MessageBox database does not have the correct version. .

      [11:45:07 AM Error] Some exception may have occured while performing the post upgrade configuration. The details are : Configuration Upgrade component for Feature: WMI returned: The MessageBox database does not have the correct version. .

      [11:45:07 AM Error] f:\bt\890\private\source\common\prod\btscommon\setup\wizard\exe\progressdlg.cpp(1489): FAILED hr = c0c01b40 === Logging stopped: 11:48:24 AM Tuesday, 4 August 2009 ===

      The problem know is that you can not perform the upgrade again because there is no BizTalk 2006 R2 left and your system is corrupted.

      clip_image007

      Solution

      clip_image001[1]

      Change the BizTalk Group name back to BizTalk Group

      clip_image008

      Start the upgrade process again when you get to the Update Summary you will see the following.

      clip_image009

      In this upgrade there are only 4 database. If you have HWS,BAM and other BizTalk components installed there will be more databases.

      clip_image010