Templateless Module Development

2019-07-28 22:30发布

Throughout the internet documentation for DotNetNuke is far and wide, this in itself is quite useful. However one hurdle exist and I can't appear to solve it. How do you do DotNetNuke Module development without Chris Hammond's Template?

This template has become so widely accepted and utilizes that no other documentation exists.

I've already accomplished the following:

  • Configured SQL Server Database
  • Configured Internet Information System (Bindings)
  • Modified the System32 Host File (For local IP to reflect web-site Name)
  • Installed the MSBuild Community Task
  • Installed DotNetNuke Instance

Everything is installed and in place, now I have open DotNetNuke's Site into Visual Studio and configure my project to actually build the module.

I figured if I reference the .dll for DotNetNuke that should suffice, but the Web Forms Project loads all this extra garbage that impacts the development.

Could someone outline the proper way to build your environment from scratch without the template for Visual Studio?

3条回答
We Are One
2楼-- · 2019-07-28 23:20
  1. Setup a DNN Development environment, even if you aren't using my templates I recommend the same dev environment approach http://www.christoc.com/Tutorials/All-Tutorials/aid/1
  2. Using Visual Studio create a new Web Application Project, with a location of /desktopmodules/ in your DNN dev environment. (Follow Step 9 of this tutorial http://www.christoc.com/Tutorials/All-Tutorials/aid/4)
  3. Remove everything that Visual Studio puts into the WAP project (folders, web.config, etc).
  4. Add an assembly reference to DotNetNuke.dll in the website's BIN folder
  5. Right click on the Project properties and set properties on the project to have the Build location be the website's BIN folder (../../bin)
  6. Change the web tab have the following properties set

    IISUrl:http://dnndev.me/desktopmodules/MODULENAME

    OverrideIISAppRootUrl:True

    IIS App Root URL:http://dnndev.me

  7. Add an ASCX file to your project. (view.ascx)
  8. Change the BASE class for the ASCX file to inherit from PortalModuleBase
  9. Compile your module
  10. Register the module with DNN (host/extensions)
  11. Add the Module to a page.

TL;DR

  1. Save yourself the trouble of steps 2-8 and 10 by using the template.
查看更多
闹够了就滚
3楼-- · 2019-07-28 23:26

Honestly, the best bet if you want is use Chris's template as a base, and edit it to get it as plain as you want it to be.

I have a plain template that only has the MSBuild configuration in it as I don't even have local copies of DNN on any of my development machines.

The key magic pieces of his template is the MSBuild stuff, and I go one step further and use NuGet to manage the packages/references to DNN that way I don't have any other DNN files locally.

查看更多
再贱就再见
4楼-- · 2019-07-28 23:28

This is what I used to do BEFORE I started using a template. Very similar to @bdukes but rather than developing in the DesktopModules folder, I like to keep my modules in their own projects outside DNN.

  1. In Visual Studio, select File -> New -> Project.
  2. Select '.NET Framework 4' from the version dropdown and C# -> Web from the tree pane on the left then 'ASP.NET Empty Web Application'.
  3. Delete the web.config file.
  4. Add a reference to the DotNetNuke dll.
  5. Add a new user control to the project, this will be your main view for your project.
  6. Make sure the user control inherits from DotNetNuke.Entities.Modules.PortalModuleBase instead of System.Web.UI.UserControl.
  7. Build the project in Visual Studio.
  8. Right click on the Project in Visual Studio and select 'Open Folder in File Explorer'.
  9. Copy the DLL of your project into the bin folder of your dotnetnuke instance.
  10. Paste the project folder in your DotNetNuke instances DesktopModules folder.
  11. Delete all files except the user control you created from the folder you pasted under DesktopModules.
  12. Login into your DNN instance.
  13. Navigate to Host -> Extensions -> Create New Module.
  14. Select 'Control' from the dropdown.
  15. Select the module folder (not owner folder) you pasted in DesktopModules.
  16. Give your module a name and tick the option 'Add Test Page'.
  17. Click 'Create Module'.

You will then be taken to a test page with your new module running with only an empty user control. You can then add controls into the modules folder, rebuild and copy the new DLL into DNN's bin folder and you'll see the changes in DNN.

I would then go back to Host -> Extensions and click edit (the pencil) next to the newly created module. At the bottom of the page there is a 'Create Package' button. Follow the prompts until you're at the preview manifest file. Copy this as your modules manifest file and add it to your project.

Don't forget to add any new views, edits, settings controls to the module definitions and re-create the manifest. (Host -> Extensions and click edit (the pencil) next to the module -> Module Definitions heading)

查看更多
登录 后发表回答