Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

8 Apr 2013

Working with SharePoint 2010 Projects on Visual Studio Without Installing The Server


After spending unreasonable amount of time searching through the internet, reading blog posts and forums the only answer that I found to solve this problem was, “it is not possible, you have to install sharepoint server 2010 on your machine”, and if your operating system is windows 7, then the best thing you have to do is to find and install the beta version of sharepoint server 2010.
First step, from server machine (production server) run regedit and export the folder
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Shared Tools/Web Server Extensions/14.0]
Second step, on your local development machine, import the regedit file that you exported before or you can just only double click on exported regedit file. it will create a “Web Server Extensions” folder and the 14 hive registry for you.
 Finally, You will now be able to create a Sharepoint Project in Visual Studio 2010. When asked where the Sharepoint server is, tell Visual Studio it’s on your local machine. You will not be able to deploy locally (unless you actually *do* have Sharepoint installed), but you will now be able to create Sharepoint projects, and will be able to build package them.
NOTE: to be able to work on sharepoint developmentm for sure you will be need to add some sharepoint server assemblies to your project which will be not on your development machine like Microsoft.Sharepoint.dll.
I suggest you to copy those assemblies from your server machine (production server) and add them as references to your projects.
All SharePoint Server 2010 assemblies can be found under:
C:Program Files/Common Files/Microsoft Shared/Web Server Extensions/14/ISAPI
 Testing the environment
Create a project. To test, I simply created a Blank Sharepoint Project (first one was sandboxed, second one was full trust (farm)), and added a webpart with a label displayed.

protected override void CreateChildControls()
{
      base.CreateChildControls();
      Label l = new Label() { Text = "BLAH!" };
      this.Controls.Add(l);
}
Build the solution (so that you generate .pdb files) and then right click on the project in the Solution Explorer and choose “Package”. This will generate a .wsp file.
Now deploy your sandbox and the farm solutions as usual and see the results.

7 Apr 2013

Missing microsoft.sharepoint.dll in Visual Studio 2010 on client Win7 Pro64

Copy microsoft.sharepoint.dll from C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\ASPI on Sharepoint Server to C:\Program Files (x86)\Common Files\microsoft shared\Web Server Extensions\14\BIN on Win7 Pro64 then reference it from solution.

Total Pageviews