C
C#6mo ago
A

MSBuild For c# project with c++ dlls

So i have a c# project and a c++ cmake project , the c# project is referenced by the actual program so my structure is Project A ( Some Cmake Project ) Project B ( Some Cmake Project ) Project C ( Some Cmake Project ) Project D ( Reference To Project A , B, C ) the cmake projects project build dlls to a folder and I start this build and copy the dlls using this msbuild target
<Target Name="BuildNative" BeforeTargets="BeforeBuild">
<Exec Command="cmake -DCMAKE_BUILD_TYPE=$(Configuration) -S ./Native/ -B ./Native/build/$(Configuration)" />
<Exec Command="cmake --build ./Native/build/$(Configuration)" />
<ItemGroup>
<NativeFiles Include=".\Native\bin\$(Configuration)\*.*" />
<Content Include="@(NativeFiles)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>%(Filename)%(Extension)</Link>
</Content>
</ItemGroup>
</Target>
<Target Name="BuildNative" BeforeTargets="BeforeBuild">
<Exec Command="cmake -DCMAKE_BUILD_TYPE=$(Configuration) -S ./Native/ -B ./Native/build/$(Configuration)" />
<Exec Command="cmake --build ./Native/build/$(Configuration)" />
<ItemGroup>
<NativeFiles Include=".\Native\bin\$(Configuration)\*.*" />
<Content Include="@(NativeFiles)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>%(Filename)%(Extension)</Link>
</Content>
</ItemGroup>
</Target>
This works for the first build or project D i.e. Clean => Build => Run but when I do Clean => Build => Run => Change c# Code in project A or B or C references => Rerun The dlls of the ones I did not change are not copied
1 Reply
A
AOP6mo ago
Bump
Want results from more Discord servers?
Add your server