C #: Elegant way to copy native dependencies next to my exe
I am currently using the post-build event command line like this:
xcopy /Y /R d:\svn\some\directory\somedll.dll $(TargetDir)
The problem is this: when others check the code against a different directory, they will have to fix the path in that command. Is there a less hacky way to do this?
+2
source to share
3 answers
Instead of using the command line in a post-build event, you can use the actual msbuild tasks as part of the build script by editing the .csproj
.
Here is RichieHindle 's answer using the msbuild task rather than xcopy:
<Target Name="PostBuild">
<Copy
SourceFiles="$(SolutionDir)..\directory\somedll.dll"
DestinationFolder="$(TargetDir)"
/>
</Target>
In the file, .csproj
you should see a missing stub for pre / post build targets.
+2
source to share