如何在DNN清单中正确引用程序集? [英] How to Properly Reference Assemblies in DNN Manifest?

查看:15
本文介绍了如何在DNN清单中正确引用程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ASP.NETMVC编写一个DNN 9自定义模块。我的开发站点安装在dnndev.me上,模块位于C:websitesdnndev.meDesktopModulesMVC|MyModule

我的DNN清单如下:

<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>info@example.com</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>DesktopModulesMVCMyModule</basePath>
        <script type="Install">
          <path>ProvidersDataProvidersSqlDataProvider</path>
          <name>00.00.01.SqlDataProvider</name>
          <version>00.00.01</version>
        </script>
        <script type="UnInstall">
          <path>ProvidersDataProvidersSqlDataProvider</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>

即使确保所有程序集都位于dnndev.me下的bin文件夹中,该模块也不会安装。

我必须做些什么才能纠正此问题?

mvc

如果您使用Chris Hammond模板构建推荐答案模块,您将拥有用于打包由以下文件驱动的模块的msBuild过程:BuildScript/ModulePackage.Target

在该文件中,有一行代码:

<Copy SourceFiles="$(MSBuildDnnBinPath)$(AssemblyName).dll" DestinationFolder="$(MSBuildProjectDirectory)Packagein"/>
负责获取本地安装程序的bin文件夹中的模块程序集,并将其复制到压缩后的程序包文件夹中。不存在用于在其中包括其他定制DLL的自动步骤。此行出现两次:一次用于"源"程序包,另一行用于"安装"程序包。

大多数情况下,我只会更新此脚本以包括我的依赖项。示例:

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

这不是最好的解决方案,因为您需要在构建脚本中对依赖项进行硬编码。但它适用于简单的模块。如果您对msBuild略知一二,则可以使用复制步骤,该步骤包括文件夹中的所有DLL,并将依赖项移动到单个文件夹并包括该文件夹中的所有依赖项。

这篇关于如何在DNN清单中正确引用程序集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆