Visual Studio&Source Control: How to have shared code?

后端 未结 4 1866
傲寒
傲寒 2021-01-22 20:31

i want to have some shared code (code library, controls, utilities, helper classes, etc) in Visual Studio. i do not mean shared assemblies, i mean shared code (i.e. i want to sh

相关标签:
4条回答
  • 2021-01-22 20:59

    I could propose two solutions:

    1. Visual Studio allows you to add a link to a file. Choose "Add Existing Item", pick your file and then click the arrow next to the "Add" button. A popup will display and you should choose "Add as link" from there. Now you can store your common code in one location (folder).

    enter image description here

    1. Compile your common code in reusable assemblies and use them in your projects. Use ILMerge to merge all assemblies into one when deploying. I personally prefer this option.
    0 讨论(0)
  • 2021-01-22 20:59

    At my work we starting to solve this problem using Subversion´s external folders. You just need to put a 'external' property on yor root folder (or any folder), like:

    ExternalLib https://yourrepo/SharedLibs/trunk
    

    When you update the project, the folder ExternalLib will be created and populated with the repo´s contents. Any commit will be reflected on the respectively repo.

    So, you can make your back-up hack solution works with SVN too =)

    0 讨论(0)
  • 2021-01-22 21:10

    We use ClickOnce deployment, which has been very reliable. With ClickOnce, there is conceptually a single object, the application, although many files (including DLLS) are downloaded, although hidden to the user. Shared code is then dealt with through shared projects.

    But if you actually physically require just a single file, ClickOnce won't work for you...

    0 讨论(0)
  • 2021-01-22 21:17

    maybe consider having shared assemblies and use a tool like ILMerge during your build process to merge them all to one bug assembly.

    0 讨论(0)
提交回复
热议问题