There is a solution consisting of 40 projects, you need to connect a library to each of these projects. Tell me, is there any easy way to do this, so as not to add separately the links to the library in each project? Ideal of all would be to put this library to the standard, so that in any project you could connect it just like for example "system"

  • You can easily create your own template from the project and connect it. - VladD
  • But if the projects have already been created, it will be more likely to add a link to 40 projects than wait for a clever solution here. - VladD
  • Yes, the projects have already been created, and they add new functions to the script, which are described just in the library. And it’s already boring to connect separately, because it’s going to be done almost every day. It still seems to me that it is real and not difficult to do, but I don’t have proper knowledge of C #. - cost_c
  • Here knowledge is more likely not C #, but Visual Studio automation tools. If you want a quick hack, you can edit the *.csproj (there is a simple XML). But I would still wait for a more human solution. - VladD
  • Thank you, and I’ll do it in anticipation of an answer, an excellent temporary solution. - cost_c

1 answer 1

You can accomplish this with the nuget package manager by adding your own library to the local repository.

  • An interesting trick. And it (nuget) can be asked to add to all projects? - VladD
  • get-project -all | ? {$ _. Type -eq 'C #'} | % {$ _. Object.References.Add ("C: \ ProjectPath \ Libs \ SomeAssembly.dll"). Version} - cost_c
  • and if the build is standard, then get-project -all | ? {$ _. Type -eq 'C #'} | % {$ _. Object.References.Add ("System.Configuration, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a"). Version} - cost_c
  • Wow, cool, pulls on a separate answer. And where to run? - VladD
  • From the console nuget? - VladD