Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
Note: Updated 1st April 2006 for SP2
I needed to create an eventsync in Windows Sharepoint Portal 2.0. This should have been reasonably straight forward, however with the scenario I found myself in it has taken 3 days of research and pondering to get the job done.
This is my environment and I explain after that how I managed to do it.
Dev MachineXPSP2, VS2005Dev ServerW2k3, Sharepoint Services 2.0
Example using C#
using
a) Because VS2005 creates a dotNet 2.0 assembly and Sharepoint 2.0 is working on dotNet 1.x you cant register your event handlerI didnt want to revert to VS2003 so I tried to see if you could use dotNet 1.x with VS2005 - according to Microsoft you cant !"Visual Studio 2005 ships with version 2.0 of the .NET Framework. Visual Studio 2005 does not allow you to choose to support version 1.0 or version 1.1 of the .NET Framework. You can only create projects that support version 2.0." Details here b) Thus I need to make Sharepoint on the Dev server run on dotNet 2.0 1) You must make sure that the Sharepoint 2.0 SP2 upgrade is installed. This will allow Sharepoint to run on dotNet 2.0 2) Open IIS Administrator, open the properties on the Sharepoint Web Site, Choose the ASP.Net Tab, select 2.0.x as the ASP.Net version. Note: This will temporarily break you sharepoint installation, but dont panic!If you try to access the site you will recieve the following message: This Windows SharePoint Services virtual server has not been configured for use with ASP.NET 2.0.50727.42. For more information, please refer to Knowledge Base article 894903 at http://go.microsoft.com/fwlink/?LinkId=42660. 2) Because of the different security model in dotNet 2.0 you must run the following On the Sharpoint server [full details here]: stsadm.exe –o upgrade –forceupgrade –url http://URLOftheVirtualServer 3) Register and install your dotNet 2.0 assembly into the EventHandler section for the Document Library you require. (Information below from Sharepoint SDK)
a) Because VS2005 creates a dotNet 2.0 assembly and Sharepoint 2.0 is working on dotNet 1.x you cant register your event handlerI didnt want to revert to VS2003 so I tried to see if you could use dotNet 1.x with VS2005 - according to Microsoft you cant !"Visual Studio 2005 ships with version 2.0 of the .NET Framework. Visual Studio 2005 does not allow you to choose to support version 1.0 or version 1.1 of the .NET Framework. You can only create projects that support version 2.0." Details here b) Thus I need to make Sharepoint on the Dev server run on dotNet 2.0 1) You must make sure that the Sharepoint 2.0 SP2 upgrade is installed. This will allow Sharepoint to run on dotNet 2.0 2) Open IIS Administrator, open the properties on the Sharepoint Web Site, Choose the ASP.Net Tab, select 2.0.x as the ASP.Net version. Note: This will temporarily break you sharepoint installation, but dont panic!If you try to access the site you will recieve the following message: This Windows SharePoint Services virtual server has not been configured for use with ASP.NET 2.0.50727.42. For more information, please refer to Knowledge Base article 894903 at http://go.microsoft.com/fwlink/?LinkId=42660.
2) Because of the different security model in dotNet 2.0 you must run the following On the Sharpoint server [full details here]: stsadm.exe –o upgrade –forceupgrade –url http://URLOftheVirtualServer
3) Register and install your dotNet 2.0 assembly into the EventHandler section for the Document Library you require. (Information below from Sharepoint SDK)
DocLibHandler, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=0fafac2a0cc92888
DocLibEventHandler.DocVersionHandler
iisreset
I can now use VS2005 with dotNet 2.0 dll's handling the events for Sharepoint Services site which is running on dotNet 2.0 - The best of all worlds - its just a shame these things take so long the first time around. So if you need to do something similar I hope this helps.