【发布时间】:2020-09-03 14:50:21
【问题描述】:
我正在尝试编译 DNN 模块 FormAndList(又名 UserDefinedTable),同时我将它的项目包含在解决方案中,该解决方案放置在不同的目录中(3 个文件夹以上)。我编辑了MSBuild.Community.Tasks.Targets 文件,以便找到库MSBuild.Community.Tasks.dll 的正确路径。它适用于调试模式,但是当我在发布模式下编译它时,它给了我这个错误:
The "MSBuild.Community.Tasks.XmlRead" task could not be loaded from the assembly D:\Projects\SolutionFolder\Host\DesktopModules\UserDefinedTable\BuildScripts\MSBuild.Community.Tasks.dll. Could not load file or assembly 'file:///D:\Projects\SolutionFolder\Host\DesktopModules\UserDefinedTable\BuildScripts\MSBuild.Community.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
我将MSBuild.Community.Tasks.Targets 和ModulePackage.targets 文件与另一个模块进行了比较,效果很好,但我没有发现它们之间有任何重要的区别。
问题是在编译期间它试图找到构建脚本所在的MSBuild.Community.Tasks.dll iside 文件夹,但它应该在D:\Projects\SolutionFolder\packages\MSBuildTasks.1.5.0.235\tools 中搜索它。
我已经编辑了我在 .csproj 和 MSBuild.Community.Tasks.Targets 中找到的所有路径,但它仅适用于调试模式。我错过了什么?
【问题讨论】:
-
你能发布你的 csproj 文件吗?还有packages.config
-
更新。这是带有代码的github链接。 github.com/NetLS2013/DNN_FormAndList_modified。在尝试使模块从 sln 目录中获取包时,我修改了 .csproj、MSBuild.Community.Tasks.Targets 和 packages.config。
标签: c# msbuild dotnetnuke