Add the Smartsite.Core namespace:

C# CopyCode image Copy Code
using System;
using Smartsite.Core;

4. Derive from a Smartsite Module Class.

Check the module class hierarchy for the best starting point.

C# CopyCode image Copy Code
namespace MyMacroModules
{
    class HelloWorld: Module {
        public override void Execute() {
            Result.Append("Hello World!");
        }
    }
}
As you can see, the Execute method can be overridden to add our main business logic. The Result object can be used to set the return value of the SXML macro. The macro above, when compiled, would be available under the following syntax:
Smartsite SXML CopyCode image Copy Code
<se:helloworld />

5. Change the build settings

To debug your macro and viper components in the TestSuite environment, a few settings must be used. First, the output path of our component must be set to the bin folder of our website:

6. Change the Debug settings

Then, under Debug, we must choose the Smartsite.TestSuite.exe as the application to run when starting a debug session.

You can find this executable in the Bin folder under the web root of your site.

7. Start debugging

Press F5 to start debugging your project. The Smartsite TestSuite should start and load your site (configured in the output path in step 5) 

8. Start editing a page

Now, we are ready to create some SXML that will call our project code:

 

9. Render the page

Press F5 and expect to see something like this: