Monday, July 27, 2015

Sitecore - Add Visual Studio Project to existing sitecore instance

Sitecore - Add Visual Studio Project to existing Sitecore instance


Some of you have created fresh Sitecore instance for check some Sitecore functionalities like Web Forms For Marketers, Email Campaign Manager, etc.
Now If you wan't to add some extended capabilities or you want to add your code you have to create a Visual Studio Project to this existing Sitecore instance.

This is how you can do it.
I assume that you have a Sitecore instance. I have created a fresh instance as SitecoreFresh. (If you don't have one and if you want to try this out you can easily create a Sitecore instance using the Sitecore Instance Manager : Sitecore Instance Manager)

1. Open Visual Studio.
2. Go to new project. Under Visual C# section select ASP.NET Web Application.
3. Give Name, Location and Solution name as you desire.
4. From template selection section select 'Empty' and select the 'Web Forms' check box. (This is because the Visual Studio will add the required references to your project.). Select Ok.

5.  Go to the location you create this project.
6. Copy the .sln file and paste it inside the folder where your Sitecore instance root.

7. Go again to the location where you create the project (Step 5).
8. Go inside the folder which contain the website.
9. Copy the 'Properties' folder and '.csproj' file and paste it inside the website folder of your fresh Sitecore instance.
10. Double click on the copied .sln file on your Sitecore fresh folder.
11. Visual Studio will complain the project cannot be load. This is because the opened sln file is belong to the project that you created at step 4.
12. Remove the broken project from the Solution Explorer.
13. Right click on the solution at Solution Explorer and Add Existing Project.
14. Select the csproj file on your fresh instance folder and Open it.
15. This will load your fresh Sitecore project to the Solution Explorer.
16. Go to references and add the Sitecore.Kernal.dll. (Create a lib folder and copy the dll to that folder and get it from there).
17. Include the folder and files that you want in the project using the 'Show All Files' function in Visual Studio solution explorer.

Ok, we are all done here. You are good to go.

No comments:

Post a Comment