0
votes

I'm writing a DNN 9 custom module using ASP.NET MVC. My development site is setup at dnndev.me and the module is located in C:\websites\dnndev.me\DesktopModules\MVC|MyModule

My DNN manifest is as follows:

<dotnetnuke type="Package" version="5.0">
<packages>
<package name="Onboarding" type="Module" version="00.00.05">
  <friendlyName>Onboarding</friendlyName>
  <description>Onboarding</description>
  <iconFile>~/Icons/Sigma/Software_32X32_Standard.png</iconFile>
  <owner>
    <name>example.com</name>
    <organization>example.com</organization>
    <url>https://example.com/</url>
    <email>[email protected]</email>
  </owner>
  <license src="License.txt"></license>
  <releaseNotes src="ReleaseNotes.txt"></releaseNotes>
  <dependencies>
    <dependency type="CoreVersion">08.00.00</dependency>
  </dependencies>
  <components>
    <component type="Script">
      <scripts>
        <basePath>DesktopModules\MVC\MyModule</basePath>
        <script type="Install">
          <path>Providers\DataProviders\SqlDataProvider</path>
          <name>00.00.01.SqlDataProvider</name>
          <version>00.00.01</version>
        </script>
        <script type="UnInstall">
          <path>Providers\DataProviders\SqlDataProvider</path>
          <name>Uninstall.SqlDataProvider</name>
          <version>00.00.01</version>
        </script>
      </scripts>
    </component>
    <component type="ResourceFile">
      <resourceFiles>
        <basePath>DesktopModules/MVC/MyModule</basePath>
        <resourceFile>
          <name>Resources.zip</name>
        </resourceFile>
      </resourceFiles>
    </component>
    <component type="Module">
      <desktopModule>
        <moduleName>Onboarding</moduleName>
        <foldername>Onboarding</foldername>
        <businessControllerClass>MySite.Modules.Onboarding.Components.FeatureController</businessControllerClass>
        <supportedFeatures />
        <moduleDefinitions>
          <moduleDefinition>
            <friendlyName>Onboarding</friendlyName>
            <defaultCacheTime>0</defaultCacheTime>
            <moduleControls>
              <moduleControl>
                <controlKey />
                <controlSrc>Example.Modules.Onboarding.Controllers/Onboarding/Index.mvc</controlSrc>
                <supportsPartialRendering>False</supportsPartialRendering>
                <controlTitle />
                <controlType>View</controlType>
                <iconFile />
                <helpUrl />
                <viewOrder>0</viewOrder>
              </moduleControl>
              <moduleControl>
                <controlKey>Edit</controlKey>
                <controlSrc>Example.Modules.Onboarding.Controllers/Onboarding/Edit.mvc</controlSrc>
                <supportsPartialRendering>False</supportsPartialRendering>
                <controlTitle>Edit Onboarding Records</controlTitle>
                <controlType>Edit</controlType>
                <iconFile />
                <helpUrl />
                <viewOrder>0</viewOrder>
                <supportsPopUps>True</supportsPopUps>
              </moduleControl>
              <moduleControl>
                <controlKey>Settings</controlKey>
                <controlSrc>Example.Modules.Onboarding.Controllers/Settings/Settings.mvc</controlSrc>
                <supportsPartialRendering>False</supportsPartialRendering>
                <controlTitle>Onboarding Settings</controlTitle>
                <controlType>Edit</controlType>
                <iconFile />
                <helpUrl />
                <viewOrder>0</viewOrder>
              </moduleControl>
            </moduleControls>
          </moduleDefinition>
        </moduleDefinitions>
      </desktopModule>
    </component>
    <component type="Assembly">
      <assemblies>
        <assembly>
          <name>Onboarding.dll</name>
          <path>bin</path>
        </assembly>
        <assembly>
          <name>RestSharp.dll</name>
          <path>bin</path>
        </assembly>
        <assembly>
          <name>EntityFramework.dll</name>
          <path>bin</path>
        </assembly>
        <assembly>
          <name>EntityFramework.SqlServer.dll</name>
          <path>bin</path>
        </assembly>
        <assembly>
          <name>Newtonsoft.Json.dll</name>
          <path>bin</path>
        </assembly>
      </assemblies>
    </component>
  </components>
</package>

The module won't install despite ensuring that all assemblies are in the bin folder under dnndev.me.

What must I do to rectify this issue?

2
Are you using the MVC module dev template from Chris Hammond? If so, when you do a release build to create the package, is it putting those dependencies into the /bin folder in the zip package?Fix It Scotty
@DotNetNuclear Yes, I'm using his development template. The dependencies / assemblies are not being placed in the bin folder within the install zip file. I think I need to use the dependency type="Type" as suggested. Will update further.SidC

2 Answers

3
votes

If you built your MVC module using the Chris Hammond template, you will have the msbuild process for packaging the module that is driven by the file: BuildScripts/ModulePackage.targets

In that file, there is a line of code:

<Copy SourceFiles="$(MSBuildDnnBinPath)\$(AssemblyName).dll" DestinationFolder="$(MSBuildProjectDirectory)\Package\bin"/>

That is responsible for picking up the module's assembly in your local install's bin folder and copying it to the package folder that gets zipped. There is no automated step for including other custom dlls in there. This line occurs twice: once for the 'source' package and the other for the 'install' package.

Most of the time, I will just update this script to include my dependencies. Example:

<Copy SourceFiles="$(MSBuildDnnBinPath)\$(AssemblyName).dll" DestinationFolder="$(MSBuildProjectDirectory)\Package\bin"/>
<Copy SourceFiles="$(MSBuildDnnBinPath)\Onboarding.dll" DestinationFolder="$(MSBuildProjectDirectory)\Package\bin"/>

This isn't the most elegant solution as you need to hardcode your dependencies in the build script. But it works for simple modules. If you know a little about msbuild, you could use a copy step that includes all dlls in a folder and move your dependencies to a single folder and include all of them from the folder.

0
votes

The way you do it means that the assemblies are included in your install package. To test if the assembies are installed (in the bin folder), you need to add a dependency, but there is no dependency to an assembly containing a version number or something alike. The trick is to add a dependency to a type defined in the assembly, e.g.

<dependency type="Type">DocumentFormat.OpenXml.Extensions.WorksheetWriter</dependency>

AFAIR it is important that the value of the type attribute is case-sensitive, so it has to be "Type", and not "type" or "TYPE".