1. In Visual Studio click File, click on New Project and select .NET Franework 3.5 as the target frame work, select SharePoint 2010 under installed template, select the Empty SharePoint Project and give the project name SharePointDllFileExample and then click OK. See in fig
2. Give the SharePoint URL and port and choose Deploy as farm solution and then click on Finish. See in fig
3. Now right click on solution explorer =>add =>New Item. See in fig
4. Now Select Class under code of Visual c# and give the class name classTobecalledUsingDll.cs and click OK. See in fig
5. Now write the following code in this class. See in fig
6. Now build the project from solution explorer. See in
7. Now you can see you classTobecalledUsingDll.dll into Projects\SharePointDllfileExample\SharePointDllfileExample\bin\Debug\ directory
8. Now add your assembly to global assembly cache (GAC). Either you can drag from debug (C:\Users\cjuser\Documents\VisualStudio2010\Projects\SharePointDllfileExample\SharePointDllfileExample\bin\Debug\) into C:\Windows\assembly directory. Otherwise you can use commndline utility.
9. Now you have to register your assembly into the project where you want to use. In my case I am using it in master page. Add below code to the top of the page.
<%@ Assembly Name=”#strong name#” %>
<%@ Import Namespace=”#assembly name# “%>
10. Replace #strong name# with the strong name of the class and “#assembly name# with the name of assembly of the class. To find strong name follow this link.
11. Otherwise go to C:\Windows\assembly and select classTobecalledUsingDll.dll file right click on it and select properties. See in fig
12. You will get assemblyname, Version ,Culture and publickeyToken In this case it will look like this
I am Navneet Singh, Working at C3it software solutions pvt. ltd. in Pune. My core skills are SharePoint 2013, Office 365, SharePoint 2010, SharePoint Designer, SharePoint Designer Workflow, Nintex Workflow, Infopath, Webpart, CSOM/SSOM, Power-shell, C#, ASP.NET and SQL Server.
Your FREESharePoint Online Ebook is on its way to your Email Inbox. **************** You will get notification on FREE SharePoint online training, SharePoint webinars, Video Tutorial & also latest FREE PDF tutorials