Methods for updating DLLs

Recently, I joined a company that has, over the years, had many developers of varying quality work.

The projects that have been created depend on the results of other projects. However, instead of creating dependencies in the usual way and maintaining the code, the DLLs were copied from one place to another and referenced from there.

Is there an easy way to update all my DLLs in the parent folder to the latest version of this (by timestamp) across the entire range of folders?

So, the whole process:

  • Compile all projects and all solutions in the root folder.
  • Find and update all other copies of the output files.
  • Recompile everything and find out what breaks.
  • Update source code and update links.

The step of the task is 2.

(I fully understand that this can break the material)

I use Visual Studio 2005 and C # to create a DLL, but I want to update the files rather than the code.

+4
source share
4 answers

A simpler approach is to create a solution that contains all the projects you need, change the links between them to use project links, change the projects so that their output folders all point to the same directory, and then set up project links so that for the parameter Copy Local is set to false.

Then all you have to do is build the solution (either in VS or on the command line via msbuild).

The result of the assembly will be one folder in which there are all the files you need, and each project will always have the latest links.

+2
source

Microsoft's best practice guidelines are project references, not DLLs, where possible.

Project links and file links

File links are direct links to assemblies; You create them using the Browse tab in the Add Link link dialog box. Project to project links - links to projects containing assemblies; you create them using the Project tab Help dialog box.

The advantage of a project-project link is that it creates a dependency between projects in building a system, so a dependent project will be built if it changes since the last time a link project was built. Link to the file do not create an assembly dependency, so it is possible to build a project link without creating a dependent project, and the link may become obsolete (i.e. the project may refer to a previously built version of the project). This may result in multiple versions of the same dll required in the bin directory; this is not possible. When this conflict occurs, you will see a message such as Warning: the dependency file in the project "project" cannot be copied to the startup directory, because it overwrites the reference "file".

You should avoid adding a link file to the exits of another project within the same solution, because this can lead to a compilation error. Instead, use the Projects tab of the Add Link link to create project links in the same solution. This makes team development easier by allowing for better control over the class of libraries that you create in your projects. For more information, see Troubleshooting How to Create and Delete a Dependencies Project.

From here .

+8
source

There are times when the links to the project do not work. For example, the build time of projects or the desire of several projects to depend on the particular build of the link, or if the testing of the link project is completed, and you do not want to check things again.

If you have a continuous integration system and version control, an alternative is to check the built-in DLLs in version control as part of the CI assembly. Then refer to the DLL (for example, external in svn) to a dependent project, this should mean that all your DLL files remain up to date.

+5
source

Could you add a post-build step to included but not included projects to dump DLLs to a predefined location? From there, you could add a pre-build step in dependent projects to capture new DLLs from the specified location. Definitely not the best practice, but it should do its job.

+2
source

All Articles