This is a hard concept to get across in the title, so forgive me if it doesn’t fully capture the idea.
Perhaps I am crazy, but I just noticed this behavior:
- Create Visual Studio solution
- Create DLL library project (I use C# … don’t know if the behavior is the same with another language-specific DLL project).
- Create web client A (I used an MVC 3 project)
- Reference the library from the new web client A
- Create web client B (I used an ASP.NET project)
- Reference the library from the new web client B
- Build the solution
- Wait a bit (at least a minute so that the timestamp difference will be obvious)
- Open two Windows Explorer windows: one to the bin in web client A and one to the bin in web client B. You should see the binaries for the client project as well as the library project (assuming that “Copy local” for project references is a universal default)
- Build just the library project.
On my system, the library DLL appears to be pushed (or mutually pulled) into the client bin folders. This should be evident by the timestamp difference if you wait at step 8. Again, perhaps I’m crazy but I know I’ve done this scenario before and never seen this behavior.
The problem came up because I was working in a solution with this type of arrangement and was building two web applications individually as opposed to building the whole solution. When I would build web app A, it worked fine, but web app B would complain with a “FileNotFoundException: Could not load file or assembly” error. And then vice-versa.
So to the question:
Is this normal behavior (and either I’m crazy or am wrong about being in this scenario before)?
If not normal, is there a setting I can use to make the library DLL only get into the client when the client gets built?
Check the copy local setting on the references to the class library.
edit
Just checked and the same happens on my machine.
I think that this is default behaviour. If you think about it, it allows you to rebuild a class library and use it in the referencing project without building that project.