How to Develop SharePoint 2007 solution using Visual Studio 2008..?
I want t开发者_开发技巧o develop a public website on SharePoint server 2007.
But, I want to develop a solution using Visual Studio 2008 (I dont want to use SharePoint designer 2007).
You are missing some fundamentals of how SharePoint development and deployment differs from ASP.NET. You create SharePoint Solution Packages in (.WSP) in Visual Studio and deploy them to the server using the STSADM tool. Alternately you can deploy web parts to the BIN using more traditional techniques of copying the files and modifying the web.comfig on the server but in the long run it is worth your time to understand how to create solution packages.
Here is an article and video to get you started: http://msdn.microsoft.com/en-us/library/bb466225.aspx
The author of the article Ted Pattison is the author of a book called "Inside Windows SharePoint Services 3.0". It is considered one of top books for SharePoint development and you can usually find it used online very cheap, I would highly reccomend picking up a copy.
He is also the author of the excellent deployment tool STSDev which can be found on CodePlex. I would suggest taking some time to understand the deployment process before using tools like STSDev, WSPBuilder or SPVisualDev, because while the tools are good, and relieve much of the tedious stuff involved with SP development, they do not handle all scenarios and eventually you will find yourself needing the fundamentals to create flexibility the tools don't provide.
Cheers, CJ
Depending on the environment that you are using there are multiple strategies to setup your machine for Sharepoint Development.
If you are using an operating system such as Windows XP, Vista, or 7 you will not be able to install either Sharepoint 2007, Windows Sharepoint Services, or Visual Studio 2008 Extensions, since they all require a server operating system - Sharepoint 2010 will allow you to install on Vista or 7 (x64) though. The Sharepoint assemblies are installed on the machine when you install Sharepoint. Your options here are either:
Use Virtual PC to create a virtual Windows 2003 instance, which you will use for your development. You will install Sharepoint 2007, Sharepoint Services, Visual Studio 2008, and Visual Studio 2008 Extensions for Sharepoint. You will use this virtual instance for your development and testing before deploying to your testing server then production.
If you don't want to do virtualization then you can just use Windows 2003 as your main operating system and follow the same steps above.
If you want to stick with XP, Vista, or 7 without virtualization then you can copy the necessary assemblies from your Sharepoint server to your local machine. You can't use the Visual Studio Extensions, but you will still be able to develop for Sharepoint with the assemblies. This solution will make it a little more difficult to debug though, because you will need to deploy your code to a test Sharepoint server to do it.
EDIT
Visual Studio on its own can't open Sharepoint sites, because it wasn't designed to edit Sharepoint sites. You would use Visual Studio to create web parts, workflows, etc... Sharepoint Designer on the other hand was designed for editing pages and I would recommend using it for site edits.
BUT, if you would still rather use Visual Studio, then you can use the following Visual Studio Add-In to open your Sharepoint site in Visual Studio:
http://spdevexplorer.codeplex.com/
I personally haven't used it, so I can't be certain of how good it is.
Hope this helps.
You don't absolutely need to have Visual Studio to create a SharePoint 2007 site. You can definitely get away with using notepad if your web site doesn't been compiled code. You may have some requirements that require some custom code. It all comes down to your requirements. I try to avoid using Visual Studio for writing features. Even some basic webpart can be written without using any code behind and using out of the box SharePoint controls.
Visual Studio is very handy for source control (connectivity with TFS) and generally structuring your solution to match the requirements of the WSP file. Of course you should use Visual Studio to compile your assemblies. :) The general set up would be Visual Studio with WSP Builder extension installed (look on codeplex ). If then you create the correct folder structure inside your VS project, the generation of your WSP will become much easier. Having said this, you can create wsp files (which is just a renamed cab file) using WSP Builder.
Once you've created your WSP, you can deploy this via stsadm commands (google this). I would suggest having a batch file as a deployment script.
This might help with your initial setup: http://blog.zebsadiq.com/post/SharePoint-2007-installation-in-2010.aspx
p.s. Definitely avoid making any changes through SharePoint designer, you should learn about the consequences before you change any files on your site with it.
Forgot to mention: SharePoint desginer is great for formulating web part html. If you're new, you probably wondering a) where do I find the syntax for a basic out of the box web part b) How do I tweak that syntax to get the results that I need... Best way to do this would be to connect to the site, create a dummy page, add the web part to the page (drag and drop) and tweak it via the SharePoint Designer UI, then once you're satisfied, switch to html view, copy the web part syntax and paste it into the file on the file system. You can then delete the dummy page if you want or use it for configuring other web parts. The point is, though SharePoint designer has its flaws and you may be right to avoid it as your main method of development, its definitely got some features that make it worth while having available while developing.
Take a look here: Walkthrough: Creating a Basic SharePoint Web Part.
I strongly recommend to take a look into Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3 - Mar 2009 CTP
精彩评论