I wanted to create a simple html file in the root of my Wss3 web application, so I created an empty file test.htm. I double clicked te file and because I have SharePoint Designer installed, it is the default editor for .htm files. I put some test into the .htm file along the lines of "Hello world!", and boom: my Wss3 web application is dead. I get the following error:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Data at the root level is invalid. Line 1, position 1.
Source Error:

Line 1:  <browsers>
Line 2:      <browser id="Safari2" parentID="Safari1Plus">
Line 3:          <controlAdapters>

Source File: /App_Browsers/compat.browser    Line: 1


Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832

After some searching I found what happened:

When you open a file with SharePoint Designer, it creates all kind of FrontPage Server Extension functionality in your web application. One thing it does it that it creates a _vti_cnf folder in every folder you have in your web application. If you remove all these folders you fix your problem.

I don't know of a handy DOS command to delete all these folders recursively, but with some PowerShell I solved the problem.

Open a PowerShell prompt, set the current directory to the folder hosting your web application and execute the following command to see the "damage":

PS C:\Inetpub\wwwroot\wss\VirtualDirectories\wss3dev> get-childitem -path . -name _vti_cnf -recurse
_vti_cnf
App_Browsers\_vti_cnf
App_GlobalResources\_vti_cnf
aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\CSs\_vti_cnf
aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\html\_vti_cnf
aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\Images\ToolBar\_vti_cnf
aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\Images\Tree\_vti_cnf
aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\JS\_vti_cnf
wpresources\_vti_cnf
_app_bin\_vti_cnf

Now execute the following PowerShell command to kill all these folders and become a happy camper again:

PS C:\Inetpub\wwwroot\wss\VirtualDirectories\wss3dev> get-childitem -path . -name _vti_cnf -recurse | % { remove-item -Path $_ -recurse }

Posted by svdoever | 5 comment(s)
Filed under: ,

When delivering a virtual hard disk to your team to build their virtual machines on I perform the following steps to minimize the size of the virtual hard disk. It is assumed that Virtual Server 2005 R2 SP1 is installed.

  1. Make sure you merged the Undo disks, and that differencing disks are merged with their parent disks
  2. Disable undo disks
  3. Start the virtual machine to compact
  4. In the virtual machine download CCleaner on http://www.ccleaner.com . This is a great tool to clean your disk from history files, cache files etc. I run this almost daily on my virtual machines and my host system. Thanks Danny for introducing me to this great tool.
    Quote from their website:
    CCleaner is a freeware system optimization and privacy tool. It removes unused files from your system - allowing Windows to run faster and freeing up valuable hard disk space. It also cleans traces of your online activities such as your Internet history. But the best part is that it's fast (normally taking less than a second to run) and contains NO Spyware or Adware! :)

    During installation beware of the option to install the Yahoo toolbar, you often overlook this co-packaging options from Microsoft, Google and Yahoo:
    clip_image002
  5. In the virtual machine run CCleaner with the options you prefer, my options are:
    clip_image004
  6. Shut down the virtual machine
  7. Mount the virtual hard disk to compact using vhdmount (part of Virtual Server 2005 R2 SP1):
    "C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount" /p “drive:\folder\YourVirtualHarddiskToCompress.vhd”
  8. Go to Start > My Computer; Right-click and select Manage. Now defragment the disk mounted in step 6
    clip_image006
  9. "C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount" /u /c “drive:\folder\YourVirtualHarddiskToCompress.vhd”
  10. Now start your virtual machine, and mount the ISO image C:\Program Files\Microsoft Virtual Server\Virtual Machine Additions\Precompact.iso. I personally use VMRCPlus to mount the ISO, right-click on CD-Drive and select Attach Media Image file… as shown in the screenshot below
    clip_image008
  11. When you navigate to the drive where the ISO image is mounted, the precompaction starts. The precompaction writes zero’s in all unused space in the disk, so the disk can be compacted in the next steps.
  12. Shut down the virtual machine
  13. Now start compaction of the virtual disk. This can be done in VirtualPC 2007, in the administrative web Virtual Server 2005, or in VMRCPlus, which I use here. Navigate to Tools > Virtual Disks > Inspect Virtual Hard disk, select your vhd to compact and select disk operation Compact
    clip_image010
  14. Done! Make your virtual hard disk read only, and start creating differencing disks based on your new base disk.
Posted by svdoever | 4 comment(s)
Filed under:

I have always been so annoyed by the fact that on my laptop with 1920x1200 resolution I could only get a connection to my virtual machines at a resolution of 1600x1200, the max resolution by the emulates S3 graphics board, resulting in two 160 pixesl wide black bars on the left and right sides. But on Vista I did get a connection on higher resolutions, after some searching I found that the old Remote Desktop Connection software of XP (SP2) was the problem. Upgrade it to version 6 and you worries are over. See: http://support.microsoft.com/kb/925876/en-us. Happy virtual development!

Posted by svdoever | with no comments
Filed under:

Ronalus has created a great small utility to explore the contents of SharePoint Content Management Pages called Content Migration Package Explorer.

This tool can be used to investigate the data exported by the SharePoint Content Migration API. You can create an export either with stsadm.exe, or with custom code.

As example for this weblog I exported a simple site containing some test data using the following command:

Stsadm.exe –o export –url http://wss3dev/FlexShop -filename c:\temp\FlexShop -nofilecompression

We now have a folder containing the output files, a set XML files and other files:

clip_image002

If we fire up the Content Migration Package Explorer we get the following startup screen:

clip_image004

You can now enter the export folder and browse through the exported information using a simple to use explorer, see below for some screenshots:

clip_image006

clip_image008

clip_image010

clip_image012

clip_image014

clip_image016

Posted by svdoever | with no comments
Filed under:

I just stumbled accross a handy little utility that is really handy during SharePoint development: Show List and ViewGUIDs.

Type a Site URL, and select “Display Lists Titles and Ids”. From the list of lists you can select a list GUID, and with right-click copy it to the List ID input field.

clip_image002

After clicking “Display Views” you see the available list views. Again you can select a view guid, and with right-click copy it to the View input field.

clip_image004

Select “Display Items” to display the list items in the view.

clip_image006

With a click on “Display default List Attribute Names” de internal names of the fields in the list are displayed.

clip_image008

Very useful if you don't have tools like SharePoint Explorer or SharePoint Inspector installed, or if you find those tools too large/slow/complex to get some GUIDs and name information fast.

Posted by svdoever | 4 comment(s)
Filed under:

The SharePoint command-line utility stsadm.exe was driving me crazy for the last two days. I'm automating all kind of this from PowerShell scripts, but I got the error "Command line error" while I was absolutely sure that what I was doing was correct. I did stsadm.exe -o deletesolution foobar.wsp. And the problem was: character encoding...

First I thought it was a problem with the way I executed this command from PowerShell. When I copied over the command to a different script it worked. What!!!??? Then I copied it over to the cmd.exe shell on the command line and I got the same error.

I started searching on Google and came accross this blogpost. It said it had something to do with encoding. The blog post also pointed to this blog post where people responded in the contents with the most hillarious solutions like:

If I type STSADM.EXE it works, while STSADM.exe does not work, or that a solution file must be in the same folder as stsadm.exe. Read the comments, it is fun how far off people can get.

Another post mentioning the problem is this discussion thread.

The problem happened to be in the encoding. One way or the other it is possible to get different encodings while typing in the same command multiple times in the same cmd.exe shell. Don't ask me how.

If you have problems, type your text in an editor like Notepad++, and switch between "Encode in ANSI" and "Encode in UTF-8" (it is under the Format menu in Notepad++). You see (sometimes)the dash(-) in stsadm -o command... change from '-' to a strange little block... There is the problem. The dash is not always a dash, it is a hyphen... And stsadm then thinks that no command is specified. Remove the strange block, type a hyphen while is UTF-8 encoding, copy that and bingo!! It works.

Ok, how to repeat this:

  1. Start Notepad++, set encoding to ANSI
  2. Make sure the path to stsadm.exe is in your path environment variable (or use full path)
  3. Type stsadm -o deletesolution foobar.wsp
  4. Start cmd.exe
  5. Copy the text over and press enter: voila, Command line error.

The strange thing is that even if you remove the dash (-), and type it again, it still gives errors. I have no clue why.

This dash/hypen thing is a common problem if you search Google, for more info see for example:

Posted by svdoever | 4 comment(s)
Filed under: , ,

Now Visual Studio 2008 is released (I know, I'm blogger #100.000 to mention this) it is interesting to look at the future of one of the important building blocks on the Microsoft platform for building Software Factories: the DSL Tools.

Stuart Kent, Senior Program Manager with the Visual Studio Ecosystem team, reveals a part of the post Visual Studio 2008 roadmap for the DSL tools in its blog post DSL Tools beyond VS2008.

Some of the mentioned concepts are already available in the implementation of the Web Service Software Factory: Modeling Edition, really interesting to have a look at the code.

The next version of Visual Studio will be Rosario. Clemens Rijnders describes some of the new Rosario features with respect to DSLs in his blog post Rosario Team Architect CTP10 Preview. One promising concept is the Designer Bus, which should simplify working with multiple DSLs in the same domain that reference each other. Some support for this functionality in currently available as the DSL integration service power toy.

Posted by svdoever | with no comments
Filed under:

PowerShell has powerful exception handling, but it is badly documented and takes while to understand what the heck they actually want to do to wire up the exception handling.

I'm normally not such a link poster, this is more of a "post-to-self" item that might be useful for others as well.

Posted by svdoever | with no comments
Filed under:

It is final! After almost nine months of hard work the version 3 of the Patterns&Practices Service Factory is released on CodePlex.

Johan Danforth already published this announcement here, but it doesn't hurt to bring it to your attention again because this stuff is good!

And the strange thing is that Don Smith, the Technical Product Planner of the Service Factory didn't had the time to blog about it and announce it officially. But I know why: he is a busy man! After TechEd 2007 in Barcelona last week (interview video), he was so kind to take the time to repeat the 3-days Service Factory Customization Workshop in the Netherlands with the Secret Dutch Software Factory Society.

I heard about this workshop through Olaf Conijn, who used to work at our great company Macaw. He announced the Dutch workshop in this blog post.

Olaf and Don did give this fantastic workshop at the domains of InfoSupport in Veenendaal, the Netherlands (thanks for the hospitality Marcel!). Way to far away from home (okay 80km in the Netherlands is trouble in the morning and afternoon), so a good reason to take a hotel and continue in the evenings where you often have the best conversations about beer, woman, and... oh ya, software factories.

Don and Olaf are great guys who know their stuff, and they even both did Bikram yoga, my addiction in life;-)

I personally wasn't really that interested in the web services part of the Web Service software factory, but in the customization part. And that is what we did. We customized the factory without "cracking the factory" (change the source code) through the great extensibility points that are available, and customized it while "cracking the factory" and changing the code. And the good thing is: this scenario is supported, documented and it is actually expected behavior to be done by companies who will be using the Service Factory;-). And the brilliant thing is: they even provided the code to build a complete MSI installer for your modified Service Factory!

The factory is provided with complete (recompileable) source code, and contains a lot of really interesting factory plumbing that I will elaborate on in a later post.

One thing is sure: we are definitely going to integrate the Web Service Software Factory into the Macaw Solutions Factory, our own software factory. It will fit like a glove (after some customization of course;-)). Brilliant work P&P!

Another great thing of three days together with 25 people busy with software factories is the amount of collective knowledge and the wealth of information we did share with each other. My compliments to Don and Olaf for providing a lot of room for this information sharing.

We gave presentations to each other about the things we are doing with software factories:

For more information see the MSDN landing page Web Service Software Factory: Modeling Edition. Check it out!

Posted by svdoever | 4 comment(s)

I was having some fun with PowerShell to talks against the SharePoint object model. I needed to know if a SharePoint solution was installed and if it was deployed. I got to the code below. Might be handy for someone to see how easy it is to get info out of SharePoint.

And the purpose I need it for? In our Macaw Solutions Factory we have a development build and a package build. Development build for SharePoint deploys everything to the bin folder of one or more web applications. Package build creates a solution package (.wsp file) that does install assemblies to the GAC. If this solutions package is deployed on the development machine, we want to detect that, because you will not see any changes after compile in a development build. The GAC assemblies have precedence over the assemblies in the web application bin folder.

So here is the code, have fun with it.

[void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint")

function global:Test-SharePointSolution
{
    param
    (
        $solutionName = $(throw 'Missing: solutionName'),
        [switch]$installed,
        [switch]$deployed
    )
    
    if (!($solutionName.EndsWith('.cab') -or $solutionName.EndsWith('.wsp') -or $solutionName.EndsWith('.wpp')))
    {
        throw "solution name '$solutionName' should end with .cab, .wsp or .wpp"
    }
    
    if ($installed -and $deployed)
    {
        throw "Select either the '-installed' switch parameter or the '-deployed' switch parameter, not both at the same time"
    }
    
    $farm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()
    $solutions = $farm.get_Solutions()
    $solutioncheck = $false
    foreach ($solution in $solutions)
    {
        if ($solution.Name -ieq $solutionName)
        {
            if ($deployed)
            {
                $solutioncheck = $solution.Deployed
            }
            else
            {
                # installed, is always true if we get here
                $solutioncheck = $true
            }
            break
        }
    }
    return $solutioncheck
}

Test-SharePointSolution -solutionName wikidiscussionsolution.wsp -installed
Test-SharePointSolution -solutionName wikidiscussionsolution.wsp -deployed
Posted by svdoever | with no comments
Filed under: ,
More Posts Next page »