Plugins.Vm.csproj 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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.Vm</RootNamespace>
  11. <AssemblyName>Plugins.Vm</AssemblyName>
  12. </PropertyGroup>
  13. <!-- 海康 VisionMaster SDK 引用:VM 的托管 DLL 已随工程放在 VmSdk\ 目录(该目录下所有 *.dll 通配自动引用),
  14. 不依赖 VM 安装路径,工程自包含。Private=False:仅作编译期引用,运行时由本机已安装的 VM(4.4) 提供,
  15. 避免把 VM 程序集复制到输出与其安装环境冲突。 -->
  16. <PropertyGroup>
  17. <VmSdkRoot>$(MSBuildThisFileDirectory)VmSdk</VmSdkRoot>
  18. </PropertyGroup>
  19. <ItemGroup>
  20. <VmSdkDll Include="$(VmSdkRoot)\**\*.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="@(VmSdkDll->'%(FileName)')">
  30. <HintPath>%(VmSdkDll.Identity)</HintPath>
  31. <Private>False</Private>
  32. </Reference>
  33. </ItemGroup>
  34. <ItemGroup>
  35. <ProjectReference Include="..\..\TeamAAS.Core\TeamAAS.Core\TeamAAS.Core.csproj" />
  36. </ItemGroup>
  37. <Target Name="CopyPluginDll" AfterTargets="Build" Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
  38. <PropertyGroup>
  39. <PluginDir>$(MSBuildThisFileDirectory)..\..\EXE\win-x64\Plugins\</PluginDir>
  40. </PropertyGroup>
  41. <MakeDir Directories="$(PluginDir)" Condition="!Exists('$(PluginDir)')" />
  42. <Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PluginDir)" SkipUnchangedFiles="true" />
  43. </Target>
  44. <!-- 把 VM SDK 的 DLL 同步到运行目录 Runtime\Vm4.4\(对应 Cognex 的 Runtime\Vpp9.0\);
  45. 运行时由 App.xaml.cs 的 CurrentDomain_AssemblyResolve 递归搜 Runtime\ 自动加载,避免手动拷贝漂移。 -->
  46. <Target Name="CopyVmSdkToRuntime" AfterTargets="Build" Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
  47. <PropertyGroup>
  48. <VmRuntimeDir>$(MSBuildThisFileDirectory)..\..\EXE\win-x64\Runtime\Vm4.4\</VmRuntimeDir>
  49. </PropertyGroup>
  50. <MakeDir Directories="$(VmRuntimeDir)" Condition="!Exists('$(VmRuntimeDir)')" />
  51. <Copy SourceFiles="@(VmSdkDll)" DestinationFolder="$(VmRuntimeDir)" SkipUnchangedFiles="true" />
  52. </Target>
  53. </Project>