Sitefinity CMS enables you to create custom widgets outside of the SitefinityWebApp project and distribute them between projects as standalone .DLL files. Thus, the custom widget is contained in its own assembly, including its views. This brings convenience in terms of:
When building an MVC widget in external assembly the first step is to add a class library to the Sitefinity solution in Visual Studio.
Next, build the folder structure of your project:
NOTE: You can also create the Class Library in the SitefinityWebApp project and not necessarily in an external project.
Add the core Project Feather and Sitefinity API to the class library. To do this, use the NuGet Package Manager and execute the following commands:
NOTE: Make sure Telerik.Sitefinity.Feather.Core NuGet package in the class library project is the corresponding version as the one in the SitefinityWebApp project.
When creating the MVC views and .CSHTML files in an external assembly , the Code IntelliSense feature of Visual Studio is not enabled and you do not get the suggestions and autocomplete for your code.
NOTE: You need to make sure Telerik.Sitefinity.Feather.Core NuGet package in the class library project is the corresponding version as the one in the SitefinityWebApp project.
To enable Code IntelliSense in Visual Studio:
NOTE: In case you complete this step for all build modes (Debug and Release, by default), the compiler will always output the .DLL files in ~/bin folder, instead of the default bin/Debug and bin/Release folders. As a result, all build configuration modes will output to the one and the same path. If, for the Release build, you do not modify the output path from bin/Release/ to bin/, Code IntelliSense is not enabled for the Release build.
NOTE: This web.config file is only used to enable the Code IntelliSense feature. All other configurations must be made in the web.config file of the SitefinityWebApp project.
You can now create the custom model, controller, and view in the same way as you do with custom widgets you implement in the SitefinityWebApp project. For more information, see Create widgets.
For a full sample demonstrating how to create a widget in an external assembly, check out the KendoBooksWidget sample in the GitHub repository.
Sign up for our free beginner training. Boost your credentials through advanced courses and certification. Register for Sitefinity training and certification.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important