0

I am making a custom timer job in VS 2012 that targets .Net Framework 4.5.

I am using namespace Microsoft.SharePoint and Microsoft.SharePoint.Security but problem is it is showing following error:

The type or namespace name 'Security' does not exist in the namespace 'Microsoft.SharePoint' (are you missing an assembly reference?)

Could it be because of .Net Framework 4.5 and that I have to target .Net Framework 3.5? But then this is another problem because even though .Net Framework 3.5.1 is installed (I can see it in Windows Features) but it is not available in VS 2012.

I have even reinstalled .Net 3.5.1 from Windows features but still can't see it in VS 2012.

How do I fix this issue?

0

Few things to check, right click on project and go to Properties -> In Application tab -> make sure Target Framework is 4.5

After this, in the References -> Microsoft.SharePoint (dll).. Press F4 (properties) and make sure Version is 15.0.0.0 and path given is C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.dll and Runtime version is v4.0.30319

  • I cannot change Target Framework to something else because only 4.5 is available in drop down menu. Also the Microsoft.SharePoint dll is using version 15.0.0.0 and runtime version is 4.0.30319 – Frank Martin Nov 16 '14 at 12:08
  • Taking a clue from your comment, I manually added Microsoft.SharePoint.Security.dll and now it is working. But I wonder why it was not showing it in list of references when I right click and select "Add Reference" – Frank Martin Nov 16 '14 at 12:12
  • Yes, sometimes the dlls like Publishing, Navigation etc. are not by default shown.. You need to browse and add them manually.. Glad your problem is gone :) – Arsalan Adam Khatri Nov 16 '14 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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