我如何在FormAndList模块又称为UserDefinedTable中更改MsBuildTasks包文件夹的路径?

问题描述

我正在尝试使DNN模块FormAndList(也称为UserDefinedTable)进行编译,同时将其项目包含到解决方案中,该解决方案位于不同的目录(最多3个文件夹)中。然后我编辑了MSBuild.Community.Tasks.Targets文件,以便它可以找到库MSBuild.Community.Tasks.dll的正确路径。而且它适用于Debug模式,但是当我在Release模式下进行编译时,会出现此错误

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.TargetsModulePackage.targets文件与另一个模块进行了比较,该模块可以很好地工作,但是我发现它们之间没有任何关键的区别。

问题在于,在编译过程中,它会尝试查找构建脚本所在的MSBuild.Community.Tasks.dll iside文件夹,但应在D:\Projects\SolutionFolder\packages\MSBuildTasks.1.5.0.235\tools中进行搜索。 我已经编辑了在.csproj和MSBuild.Community.Tasks.Targets中使用path找到的所有位置,但是它仅适用于Debug模式。我想念什么?

解决方法

在您的项目中,您有类似的东西:

<Import Project="..\..\..\packages\MSBuildTasks.1.5.0.235\build\MSBuildTasks.targets" Condition="Exists('..\..\..\packages\MSBuildTasks.1.5.0.235\build\MSBuildTasks.targets')" />

<Import Project="packages\MSBuildTasks.1.5.0.235\build\MSBuildTasks.targets" Condition="Exists('packages\MSBuildTasks.1.5.0.235\build\MSBuildTasks.targets')" />

我认为您不需要这些行。

也尝试使用:

<MSBuildCommunityTasksPath>$(SolutionDir)\packages\MSBuildTasks.1.5.0.235\tools</MSBuildCommunityTasksPath>

enter image description here