How to create a new class for source code

From Sense/Net Wiki
Jump to: navigation, search
  •  
  •  
  •  
  •  
  • 100%
  • 6.0
  • Enterprise
  • Community
  • Planned

Overview

This article describes how to create a new class for containing custom source code.

Steps

In order to have your code running in Sense/Net you will have to place the compiled code in the bin folder. There are two ways to achieve this.

Option 1: Add new class in the web application

If you have not yet already set up your development environment please read How to set up development environment. Open the web application that is set up as the IIS site for your Sense/Net installation (MyWebApplication) and add a new class to the Code folder. Since your code will be part of the running web application, rebuilding your web application is adequate to have your compiled code running in the bin folder.

Please note, that for creating console application and other external tools you will need to create separate projects and not use the web application referred in How to set up development environment.

Option 2: Add new class in a separate project

  • 1. Create a new class library in Visual Studio 2010 to an arbitrary location and add a new class (if Visual Studio has not yet added one automatically).
  • 2. Add the following references:
  • SenseNet.ContentRepository.dll
  • SenseNet.Portal.dll
  • SenseNet.Storage.dll
  • System.Web.dll
  • 3. After producing your code, compile the project and copy dll-s into the web folder's bin folder.

Although option 2 will work fine and might be easier to start off with, the recommended way is option 1.

Related links

References

There are not external references for this article.