通过Visual Studio 2017中的postbuild活动构建.net核心项目

Moh*_*our 0 msbuild post-build-event visual-studio .net-core visual-studio-2017

我有项目A,其对项目的依赖B,但也从没有提及BA.我想建立和复制组件bin folder项目B,以bin folder项目A.我怎么能用post build事件做到这一点dotnet msbuild.

我找到了这个链接,但它适用于VS 2015及以下和MS-Build:

通过prebuild事件构建另一个项目而不添加引用

Wil*_*tak 6

这对我有用.它来自:https://github.com/dotnet/sdk/issues/677

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="if not exist $(OutDir)..\..\..\.\build  mkdir $(OutDir)..\..\..\..\build" />
    <Exec Command="copy $(OutDir)$(TargetName).dll $(OutDir)..\..\..\..\build\$(TargetName).dll /Y" />
    <Exec Command="copy $(OutDir)$(TargetName).pdb $(OutDir)..\..\..\..\build\$(TargetName).pdb /Y" />
</Target>
Run Code Online (Sandbox Code Playgroud)