Grpc.Tools.Tests.csproj 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  2. <PropertyGroup>
  3. <TargetFrameworks>net45;netcoreapp2.1</TargetFrameworks>
  4. <OutputType>Exe</OutputType>
  5. </PropertyGroup>
  6. <Import Project="..\Grpc.Core\SourceLink.csproj.include" />
  7. <PropertyGroup Condition=" '$(OS)' != 'Windows_NT' and '$(MSBuildRuntimeType)' == 'Core' ">
  8. <!-- Use Mono reference assemblies in SDK build: https://github.com/dotnet/sdk/issues/335.
  9. This is a different approach than used in Grpc.Core/Common.csproj.include because
  10. the workaround used there doesn't seem to be working for Microsoft.Build.* assemblies -->
  11. <FrameworkPathOverride Condition="Exists('/usr/lib/mono/4.5-api')">/usr/lib/mono/4.5-api</FrameworkPathOverride>
  12. <FrameworkPathOverride Condition="Exists('/usr/local/lib/mono/4.5-api')">/usr/local/lib/mono/4.5-api</FrameworkPathOverride>
  13. <FrameworkPathOverride Condition="Exists('/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api')">/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api</FrameworkPathOverride>
  14. </PropertyGroup>
  15. <ItemGroup>
  16. <ProjectReference Include="..\Grpc.Tools\Grpc.Tools.csproj" />
  17. </ItemGroup>
  18. <ItemGroup>
  19. <PackageReference Include="Moq" Version="4.8.3" />
  20. <PackageReference Include="NUnit; NUnitLite" Version="3.10.1" />
  21. <PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
  22. </ItemGroup>
  23. <PropertyGroup Condition=" '$(TargetFramework)' != 'net45' ">
  24. <DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
  25. </PropertyGroup>
  26. <ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
  27. <Reference Include="Microsoft.Build.Framework; Microsoft.Build.Utilities.v4.0" />
  28. </ItemGroup>
  29. <ItemGroup Condition=" '$(TargetFramework)' != 'net45' ">
  30. <PackageReference Include="Microsoft.Build.Framework; Microsoft.Build.Utilities.Core" Version="15.6.*" />
  31. </ItemGroup>
  32. <!-- Groups below is a hack to allow the test to run under Mono Framework build.
  33. ========================================================================== -->
  34. <!-- Mono unfortunately comes with broken Microsoft.Build.* assemblies installed in
  35. the GAC, but fortunately searches for runtime assemblies in a different order
  36. than Windows CLR host: the GAC assemblies have the lowest search priority, (see
  37. https://www.mono-project.com/docs/advanced/assemblies-and-the-gac/), not the
  38. highest as is in Windows (documented at
  39. https://docs.microsoft.com/dotnet/framework/deployment/how-the-runtime-locates-assemblies).
  40. To run the tests under Mono, we need correct assemblies in the same directory as
  41. the test executable. Correct versions are in the MSBuild directory under Mono. -->
  42. <ItemGroup Condition=" '$(TargetFramework)' == 'net45' and '$(OS)' != 'Windows_NT' ">
  43. <None Include="$(_MSBuildAssemblyPath)/Microsoft.Build.Framework.dll;
  44. $(_MSBuildAssemblyPath)/Microsoft.Build.Utilities.v4.0.dll;
  45. $(_MSBuildAssemblyPath)/Microsoft.Build.Utilities.Core.dll"
  46. CopyToOutputDirectory="Always" Visible="false" />
  47. </ItemGroup>
  48. <PropertyGroup Condition=" '$(TargetFramework)' == 'net45' and '$(OS)' != 'Windows_NT' ">
  49. <!-- The None items are included into assembly candidate resolution by default, and
  50. we do not want that, as they are not valid as reference assemblies (the version of
  51. Microsoft.Build.Utilities.v4.0 is a pure facade for Microsoft.Build.Utilities.Core,
  52. and does not define any types at all). Exclude them from assembly resolution. See
  53. https://github.com/Microsoft/msbuild/blob/50639058f/documentation/wiki/ResolveAssemblyReference.md -->
  54. <AssemblySearchPaths>{HintPathFromItem};{TargetFrameworkDirectory};{RawFileName}</AssemblySearchPaths>
  55. <!-- Mono knows better where its MSBuild is. -->
  56. <_MSBuildAssemblyPath Condition=" '$(MSBuildRuntimeType)' != 'Core' "
  57. >$(MSBuildToolsPath)</_MSBuildAssemblyPath>
  58. <!-- Under dotnet, make the best guess we can. -->
  59. <_MSBuildAssemblyPath Condition=" '$(MSBuildRuntimeType)' == 'Core' "
  60. >$(FrameworkPathOverride)/../msbuild/$(MSBuildToolsVersion)/bin</_MSBuildAssemblyPath>
  61. </PropertyGroup>
  62. </Project>