I have project A
which has dependency on project B
but there is no reference from B
to A
. I want build and copy assemblies in bin folder
of project B
to bin folder
of project A
. how can I do this with post build event and dotnet msbuild
.
I found this link but it works for VS 2015 and below and MS-Build:
Build another project by prebuild event without adding reference
how can I do this with post build event and dotnet msbuild
You can add Build task and copy task in the post build event in project A to achieve your request:
"$(MSBuildBinPath)\MSBuild.exe" "$(SolutionDir)ProjectB\ProjectB.csproj"
xcopy.exe "$(SolutionDir)ProjectB\bin\Debug\netcoreapp1.1\ProjectB.dll" "$(SolutionDir)ProjectA\bin\Debug\netcoreapp1.1"
If you have multiple assemblies in the bin folder of project B, you can also use the Wildcard to copy the assemblies, like
xcopy.exe "$(SolutionDir)ProjectB\bin\Debug\netcoreapp1.1\*.dll
Hope this can help you.