Developing a webpart for sharepoint 2007 with visual C# .NET 2003
- Hi,
I want to create webparts for sharepoint server 2007 with visual C# .NET 2003, with Microsoft .NET Framework 1.1.
I copied the Microsoft.Sharepoint.dll from the server in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI to a local directory in my PC.
I installed the web parts template from http://msdn2.microsoft.com/en-us/library/ms916853.aspx, referring the directory where the dll was.
When i open one new web part project i get an error that the reference to that dll was not possible. Adding the reference manually, the same happens with the following error occouring: "A refereence to c:\...\Microsoft.Sharepoint.dll could not be added. This is not a valid assembly or .COM component. Only assemblies with extention dll and COM components can be referenced. Please make sure that file is accessible, and that it is a valid assembly or COM component".
This happens either if i create a C# or VB project.
Any ideas
I apreciate any help on this.
Best regards
D
Answers
For webpart development there is another trick as well. Install the Visual Studio Express - C# (or whatever it's called). Since, as JXJ mentioned, SharePoint webparts can be based off of the old SPS 2003 / WSS 2.0 webpart model or the ASP.NET 2.0 model, you can then use either method within your Visual Studio Express environment. The beauty of using Visual Studio Express - Web Edition is that you don't need a reference to the SharePoint DLL, and all you end up doing is referencing the System.Web.dll assembly for half of SharePoint-based webparts.
PS The Microsoft.SharePoint.dll file they were looking for is located @ C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\ISAPI. Unfortunately (as noted by the 60) they are really looking for the SPS 2003 / WSS 2.0 DLL which means you will need to find a server that has that installed to use the WebPart Library.
Please look at the following site for more information creating a WSS 3.0 / MOSS 2007 webpart using the ASP.NET 2.0 WebPart control (recommended webpart creation process): http://msdn2.microsoft.com/en-us/library/ms415817.aspx
All Replies
You need Visual Studio 2005 to do it. Sharepoint 2007 web parts use .NET 2.0, and VS.NET 2003 only does .NET 1.1.
But... if you really really can't upgrade to VS.NET 2005, one possible alternative is to get hold of the Sharepoint 2003 DLL files (version 11.0) and write your web part as a Sharepoint 2003 web part (which uses .NET 1.1). These web parts will work in Sharepoint 2007, although you won't have access to all of the newer APIs.
I had several web parts that I wrote for SPS 2003 and instead of porting them to VS.NET 2005/.NET 2.0, I just left them as 2003 web parts and they work OK with Sharepoint 2007.
For webpart development there is another trick as well. Install the Visual Studio Express - C# (or whatever it's called). Since, as JXJ mentioned, SharePoint webparts can be based off of the old SPS 2003 / WSS 2.0 webpart model or the ASP.NET 2.0 model, you can then use either method within your Visual Studio Express environment. The beauty of using Visual Studio Express - Web Edition is that you don't need a reference to the SharePoint DLL, and all you end up doing is referencing the System.Web.dll assembly for half of SharePoint-based webparts.
PS The Microsoft.SharePoint.dll file they were looking for is located @ C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\ISAPI. Unfortunately (as noted by the 60) they are really looking for the SPS 2003 / WSS 2.0 DLL which means you will need to find a server that has that installed to use the WebPart Library.
Please look at the following site for more information creating a WSS 3.0 / MOSS 2007 webpart using the ASP.NET 2.0 WebPart control (recommended webpart creation process): http://msdn2.microsoft.com/en-us/library/ms415817.aspx


