DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Referencing DNN controls in module development

Sort:
You are not authorized to post a reply.





New Around Here





    Our company is currently evaluating DNN as a potential solution for our intranet CMS needs. We have in-house .NET devs and we are all struggling to get the module dev environments setup properly. I have spent about 16 hours so far trying to solve our current challenge, which is that we are unable to reference the DotNetNuke.dll library from within Compiled Module projects in order to use the DNN controls on the Visual Studio design surface for ascx project items.

    On my Windows 10 dev machine, I have IIS and SQL Server running and the DNN_Platform_9.10.1_Install package installed, configured and running without issue and aliasing dnndev.me. Additionally, I have Visual Studio Community 2019 installed, as well as the Christoc DNN 9 vsix templates.

    I create a new project using the "DNN (DotNetNuke) 9 C# Compiled Module" template targeting .NET 4.7.2 and set the location to c:\inetpub\wwwroot\DesktopModules with the solution and project files in the same directory and verify Local Dev URL is dnndev.me. My project (named ModTest) is successfully created at DekstopModules\ModTest.

    Verified no virtual directories were created. Verified correct Start URL and server options as per the template docs.

    Build Debug. Switch to Release and build Release. - No Issues so far. No errors and only one warning about version strings.

    So I crack open View.ascx and add a DNN TextEditControl to the markup and build again.

    The project builds but there are 14 errors generated stating the namespace DotNetNuke could not be found. Additionally, intellisense does not work for the controls.

    Image: https://imgshare.io/image/dnnerror.puJdue

    What are we missing?






    New Around Here





      So I was finally able to resolve this with the advice from https://rockpaperweb.com/...known-element-error/

      Step 1: Add a bin folder

      Create a bin folder for the project. If you’re project is at /DesktopModules/MyProject then create the folder /DesktopModules/MyProject/bin

      Step 2: Add the wrapper dll’s to the bin folder

      Add the following dll’s to the bin folder:

      1. DotNetNuke.dll
      2. DotNetNuke.Web.dll
      3. DotNetNuke.WebControls.dll
      4. Telerik.Web.UI.dll

      No need to register, or reference, them.  Just copy and paste right into the folder.  If you have multiple custom module projects you need to add this bin folder with the dll’s to each and every project.

      Balder, but wiser now.






      Growing Member





        I tell visual studio to install project within a working dnn site(named dnndev.me locally on my dev machine) in desktopmodules folder. 

        If you are using chris's templates there is a window the pops up after you named your project - I DO NOT Use chisdoc.modules as namespace - I use DotNetNuke.Modules.  Never had a problem with virtual directories in desktopmodules folder or anywhere.  Also, I'm using dnn 9.7.2 so chris sets dnn version 9.8 in the templates I use for : <dependencies>
                <dependency type="CoreVersion">09.07.02</dependency>
              </dependencies> - another thing to watch out for.

        Next thing is that buildscripts folder modulepackage.targets.dosnt include all the files needed for a source project : <SourceInclude Include="**\*.dnn" />
                <SourceInclude Include="**\*.config" />
                <SourceInclude Include="**\*.licx" /> maybe dont need this one - but I do.

         

        Because I like to build module in release mode after I make above adjustments - then copy source package, and place it somewhere, then delete folder in site and install source project in dnn dite names dnndev.me and continue building from there.

         






        New Around Here





          I found that if I create a master solution which contains the dev site wwwroot that everything goes much smoother.

          I.E., after installing dnn on my dev box, I create a blank VS solution. The first thing I add to my solution is a Web project (add existing) that points to the dev site in IIS. Then I create skin and module projects as per the normal documentation, but as additional projects within my master solution.

          Doing it this way, I have come across zero issues with referencing site dlls, using the VS designers, etc. I spent days looking for answers but only found others with the same issue and no real resolve. Hopefully, this helps someone.

           

          You are not authorized to post a reply.

          These Forums are dedicated to the discussion of DNN Platform.

          For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

          1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
          2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
          3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
          4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
          5. No Flaming or Trolling.
          6. No Profanity, Racism, or Prejudice.
          7. Site Moderators have the final word on approving / removing a thread or post or comment.
          8. English language posting only, please.

          Would you like to help us?

          Awesome! Simply post in the forums using the link below and we'll get you started.

          Get Involved