プロジェクトの準備 ~C#ビルド設定③~
- rustのコンパイルをしてC#のプロジェクトにコピーする設定を追加
CsbindgenHandsOn.csproj
を開いて以下の内容を<PropertyGroup>
と同一階層に追記
<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$(Configuration)'=='Debug'">
<Exec Command="cargo build"
WorkingDirectory="$([System.IO.Path]::Combine($(ProjectDir),../libcsbindgenhandson))" />
<Copy Condition="$(RuntimeIdentifire.StartsWith(win))"
SourceFiles="$([System.IO.Path]::Combine($(ProjectDir),../libcsbindgenhandson/target/debug/csbindgenhandson.dll))"
DestinationFolder="$([System.IO.Path]::Combine($(ProjectDir),../CsbindgenHandsOn,runtimes\$(RuntimeIdentifire)\native))" />
<Copy Condition="$(RuntimeIdentifire.StartsWith(linux))"
SourceFiles="$([System.IO.Path]::Combine($(ProjectDir),../libcsbindgenhandson/target/debug/libcsbindgenhandson.so))"
DestinationFolder="$([System.IO.Path]::Combine($(ProjectDir),../CsbindgenHandsOn,runtimes\$(RuntimeIdentifire)\native))" />
</Target>