Tidbit: Visual Studio doesn’t copy references of references

Seems like I would have discovered this a while ago but it turns out that Visual Studio doesn’t copy project/assembly references of project/assembly references when building your solution.

For example, if your project X references Project A, which in turn references Project B, only the Project A assembly will be copied to the runtime folder when building project X, which will cause your application to crash due to the missing dependency (Project B assembly).

Not sure if this is a bug or by design (there may be issues of copying cascading references that I’m not thinking of at the moment).  Either way, you have at least two options as workarounds…

  1. Add a reference to Project B in Project X.
  2. Add a post-build event to Project X to copy the Project B assembly.
Both workarounds are pretty hack-ish, but they get the job done and get you back to more important things, like playing Portal 2!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s