我有一个Alea Gpu 的运行时问题,它找不到所有相关文件(我猜是 dll)。作为 .NET 的新手,当它不能开箱即用时,我很难找出正确的路径,所以如果有人可以根据我在下面提供的路径给我一些提示,那将是黄金。
背景
我使用 Nuget 为 VS2017 安装了 Alea Gpu 包,我的项目代码编译并为 Rhino3d 创建了所需的 GrassHopper 组件。该组件在 RT 中也正确显示,但在输入包含 Alea Gpu 调用的“求解器”方法时失败并显示以下错误消息。
错误信息
错误消息(我的瑞典语翻译):
" 1. Solution exception:Cannot find the File or the Assembly Alea, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ba52afc3c2e933d6 or one of its dependencies. Cannot find the file.
"
也许不是最相关的,但这是带有错误消息的失败组件(瑞典语):
调用 .dll (.gha)
运行这个所谓的“GrassHopper 定义”(本质上是 .dll 的 .gha 文件)的代码位于 VS 项目中的以下文件夹结构中,其中还显示了 Alea 包结构。
调用 GrassHopper (.gha) 文件:
C:\Workbench\VS\RILGH_Development\RILGH_CSUtils\RILGH_CSUtils\bin\x64\Debug\RILGH_CSUtils.gha
Alea.targets
文件“...\packages\Alea.3.0.3\Alea.targets 的内容如下:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AleaPackageDir Condition="$(AleaPackageDir) == '' Or $(AleaPackageDir) == '*Undefined*'">$(MSBuildThisFileDirectory)..\</AleaPackageDir>
<AleaResourceDir Condition="$(AleaResourceDir) == '' Or $(AleaResourceDir) == '*Undefined*'">$(OutputPath)</AleaResourceDir>
<AleaDoExtractCTResources Condition="$(AleaDoExtractCTResources) == '' Or $(AleaDoExtractCTResources) == '*Undefined*'">true</AleaDoExtractCTResources>
</PropertyGroup>
<UsingTask
TaskName="Alea.Build.ExtractCTResourcesTask"
AssemblyFile="$(AleaPackageDir)tools\Alea.Build.dll"/>
<Target AfterTargets="AfterBuild" Name="AleaExtractCTResources" Condition="$(AleaDoExtractCTResources) == 'true' Or $(AleaDoExtractCTResources) == 'True'">
<Alea.Build.ExtractCTResourcesTask
ResourceAssemblyDir="$(AleaPackageDir)tools\"
ResourceDir="$(AleaResourceDir)" />
</Target>
<Target AfterTargets="AfterClean" Name="AleaCUDACleanCTResources">
<RemoveDir Directories="$(AleaResourceDir)\Alea.CUDA.CT.LibDevice"/>
<RemoveDir Directories="$(AleaResourceDir)\Alea.CUDA.CT.Native.ARM.B32.Linux"/>
<RemoveDir Directories="$(AleaResourceDir)\Alea.CUDA.CT.Native.X86.B32.MacOSX"/>
<RemoveDir Directories="$(AleaResourceDir)\Alea.CUDA.CT.Native.X86.B32.Windows"/>
<RemoveDir Directories="$(AleaResourceDir)\Alea.CUDA.CT.Native.X86.B64.Linux"/>
<RemoveDir Directories="$(AleaResourceDir)\Alea.CUDA.CT.Native.X86.B64.MacOSX"/>
<RemoveDir Directories="$(AleaResourceDir)\Alea.CUDA.CT.Native.X86.B64.Windows"/>
</Target>
</Project>
.csproj 设置
<ItemGroup>
<Reference Include="Alea, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ba52afc3c2e933d6, processorArchitecture=MSIL">
<HintPath>..\packages\Alea.3.0.3\lib\net45\Alea.dll</HintPath>
</Reference>
<Reference Include="Alea.IL, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ba52afc3c2e933d6, processorArchitecture=MSIL">
<HintPath>..\packages\Alea.3.0.3\lib\net45\Alea.IL.dll</HintPath>
</Reference>
<Reference Include="Alea.Parallel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ba52afc3c2e933d6, processorArchitecture=MSIL">
<HintPath>..\packages\Alea.3.0.3\lib\net45\Alea.Parallel.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="RhinoCommon">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Rhinoceros 5 (64-bit)\System\RhinoCommon.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Grasshopper">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Common Files\McNeel\Rhinoceros\5.0\Plug-ins\Grasshopper (b45a29b1-4343-4035-989e-044e8580d9cf)\0.9.76.0\Grasshopper.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="GH_IO">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Common Files\McNeel\Rhinoceros\5.0\Plug-ins\Grasshopper (b45a29b1-4343-4035-989e-044e8580d9cf)\0.9.76.0\GH_IO.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
... .csproj 中的最后一行:
<Import Project="..\packages\Alea.3.0.3\build\Alea.targets" Condition="Exists('..\packages\Alea.3.0.3\build\Alea.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Alea.3.0.3\build\Alea.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Alea.3.0.3\build\Alea.targets'))" />
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\dotnet\Fody.targets'))" />
</Target>
<Import Project="..\packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" />
希望这是关于路径和在何处进行任何修改的足够信息,以便可以找到运行时文件,给定调用 GrassHopper 文件 (" C:\Workbench\VS\RILGH_Development\RILGH_CSUtils\RILGH_CSUtils\bin\x64\Debug\RILGH_CSUtils.gha
") 的个人的路径以及 GrassHopper 执行平台搜索相关组件 dll 的一般路径 ( Alea 似乎不太关心的路径),“ C:\Program Files\Common Files\McNeel\Rhinoceros\5.0\Plug-ins\Grasshopper (b45a29b1-4343-4035-989e-044e8580d9cf)\0.9.76.0\Components\
”。我已经告诉 GrassHopper 在这两个目录中进行搜索,甚至尝试在这个(最后一个)文件夹中删除 Alea dll 的副本,但没有成功。
问:那么像 Alea 这样的包库是如何根据我可以控制的文件和路径(见上文)实际控制它在运行时使用的路径的?
阅读标记的帖子aleagpu
对我没有帮助,也没有 alea 文档页面上稀疏的故障排除信息(可能是由于是 .Net 和 VS 的新手)
提前致谢。
// 罗尔夫