Created
August 23, 2023 13:09
-
-
Save winstxnhdw/f6ad2cbd1ecad74b91debb762e3d55b6 to your computer and use it in GitHub Desktop.
A .NET project file describing complex usage of MSBuild to extract binaries from gRPC.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<PublishDir>../Assets/NuGet</PublishDir> | |
<TargetFramework>netstandard2.1</TargetFramework> | |
<UnityBuildArchitecture>win-x64</UnityBuildArchitecture> | |
<ProtobufClientDir>../Assets</ProtobufClientDir> | |
</PropertyGroup> | |
<ItemGroup> | |
<Protobuf Include="Protos/*.proto" GrpcServices="Client" OutputDir="$(ProtobufClientDir)" /> | |
<PackageReference Include="Grpc.Core" Version="2.46.6" /> | |
<PackageReference Include="Google.Protobuf" Version="3.23.4" /> | |
<PackageReference Include="Grpc.Tools" Version="2.56.2" ExcludeAssets="compile" /> | |
</ItemGroup> | |
<Target Name="CleanBeforeRestore" BeforeTargets="Restore"> | |
<RemoveDir Directories="$(PublishDir)" /> | |
<RemoveDir Directories="$(ProtobufClientDir)/Protos" /> | |
</Target> | |
<Target Name="CleanAfterPublish" AfterTargets="Publish"> | |
<ItemGroup> | |
<PublishedFilesToDelete Include="$(PublishDir)/$(ProjectName).*" /> | |
<GrpcVersion Include="%(PackageReference.Version)" Condition="%(Identity) == 'Grpc.Core'" /> | |
</ItemGroup> | |
<PropertyGroup> | |
<GrpcVersion>@(GrpcVersion)</GrpcVersion> | |
<GrpcRuntimeDir>NuGet/grpc.core/$(GrpcVersion)/runtimes/$(UnityBuildArchitecture)/native</GrpcRuntimeDir> | |
<GrpcRuntimePath>$([System.IO.Directory]::GetFiles('$(GrpcRuntimeDir)')[0])</GrpcRuntimePath> | |
<GrpcRuntimeExtension>$([System.IO.Path]::GetExtension('$(GrpcRuntimePath)'))</GrpcRuntimeExtension> | |
</PropertyGroup> | |
<RemoveDir Directories="$(BaseIntermediateOutputPath)" /> | |
<RemoveDir Directories="$(BaseOutputPath)" /> | |
<Delete Files="@(PublishedFilesToDelete)" /> | |
<Copy | |
SourceFiles="$(GrpcRuntimePath)" | |
DestinationFiles="$(PublishDir)/grpc_csharp_ext$(GrpcRuntimeExtension)" | |
/> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment