Plugins.Halcon.csproj 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <Project Sdk="Microsoft.NET.Sdk">
  2. <PropertyGroup>
  3. <TargetFramework>net48</TargetFramework>
  4. <Nullable>disable</Nullable>
  5. <UseWPF>true</UseWPF>
  6. <Platforms>x64</Platforms>
  7. <PlatformTarget>x64</PlatformTarget>
  8. <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  9. <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
  10. <RootNamespace>Plugins.Halcon</RootNamespace>
  11. <AssemblyName>Plugins.Halcon</AssemblyName>
  12. </PropertyGroup>
  13. <!-- HALCON 环境:把 HALCON 的托管 DLL(halcondotnet.dll 等)放进工程内 HalconSdk\ 目录即被自动引用(无需逐个登记),
  14. 与 Plugins.Vm 的 VmSdk\ 思路一致——“丢进目录就自动引”。目录为空时不产生任何引用。
  15. 运行期还需 HALCON 原生运行库(halcon.dll 等)+ 授权,通常由安装 HALCON 或把原生 DLL 放到 EXE 目录提供。 -->
  16. <PropertyGroup>
  17. <HalconSdkRoot>$(MSBuildThisFileDirectory)HalconSdk</HalconSdkRoot>
  18. </PropertyGroup>
  19. <ItemGroup>
  20. <HalconSdkDll Include="$(HalconSdkRoot)\**\*.dll" />
  21. </ItemGroup>
  22. <ItemGroup>
  23. <PackageReference Include="OpenCvSharp4" Version="4.13.0.20260627" />
  24. <PackageReference Include="OpenCvSharp4.runtime.win" Version="4.13.0.20260627" />
  25. <PackageReference Include="PropertyGridLib" Version="1.2.0" />
  26. <PackageReference Include="System.Text.Json" Version="10.0.0" />
  27. </ItemGroup>
  28. <ItemGroup>
  29. <Reference Include="@(HalconSdkDll->'%(FileName)')">
  30. <HintPath>%(HalconSdkDll.Identity)</HintPath>
  31. <Private>True</Private>
  32. </Reference>
  33. </ItemGroup>
  34. <ItemGroup>
  35. <ProjectReference Include="..\..\TeamAAS.Core\TeamAAS.Core\TeamAAS.Core.csproj" />
  36. </ItemGroup>
  37. <ItemGroup>
  38. <Reference Include="Microsoft.DwayneNeed">
  39. <HintPath>..\..\lib\Microsoft.DwayneNeed.dll</HintPath>
  40. <Private>True</Private>
  41. </Reference>
  42. <Reference Include="Microsoft.DwayneNeed.Win32">
  43. <HintPath>..\..\lib\Microsoft.DwayneNeed.Win32.dll</HintPath>
  44. <Private>True</Private>
  45. </Reference>
  46. <Reference Include="System.Windows.Forms" />
  47. <Reference Include="WindowsFormsIntegration" />
  48. <Reference Include="System.Drawing" />
  49. </ItemGroup>
  50. <!-- 生成后:把插件 DLL 复制到 EXE\win-x64\Plugins\HalconPlugins\(视觉平台子目录,PluginLoader 递归扫描);
  51. 同时把 HalconSdk\ 里的托管 DLL 一并复制过去,使 Assembly.LoadFrom 能在同目录探测到 halcondotnet.dll。 -->
  52. <Target Name="CopyPluginDll" AfterTargets="Build" Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
  53. <PropertyGroup>
  54. <PluginDir>$(MSBuildThisFileDirectory)..\..\EXE\win-x64\Plugins\HalconPlugins\</PluginDir>
  55. </PropertyGroup>
  56. <MakeDir Directories="$(PluginDir)" Condition="!Exists('$(PluginDir)')" />
  57. <Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PluginDir)" SkipUnchangedFiles="true" />
  58. <Copy SourceFiles="@(HalconSdkDll)" DestinationFolder="$(PluginDir)" SkipUnchangedFiles="true" Condition="'@(HalconSdkDll)'!=''" />
  59. </Target>
  60. </Project>