Thanks to Chris Hammond it is possible a programmer to create a Visual Studio Project for developing DotNetNuke module fast and easy by using a DNN Project Template for Visual Studio.
But, as the Dr. Adizes summarizes in his book Managing Corporate LIfecycle “All problems are created by disintegration, and the disintegration occurs because the subsystems that comprise any system do not change synchronically “, we might experience some difficulties in the context of the topic.
Developing DotNetNuke module: Difficulties in creating a Visual Studio project with DNN Project Templates
DotNetNuke Platform, the .NET Framework and the Visual Studio Templates for DNN have asynchronized development. Because of that in some cases after we create DNN project under the Visual Studio, we receive some errors after we try to compile an empty project.
I experience a similar scenario. I installed DotNetNuke Platform 9.8 (which requires .NET Framework 4.7.2+), and I tried to used DNN Project Templates V10.1 with Visual Studio 2019 Community V16.8.3.
(You can find an instructions about how to create a Visual Studio project from a DNN template here)
Along the way I faced with the following errors:
- DNN project module can’t compile
DotNetNuke dll is missing.
- CS0246 Error still appear even though the DotNetNuke.dll is now imported correctly
It is required a .NET Framework to be changed to version 4.7.2 or higher. - Running the project doesn’t redirect to the DNN website but to the folder of the module
Go to the properties of the VS project and change the start URL. - DNN website was unable to run (an error occurred)
There was an virtual directory created for the newly created DNN Module that has to be removed.
DNN project module can’t compile
After I tried to build the project I received “Error CS0246 The type or namespace name ‘DotNetNuke’ could not be found“.
- You will need to remove the current reference to the DotNetNuke library;
- I added a new reference to the DLL which can be found in the bin folder of the DNN website;
- I replaced the reference to the Microsoft.ApplicationBlock.Data as well. This DLL can be found under the bin folder as well. DNN 9.8 uses this helper library to access data hosted by MS SQL Server.
After the mentioned steps the references to the mentioned DLLs were OK, but the error CS0246 were still here.
CS0246 Error still appear even though the DotNetNuke.dll is now imported correctly
To resolve this issue I had to change the .NET Framework for the Visual Studio project. The template VS Project Template creates and project with .NET Framework 4.5.1 which is not compatible with the version of the DotNetNuke that I tried to use.
The minimum version I need to set is 4.7.2. When I set the the new version of the framework the CS0246 were resolved.
Not able to change the .NET Framework of the Visual Studio project
DotNetNuke 9.8 is based on .NET Framework 4.7.2 and your DNN Project for developing a DNN module have to be at least the version 4.7.2.
In a scenario in which your VS project doesn’t have a web.config file, such as the case when you create a VS project for a DNN module, you might experience exception from Visual Studio.
Visual Studio will complain that it can’t write into web.config because doesn’t exist. usually if Visual Studio creates web.config file and update the latest changes that you made, such as the case of changing the target framework. But in a case in which Visual studio don’t have permission to create a new file, you are the one who will need to create it before you change the target framework.
Running the Visual Studio project doesn’t redirect to the DNN website but to the folder of the module
When a VS project is created by using the DNN Project Template, it set the web server setting to Local IIs and sets the Project URL to the folder of the newly created module.
If you want the DNN website to be started after build and run from the Visual Studio, you will need to set Start URL attribute to the address of your DNN website (the one the you set when you created the website on your web server (IIS).
DNN website was unable to run (an error occurred)
While you create a VS Project with the DNN Project Templates, it will be created a virtual directory for the newly created module and that will produce an error when you will try to run the VS project (run the DNN website).
To resolve this issue it will be necessary to remove the virtual directory for the newly created module.
You need just to remove the virtual folder and the DNN website should be able to run.
Read the DNN Project Templates documentation to easy start developing DNN module
After you create a DNN module project in Visual Studio by using DNN Project templates, you will be able to see a one page document with very useful instructions about how you should finish the configuration of the project, but even with those instructions because of the several reasons you might experience some additional issues.
I hope this article provides some additions to that help documentation for some specific scenarios.
Happy developing DotNetNuke module!
Be the first to comment