0% found this document useful (0 votes)
21 views4 pages

1 - A) SiteCoreVisualStudio

Sitecore visual studio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views4 pages

1 - A) SiteCoreVisualStudio

Sitecore visual studio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

sdn5print http://sdn5.sitecore.net/Articles/API/Using%20Visual%20Studio...

Using Visual Studio .Net


Table of Contents
1. Creating a project
2. Add code-behind
3. Enable IntelliSense

1. Creating a project
Create a Visual Studio project (this should generally be done only once for each instance of Sitecore).

To create the project:

1. Open Visual Studio .NET.


2. From the File menu select New Project.
3. Select the language you would like to use (Sitecore internally uses C# exclusively).
4. Select New Project in Existing Folder.

5. Enter a name for your project. Names should not begin with numbers or contain special characters.
6. Enter the address of the website hosting the project, typically http://localhost in development.

7. In Solution Explorer, press the Show All Files button.

1 of 4 16/2/09 9:12 PM
sdn5print http://sdn5.sitecore.net/Articles/API/Using%20Visual%20Studio...

8. Right-click on References and choose Add Reference.

9. Browse to the /bin/ folder of the project and select Sitecore.Kernel.

10. Right-click on /web.config and select Include In Project.

11. Right-click on the /xsl/ directory and select Include in Project.


12. Open the /layouts/ directory, right-click on each Layout or Sublayout and choose Include in Project.

2 of 4 16/2/09 9:12 PM
sdn5print http://sdn5.sitecore.net/Articles/API/Using%20Visual%20Studio...

Layouts typically do not contain code-behind; Sublayouts commonly contain code-behind. To be prompted to create a
code behind, exclude a file from the project temporarily, then add it again.
13. Optionally, open the /sitecore modules/ directory in Windows Explorer and create one or more folders as needed. Return
to Visual Studio, refresh Solution Explorer and include these directories in the project.
14. Right-click on the name of the project in Solution Explorer and choose Properties.

Set Assembly Name and Default Namespace.

3 of 4 16/2/09 9:12 PM
sdn5print http://sdn5.sitecore.net/Articles/API/Using%20Visual%20Studio...

2. Add code-behind to layouts or sublayouts.


To add code-behind to a Layout:

1. Open the project in Microsoft® Visual Studio .NET.


2. Open Solution Explorer and navigate to the folder containing the Layout (usually /layouts).
3. If the Layout is already included in the project, right-click on it and exclude the Layout.
4. Right-click on the Layout and add it to the Project; Visual Studio will suggest that a code-behind be created.

3. Enable IntelliSense
NOTE: The following information does not apply to Visual Studio 2005. Microsoft changed the file format for
IntelliSense in VS 2005. We do not currently have an IntelliSense source for Xml Controls and Layouts for Visual
Studio 2005.

Perform the following steps to enable IntelliSense in Visual Studio when editing Xml Controls and Xml Layouts.

Copy the following file:

/sitecore/shell/Schemas/Sitecore.xsd

from the Sitecore web root to the Visual Studio schema directory. The Visual Studio schema directory is usually:

c:\program files\Microsoft Visual Studio .NET 2003/Common7/Packages/Schemas/xml/

In the Xml Control or Xml Layout file, make sure the following Namespace is included:

xmlns="http://schemas.sitecore.net/Visual-Studio-Intellisense"

For example:

<?xml version="1.0" encoding="utf-8" ?>


<control xmlns="http://schemas.sitecore.net/Visual-Studio-Intellisense">
<MyControl>
...

Copyright 1999 - 2006 Sitecore A/S. All rights reserved.


Sitecore is a trademark of Sitecore A/S. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore A/S.

4 of 4 16/2/09 9:12 PM

You might also like