- Using Visual Studio 2010, open your Windows application solution
- Expand the tree under your solution in the Solution Explorer view
- Under your project, right-click on References and select Add Reference...
- There will be two routes you can pursue for adding the assembly based on your development environment:
- If your developing on an environment with SharePoint installed, you can reference the assembly via the following steps:
- Click on the .NET tab
- Locate and click on the Microsoft.SharePoint item
- Click OK
- If you don't have SharePoint installed in your environment, you can reference the assembly via the following steps:
- Obtain the assembly via the steps that I've covered in my blog post titled Accessing files contained in the Global Assembly Cache
- Create a new folder in your project called "External Assemblies"
- Add the Microsoft.SharePoint.dll file to the new folder
- Under your project, right-click on References and select Add Reference...
- Click on the Browse tab
- Navigate to the "External Assemblies" folder
- Click on the Microsoft.SharePoint.dll file
- Click OK
Once you've associated the SharePoint assembly, the next step will be to make certain your Windows application can run in a 64 bit environment if your app is going to be accessing SharePoint 2010. By the way, if you don't follow these steps, your code will throw an error message that reads "Object reference not set to an instance of an object". Here are the steps that will allow your app to run in a 64 bit environment:
- In the Solution Explorer view, right-click on the project and select Properties
- Under General, locate the Platform target: dropdown and change the value from "x86" to "Any CPU"
- Save the change and build your solution
At this point in time, your Windows application will now be able to run directly on one of your SharePoint WFE servers in order to carry out the admin activities that your power user would like it to execute.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.