Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Salve! Having created a web-application under the Sharepoint (2010) Site's directory in iis7, I now need to use the assemble microsoft.sharepoint in my web-application. How can I reference that?

I can confirm that the reference is being inherited from the parent's (sp) web.config, because if I add the reference, asp.net complains that there is a duplicate entry.

What can I do?

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

My recommendation would be that you shouldn't.

You should start from scratch again and develop your Web-Application to be deployed below the _layouts folder in SharePoint using a WSP package and all of your code should be in code behind which is compiled into a dll deployed to the GAC.

You can technically get your solution to work, but it's a hack, that won't work when an extra server is added.

share|improve this answer
    
Good advice. I will likely never add another server. The thing I have against using the _layouts folder is that if I have issues with my web application, it won't crash the entire sharepoint portal. I don't have a dev server (too poort). –  BGM May 4 '12 at 20:47
1  
If you want to use SPContext.Current then you should be in the same ApplicationPool as SharePoint and then you'll bring down SharePoint anyway. If not then why in the same IIS directory? And yes you apparently have a dev server, but you're just also running production on it. Maybe take a look at CloudShare –  Per Jakobsen May 4 '12 at 20:55
    
Another reason this is bad - as soon as another CU or Service Pack is applied, there's every chance it'll wipe out the changes you made in IIS. –  James Love May 4 '12 at 21:11
    
Do you mean that it will remove the web-application I created in iis? As for application pool, I have it running in a separate application pool that uses the same credentials. –  BGM May 4 '12 at 21:35
1  
A lot your questions suggest you need to pick up a course on SharePoint Development. I'd get started by working through the Channel9 Development stuff on MSDN: msdn.microsoft.com/en-us/gg620703 –  James Love May 4 '12 at 22:19
show 6 more comments

Add the SharePoint.dll as a reference in your project: \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.dll

I assume this is SharePoint 2010.

share|improve this answer
    
Yes, it is 2010, I added that note to my question after I saw your answer. My question is how to do that - add the reference, that is. –  BGM May 4 '12 at 20:51
add comment

This seems to work: copy the microsoft.sharepoint.dll from the directory indicated above, by Kolten (\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.dll) and put it in the bin folder of your web-application. Now you can add using microsoft.sharepoint to your code-behind and not get an error page.

Here is a relevant thread: http://stackoverflow.com/questions/1629245/microsoft-sharepoint-and-microsoft-office-namespace-issue

I post this here because it is, indeed, an answer, and it does work. However, I think Mr. Jakobsen's answer is better.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.