|
There are really two different halves to this package. The first half is a set of new project templates that allow you to create site definitions, list definitions and of course - Web Parts. The second half of this package is the Solution Generator, which is basically a wizard for generating a solution that you can then use to add features and site definitions and list definitions.
The bottom line is that these tools take the tedious, mind-numbing, painful task of writing and deploying SharePoint code and reduce it to something that is actually useful. I can now hit "F5" when I'm looking at my Web Part and have it get wrapped up inside a feature which is then wrapped inside a solution which is then deployed to SharePoint and added to the list of available solutions automatically via a script that invokes stsadm -o addsolution, and then the feature in question is actually activated for me. If I had to create all the deployment files manually, then manually copy files, then manually run stsadm to add the solution then manually enable the feature, the entire task would have taken me probably an hour to deploy 1 line of code. Thats unacceptable and the WSS extensions for VS fix this problem, and they fix it quite well.
The first step is to download the extensions . Once you've got them downloaded, install them and you're good to go.
First, open Visual Studio 2005 and create a new Web Part project and call it HelloWorld. You should see a new Web Part. You will also notice that your project already has a strong name, is already strongly versioned at version 1.0.0.0, and already has a reference to Microsoft.SharePoint.dll. Right-click your project and go into properties and you'll see a new vertical tab called SharePoint Solution. This allows you to define all of the properties of your SharePoint solution, including the name, description, event receivers - you name it.
Next, click the Debug tab in the project properties window. You'll see that there is a "Deploy to URL" option. Set this to the URL of the top-most site of the site collection to which you want to deploy the web part. For example, in my case, I set it to http://win2k3r2lab/budget test site, which will add the solution to the farm and then install the feature at that particular site and will even activate it for me.
While you're at it, make sure you uncomment the writer.Write("HTML output"); line and replace the text with something meaningful, like, Hello World :)
At this point you've coded your Web Part, and you know how to code Web Parts because you've been reading my blog and you have a copy of my book in hand (well, when its published anyway) and you're ready to deploy. This is where it gets reaaaallly goooood. If you spent any time at all developing Web Parts for WSS v2.0 or even *gasp* v1.0, then you know exactly what a colossal pain in the butt it is to go from build to deploy and test.
Not so here... Simply hit F5. The Web Part will be stuffed into a feature, which is stuffed into a solution, which is deployed to the farm (farm is obtained by examining the URL you gave VS 2005 in the "deploy to" location) and then activated at the site you indicated. From there, you can flip through the list of available Web Parts within SharePoint and add your newly created custom Web Part to the site of your choice, as shown below:
CAUTION: The Visual Studio 2005 Extensions for WSS v3.0 will only work on a server on which you have WSS v3.0 installed!!!
I will be posting another blog post shortly describing what I think is an ideal and fairly productive development environment for WSS v3.0 and MOSS 2007, so stay tuned!
Thanks for a very helpful post. Have you (or has anyone) figured out how to
run VS 2005 Extensions for WSS v3.0 on a development machine (XP) that
doesn't have WSS v3.0 installed? Perhaps that's what you'll be covering in
your upcoming blog post, which is eagerly awaited. Thanks!
We are trying to publish a simple Web Part using Visual Studio on Server
2003 running MOSS 07 locally. Our URL to our site is http://sp2007 and
opens fine in a browser. We can not however get the site to deploy with
the error - "No SharePoint Site exists at the specified URL". Any ideas on
how we can fix this problem?