Sunday 28 September 2008

Understanding Paths in MOSS, .ddf files, manifest.xml files, and elements.xml files

Understanding the various MOSS file paths can be a bit frustrating at times. Here's my cheatsheet:
  • Package.ddf: The ddf directives specify the path to the physical files to be copied to the .cab/.wsp file. .Set DestinationDir sets the target location within the .cab file (like a folder); all other paths are relative to the file system location of the .ddf file itself. 
  • Manifest.xml: Instructs SharePoint where to deploy the files held in the cabinet. File paths depend on the containing XML element: assembly paths are relative to the target /bin directory, TemplateFiles are relative to the 12-hive's TEMPLATE directory, DwpFiles are relative to the wwwroot\wss\VirtualDirectories\wpcatalog directory, and FeatureManifests and Resources are both relative to the 12-hive's TEMPLATE\FEATURES directory.
  • Feature.xml: ElementFile locations are relative to the directory structure where the feature is installed (eg. as specified in Manfiest.xml)
  • Elements.xml (via Feature.xml): Module URLs are targets within MOSS; File URLs are relative to the Module URL
This list is a work in progress--your feedback is appreciated!

Batch file variables

Admitedly, I'm not a big batch file geek but like most of you I infrequently dive in and whip up a batch file for any number of reasons. 

So with that preface, here's my stupid tip: 

When setting a variable, don't included spaces between the assignment operator

This probably isn't what you want:

set myvar = hello
echo %myvar%
%myvar%

But this works as expected:

set myvar=hello
echo %myvar%
hello

Inspect the contents of a .wsp solution file

Did you know a WSS deployment file with a .wsp extension (the kind you create using .ddf files and makecab.exe) can be renamed with a .cab extension and its contents inspected in an archive viewer? You can also deploy a .cab file directly to MOSS via stsadm so for convenience our build scripts output a .cab file; if we ever need to double-check the presence of a particular file it's easily opened with 7zip or something similar. 

To do this yourself, simply rename the file output by makecab.exe by modifying the CabinetNameTemplate setting. 

Visual Studio 2008 Remote Debugger Location

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger

There are different remote debuggers for VS2005 and VS2008 so make sure you get the appropriate version (or both).
Update: here are the details for VS2010.

Dirty Words (Michael Hanes) - blog.mediawhole.com mailto:info@mediawole.com
 

Where to find the Microsoft.Sharepoint.dll and other MOSS DLLs

If you're doing custom MOSS development on your local dev machine and deploying to a MOSS 2007 server environment, the relevant SharePoint DLLs should be referenced by your Visual Studio project. Since you haven't installed WSS/MOSS to your local environment, you need to copy those assemblies from the server. At a minimum, you'll probably need Microsoft.Sharepoint.dll.
Most DLLs will be located below C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\ISAPI. Alternatively--and for those DLLs not in the file system--you can extract all MOSS DLLs from the global assembly cache.

On your server, run the following command:

robocopy c:\windows\assembly\gac_msil c:\gac_extract /E

(replace robocopy with xcopy or download and install the Windows 2003 Resource Kit if you're not on Windows Server 2008)

The gac_extract folder will contain a hierarchical folder view of every assembly in your GAC; delve into the assembly folder you're after and copy across the DLL. To avoid keeping multiple copies of these DLLs in multiple projects, create a central local repository for the assemblies you require. Depending on the platforms you're targeting, you may want separate "referenced assemblies" repositories for RTM vs SP1 vs {your target combination of rollups and hotfixes}.

If you still can't find the assembly you're after, check \Inetpub\wwwroot\wss\VirtualDirectories\[site_name_or_port]\_app_bin

After adding a MOSS reference in VS, set the Copy Local property false. You can't run your MOSS project locally unless you're a Vista geek so there's no point copying the referenced assembly to your private bin folder--the assemblies are already installed on your server.
 

Saturday 27 September 2008

VMware Stage Manager and MOSS 2007

We recently looked at moving our environments to VMware's Stage Manager and Lab Manager products. A large majority of our production, authoring/staging, integration and development environments are already virtualised on ESX so these new products an attractive option--they build on top of the ESX offering. The server structure was architected around the assumption MOSS 2007 content deployment works as expected in the case of westernaustralia.com but since it doesn't an admin does a daily stsadm backup/restore from authoring to production--horrific. 

Stage Manager sounds great in theory. Each environment is sandboxed and it takes the thinking out of dev vs prod because dev used to prod and prod is now dev and vice versa. Each environment is packaged up to include everything it needs (AD, database, web, etc). In practice, making this work with MOSS and our existing stage/prod-based content setup (not to mention public networking, host headers, security, machine names... in MOSS, and whatnot) wasn't quite there. If you are successfully using SM with MOSS I'd love to hear from you.

Lab Manager is a complimentary product for efficiently provisioning development (er, lab) environments. Your base image is stored as a template and it gets provisioned on request. This way I don't have to build a new VM for every new dev starting with us and individual developers don't have to spend too much time keeping their development environments up-to-date. We've previously run MS VPC 2007 and while it does the trick, Lab Manager really promises to simplify this stuff. We haven't finalised our purchase yet but I'll let you know how we get on with the product.

Wednesday 24 September 2008

How to Create a stand-alone "small farm" MOSS 2007 VPC without a domain controller

Here's my quick and dirty guide to setting up a stand-alone "small farm" MOSS VPC without a domain controller. In this example I'm using Windows Server 2008 with SQL Server 2008, .NET 3.5, and MOSS 2007; I've been through this process on both x86 and x64 platforms--it's the same in both cases. Presumably this is pretty much the same on Windows 2003.


Note this is not a comprehensive guide to VPC building: I make no assumptions about your virtualisation software (I used the free VMware Server product for x64 guest support in this case but I regularly use MS Virtual PC 2007). You may also want to consider differencing disks, memory allocation, physical disk performance, CPU allocations, and so on.


Install Windows Server 2008
  • Don't add it to a domain but changing the machine name from the default is usually helpful.
Configure the Web Server role
  • Add the ASP.NET service
  • Add HTTP Redirection service (somewhat arbitrary)
  • Add Windows Authentication service
  • Add IIS Management Scripts and Tools
  • Add the .NET Framework 3.0 Feature (excluding XPS Viewer)
Update .NET
  • Download and install .NET 3.5 with SP1 (although you can skip this step if you like and let the SQL Server 2008 install handle it)

Install SQL Server 2008 (RTM)

  • Yes to the prompt to install an updated Windows Installer version (and optionally the .NET Framework 3.5 SP1)

  • Select the stand alone installation option

Choose to install the following at a minimum:
  • Database Engine Service
  • Management Tools - Basic
  • Management Tools - Complete

Configure the SQL Server instance as follows

  • Use the default instance name
  • Use the Network Service account for all services. The database engine service should be set to start automatically.
  • Select Windows authentication mode and add your local administrators group
Note: If you don't want to install SQL Server, you can do a "Basic" MOSS install and the MOSS installer will add SQL Serve Express to your system. This is not considered a MOSS farm deployment and there is no upgrade path from this stand-alone configuration to even a small MOSS farm.


Create Local Accounts


Create moss_farm and moss_web local Windows accounts and set a password. Don't add either account to any specific Windows group or SQL Server. MOSS will take care of creating logins for these accounts in SQL Server and assigning them to the appropriate roles.



Install MOSS 2007 SP1


MOSS SP1 is required to install on SQL Server 2008. SP1 can be slipstreamed into the RTM build although Microsoft supplies a ready-to-go MOSS 2007 with SP1 installer.
  • Select the Advanced option
  • This is a small farm installation, so select the Complete option (not the Stand-alone option unless you're not using SQL Server 2008)
  • Leave all defaults as they are
  • Install any post-SP1 updates before running the configuration wizard.

Note there's no requirement to install Windows SharePoint Services (WSS) 3.0 when installing MOSS 2007.



Configure MOSS
  • Run the configuration wizard
  • Select to create a new farm
  • Point MOSS to localhost as the database instance
  • Leave the configuration database name as SharePoint_Config or change it if you like
  • Provide credentials for your moss_farm account
  • Create the Central Administration site on any free port
  • Extend the server's path variable to include C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\BIN (for easy access to stsadm)

Enable Ping (always helpful)

  • netsh firewall set icmpsetting 8
    (to disable ping: netsh firewall set icmpsetting 8 disable)

Clean Up
  • Disable visual enhancements
  • Turn off the Windows page file
  • Delete installer and windows update files (all the junk under %windir%)
  • Defrag, compress, backup, etc

Create a Test Site
  • Create a site using your moss_web account.
  • Set up SSPs, etc, etc.

[Update: Since I wrote this post I've come Justin Devine's very extensive and well-illustrated post on configuring a small farm, with AD and SQL Server 2005, on Windows 2003. Well worth reading and there are some detailed walkthroughs on POP3 and SSP setup. Awesome work Justin! Also worth checking out this link]

MOSS Won't Check In or Publish: "Unable to complete this operation. Please contact your administrator."

A few of our content editors came up against this error in the page editing toolbar when trying to check-in/publish MOSS 2007 pages: "Unable to complete this operation. Please contact your administrator." Not the most insightful error messsage but at least it wasn't a standard SharePoint error page or an ASP.NET Server Error page.

The problem wasn't affecting all subsites in the content database in question (www.westernaustralia.com is sort of variation-based) so it was a bit strange; our system administrator also didn't spot anything unusual--not sure if there was anything in the event logs though. 

Anyway, thanks to Michael Lotter's post we went on the hunch the SQL server might have some disk capacity issues and sure enough the old transaction log backup job wasn't deleting old log files. 

Wednesday 10 September 2008

VMWare Server 2.0 RC2 on a 64-bit host with a 64-bit guest

I recently decided to consolidate a number of physical servers onto a virtualised platform to save space, save energy, and make life easier to backup and manage. Doing this with 32-bit software wouldn't have been a problem: install host, deploy guests, away we go. Instead, since Windows 2008 has RTM'd and MOSS scalability supposedly benefits from a 64-bit environment and MOSS 2007 is supposedly the last 32-bit version of said platform, I figured I'd go whole hog and install 64-bit W2k8 as both host and guest. Not so fast, cowboy. 

The first problem I encountered was the need for 64-bit hardware support. Intel CPUs have offered 64-bit bits for a while now--the Celeron machine I built for my father in-law a few years back offered support for a 64-bit OS, for crying out loud. Not only does a machine require these extensions to run a 64-bit host but apparently some extra special extensions are also required to then run a 64-bit guest. Okay fine: I had to enable the Intel VT stuff at the BIOS level but having done that I'm ready to go. 

Sort of. 

I'm a habitual Virtual PC 2007 user. VPC doesn't support 64-bit guests, I read somewhere (but don't take my word for it), and I'm a bit over the whole VPC thing anyway. I want VMWare's ESX to nearly omit the host OS. ESXi is now free but attempting to install that requires special hardware and while I did get to the point where the installer was looking for SCSI drives, I gave up for now since I don't yet have a fun new iSCSI thing put together just yet... maybe in the future. I've already experimented with Hyper-V but it doesn't allow you to move VMs around very easily and moving these things to and from my laptop might be useful in the future. 

So I settled on the current version of VMWare Server 1.x (aka GSX). It's free and while I've never used it before, it offers some intriguing features--especially support for 64-bit guests. I bang together my Windows 2008 64-bit host machine (without Hyper-V, of course), install VMWare Server, and surprise, I can't create new VMs as there appears to be no local VM server installed. Googling around and word on the street has it 1.x doesn't support 64-bit hosts. Sigh. 

After uninstalling 1.x, I've now downloaded and installed 2.0 RC2. The installer itself doesn't seem to come in a x64 flavour, which is kind of boring; it also seems to automatically install some sort of thingo requiring a FQDN--which I assume is the web-based management interface that was optional in the previous version and was otherwise installed as an IIS web site. Dunno. The web access bits are definitely there and it seems to have installed Tomcat. Great.

Even still, the thing's installed, so good. I don't know why they decided to go from a Windows UI to a web UI but they have. It's slow, annoying, and boring but it seems to work so far. The worst part is that it keeps asking for certificates and logins and this, that, and the other thing. Just get on with it already! I logged in as myself when prompted but I'm not sure how it determined my password and why it can't just log me in automatically.

Out of the box this release supports Windows 2008 64-bit guests, which is nice. Setting up walks you through a wizard, which isn't really my thing but I've gotta say the memory selection is sooo nice: select the recommended value (1024MB), the minimum recommended, or the max recommended (or set your own value directly). No stupid sliders, just go. The console did require I install a plugin but after I powered on my first VM opening in a new window failed. Powering on the VM in fact did a whole lot of nothing. Despite being pointed at the local drive for the Windows 2008 media, the thing sits there with the VMWare logo grinning back at me. I configured the VM with SCSI drives (the default) and in all honesty I don't know a lot about SCSI and how it relates to things I take for granted with IDE drives.

All in all, the thing's installed now--just need to figure out how to become as proficient with this tool as I am with VPC 2007!

I Love Google Chrome

I've got a favourite new browser and it's Google Chrome, launched earlier this month. I'm not a big fan of browsers generally--I see them as a just another tool--and I even suggested to a colleague new browsers really fail to excite in this day and age. I was dead wrong. 

You may have read that I quite enjoy Google Analytics and Google Apps, both of which bring you this site. I'm not Google's biggest fanboy: I rarely use gmail and I find most of their site interfaces quite bland (a minor criticism, really). But Chrome takes the cake. I'm actually writing this post from within Chrome. 

I'm not quite sure what it is. The first thing I noticed was the performance--the thing whizzes along. The start/history page when the browser is first opened is extremely handy as I tend to visit a lot of the same sites every day. It doesn't crash like IE does, bringing down all my tabs with it. It's quick to start, unlike Firefox. All the sites I've hit work fine and look fine except for a few minor rendering issues and JS niggles. The UI is so nice and simple once you figure out where all the usual things have gone. I didn't have to install Flash. I don't have to worry about my IE bookmarks being out of sync. Beauty!

Of course I'm a web developer and I'd be nowhere without my Firefox toolbars and even the IE Dev Toolbar. Not sure how that goes with Chrome as I haven't looked into it but for simply getting stuff done, this thing rocks. 

[Update
About a month in and I'm using Chrome for everything except testing and where integrated authentication will make my life easier at work. I absolutely love the omni bar and keep typing searches into IE's address bar. I also really love the start page and the way it remembers my frequently visited sites--so, so handy. 

Although I've seen the occasional error message pop up, Chrome has yet to crash, at the browser level or the tab level. I've also explored some of Chrome's development tools... um, basic but a good start. Support for FF plugins would be amazing Google!!! I'm also watching the Chrome stats creep up on this site and the other sites I look after... nothing big yet but I'm sold!]

Latest MOSS Site Launched!

The latest Tourism WA partner site launched this afternoon: http://www.australiasnorthwest.com. Well done to the northwest content editors and everyone involved from my team and at TWA.


ANW is the second partner site to be launched on our MOSS-based MCMS replacement. http://www.australiassouthwest.com launched in early June and we've got another three regional tourism operator sites to migrate across before Christmas '08. We've built a web part framework on top of the MOSS platform for rolling out new partner sites so the launch of this site is the result of a lot of on-going hard work by the eMarketplace team here at Tourism.

Historical Flash Player Versions

If you've ever needed to test against an older version of the Flash browser plug-in, Adobe has an archive available of all versions back to v2. Instructions are also available for uninstalling existing versions.

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14266

Monday 8 September 2008

Access the MOSS Content Database via UNC Paths

I've seen a problem with the document library multiple upload option in MOSS across two separate installs now where the submit button just doesn't respond to clicks. This has proven extremely annoying for content editors trying to upload multiple images and documents (and that's apart from the ugly UI). Work arounds like Explorer View (from the document library View drop down) kind of work but are tied to IE and are just clunky.

The approach I use most often is to access the MOSS content database I'm after through a UNC path. Doing so exposes the content database structure through Windows Explorer and I can simply drag and drop files as I'm used to. If you've ever used SharePoint Designer to access a MOSS site, you'll see a structure through UNC that looks about the same (eg. _catalogs, SiteCollectionImages, etc).

UNC paths work with both port-based and host header-based sites but they can be a bit fiddly. Firstly, you need to ensure you're trying to access an edit site to which you have permissions--you probably won't get much from a read-only (anonymous) URL. Secondly, you may be prompted to authenticate. Finally, I always run into an error on first access if I try to browse the site root, so I usually start in \SiteCollectionImages.

Here's an example:

\\edit.mediawhole.com\SiteCollectionImages (host header)

and

\\dev-moss-mh:28000\SiteCollectionImages (becomes \\dev-moss-mh@28000\SiteCollectionImages) (:)

If you then drop the \SiteCollectionImages part, you'll see the full site hierarchy.

The Windows Explorer interface is obviously pretty basic so you won't be able to see version histories and approve content--you'll still need to take care of those aspects through the UI or some other way.


UNC paths allow spaces so if you're coming from a browser, make sure you URL decode the %20 values as spaces.

One last note, you may have a "Open with Windows Explorer" option on the Actions menu if you're viewing a document library via the All Site Content screen. Clicking this menu item will open a new Windows Explorer window pointing at an http:// URL to the same location (eg. http://dev-moss:30000/PublishingImages).

Update: you may need to ensure your client has the WebClient service started as well according to this.

Authored Links Don't Update Between Environments - Resolved

We've found a solution to the authored links problem I blogged about in August, with assistance from Microsoft Sharepoint Support (thanks go out to Arian Nevjectic and Jason Brown for communicating with the product team, and to Matt in my team for getting to the bottom of this).

The FieldId elements defining the columns in question were missing two attributes: RichText="TRUE" and RichTextMode="FullHtml". New sites based on this template are now working correctly but MS has recommended we not change the site template for the sake of existing sites. We're therefore exporting content, recreating the site, and importing content back in--a hassle but should do the trick.

<Field
ID="{EE8A6F4B-E0B9-4aa8-B923-967D25CE1154}"
Type="HTML"
Group="Custom"
Name="PublishingPageContentBottom"
DisplayName="Publishing Page Content Bottom"
StaticName="PublishingPageContentBottom"
Hidden="FALSE"
Required="FALSE"
Sealed="FALSE"
RichText="TRUE"
RichTextMode="FullHtml"

/>

The MSDN documentation currently reflects this structure but I'm not positive it did previously... our mistake either way but at least it's fixed now and the doco is accurate.