compuguru
compuguru

Reputation: 1065

Always force Referenced DLL to update?

I'm working on a solution that produces some DLLs. Let's say Project A produces A.dll. Project B uses A.dll to perform some functions.

When Project B is ran, it checks if A.dll exists in the output directory, and if it doesn't, it copies A.dll from the HintPath (as I understand it). But if A.dll is already in the output directory, it doesn't copy over.

So if Project A has changes and a new A.dll is produced, Project B won't get the new A.dll until the copy in the output directory is deleted. Therefore, if you run Project B, it will be using old code.

Is there a way to force the DLLs to always get copied? Maybe delete the copies in the output directory before Project B is built?

It would be so easy to use ProjectReference but it's unsupported by another build system we use.

Upvotes: 2

Views: 322

Answers (1)

Jeff
Jeff

Reputation: 982

One way to resolve this issue is in Project A to make a Post-Build event. You can tell it to copy(or replace) the A.dll to a certain directory every time in Project A is built. Something like this:

copy /Y "$(TargetDir)$(ProjectName).dll" "C:\SomePath"

Upvotes: 3

Related Questions