Keeping Assembly References current


Author
Message
Michael Cobb
Michael Cobb
StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)
Group: Forum Members
Posts: 26, Visits: 1K
I have several Business Object Libraries as well as other custom assemblies.  What is the best way to ensure that if one of these changes, a project that references it automatically gets updated with the current DLL?  I've been removing and re-adding these references (if they've changed) each time I compile a project.

Related to this question, I am referencing the Debug versions of these assemblies while I'm in development so that I can debug the DLLs as well as the project that references them.  Is there an easy way to make sure that when the project is built for release it points to the release versions of the DLLs?

Thanks!

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
There are a couple of ways of adding references. Usually, if you also control the source code, the easiest to just add the project to your solution. Right click on the solution, click add project, navigate to the project file and add it. This will not only allow you to debug it, but to work on it (if that is appropriate) right in the same solution. If you then look in your debug\bin folder of your startup project after you've built it at least once, you'll see all the referenced projects have been built and are sitting in this folder (they are also in there own debug\bin folders as well)...assuming your using the debug build. The one down side as near as I can tell is that the solution can take longer to build, because it will actually build all of the projects. If this won't/doesn't work in your situation, I'm sure there are others (definitely Trent and Ben) that can point you in the right direction as to the other ways of dealing with references.
Michael Cobb
Michael Cobb
StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)
Group: Forum Members
Posts: 26, Visits: 1K
Thanks for the reply Greg; unfortunately I am only able to reference the compiled DLLs.  My company chose to create the compiled DLLs for inclusion in other projects so that form developers don't have to see the code. 

A couple of pointers for you in case you didn't already know.  The DLLs will be added to the bin\debug folder every time a project is built if the Copy Local property setting for a reference is set to true.  Also, if you have multiple projects in a solution you can right click and compile just one instead of the entire solution if you don't need to compile the other(s).

I'm still not sure how to make sure that the references always grab the most recently compiled version in lieu of removing/readding them.  Even though I've recompiled an assembly that is referenced, the old version is used when I compile my project which references the assembly.  I read something today that indicates that if I add the reference by right-clicking References and adding, the reference is created as a file reference.  If I go through Project properties and add a reference, it is created as a Project reference.  I've been following the former method of adding references, so before the next compile I'm going to try adding them through the Project properties-->References page and see if that makes a difference.

I did some further research which answers my second question.  The answer is to use a tool such as MSBuild to create builds.  This tool allows one to create scripts to support multiple build types (development, release, testing, etc.).  I suppose I could do something similar with batch files.  Either way, there isn't a way within the IDE to toggle between debug/release builds of referenced assemblies.

I'll repost here if adding references through Project properties makes a difference.

Thanks!

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Ah, well, I thought I'd chime in just in case.



Also, I do know that the project file for a project is actually just a MSBuild file. MSBuild is used every time you compile the project/solution. I also know that you can switch between debug and release builds within VS, but I have to hunt around for it every time. I'm pretty sure you can use multiple solution files to create special case builds. It confused the heck out of me the first time I looked at the SF source...what the heck were all those solution files!?! They explained all that in the class BigGrin



If you happen to run across a GUI tool that would build/manage MSBuild files, let me know. Good luck!



StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
If the version # of your referenced DLLs changes, you will have to remove and re-add them just like you've been doing (say from 2.1.0.503 to 2.1.0.510 or something).  However, if the version number does not change, but you have an updated DLL, just close and re-open Visual Studio after you have moved the new DLL to the place where your project references it and you'll be fine, no need to remove and re-add it.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search