I have an ASP.NET project under source control (Subversion). For various reasons, I don't want to add the \Bin directory or its contents to source control, so I have it svn:ignored. DLLs are loaded into here during a Visual Studio build, and I can start with a clean directory and/or delete all the contents of this directory and still have a successful build.
There are two ways that I reference code for inclusion in the project:
<add>
any DLL that's in the GAC this way. I do this for all of the System dlls.(Note that this is different than non-web projects, where all references to external dependencies are stored in the project file. There's no project file for VS web projects so they have to be stored somewhere else.)
Now I have a 3rd-party compiled DLL that I'd like to include in the project. Unfortunately, none of the referencing options I've found seem to work for me:
Is there another way I can make a reference to a DLL file and have it stick?
If you are doing any kind of serious development I would recommend migrating away from the web site project and to a web project as this allows you to manage these kind of dependencies in the same manner across your entire solution.
However, assuming you cannot do that, place all of the assemblies that you need to reference from the web project into a folder somewhere ( e.g. lib\web ) and add a pre-build event to your web project that copies the content of that folder into the bin folder of the web directory. Now whenever you want to add a dependency to your web project you can drop it in the lib\web folder, and add the reference. Whenever you build, all of the referenced assemblies will be copied into the folder so you can delete the bin folder or do a clean checkout and not have any issue.
Technically, in step 3 a little more happens. Visual Studio copies the DLL to your \Bin directory and adds a name.dll.refresh file that contains the path to the original DLL. With SourceSafe, the .refresh file is under version control, so that when you setup a new system and get the latest code from SourceSafe, Visual Studio can find and copy the DLL from the specified location. You should be able to put the .refresh file in svn and have everything work.
Also, I generally create a \Common directory above my project directory, which is where I put the DLLs, and I include that directory in the solution (and source control), so that each version of my project in source control has the correct DLLs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With