Visual Studio和源代码控制:如何共享代码?
我想在 Visual Studio 中拥有一些共享代码(代码库、控件、实用程序、帮助器类等)。 我的意思不是共享程序集,而是共享代码(即我想随我的应用程序一起发送一个程序集,即可执行程序集)。
其他开发环境中的技术是将公共源代码放在我的机器上的某个路径中,然后为 IDE 提供一个路径列表来搜索代码文件。
Visual Studio 不支持代码搜索路径。
备用黑客解决方案是将源代码一遍又一遍地复制到每个项目中。 但为了将它们全部保留为一个版本,它们在源代码管理中共享。 当您的源代码控制提供程序是 Microsoft Visual SourceSafe(支持共享文件)时,此方法效果很好。
但其他源代码控制产品(CVS、Subversion、Microsoft Team Foundation Source Save Server、SVN)不支持共享文件。
那么其他人如何避免将 DLL 与其可执行文件一起传送呢?
更新1
这是单文件部署的问题。 ClickOnce在3个文件夹中生成18个文件(即多个文件)
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 ship one assembly with my application, the executable assembly).
The technique in other development environments way is to have the common source code in a path on my machine, and the IDE is given a list of paths to search for code files.
Visual Studio does not support code search paths.
The back-up hack solution is to copy the source-code over and over into every project. But then in order to keep them all as one version, they are shared in source control. This works well when your source control provider is Microsoft Visual SourceSafe - which supports shared files.
But other source control products (CVS, Subversion, Microsoft Team Foundation Source Save Server, SVN) do not support shared files.
So how does everyone else avoid shipping DLL's with their executable?
Update 1
It is an issue of single file deployment. ClickOnce generates 18 files in 3 folders (i.e. more than one file)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我可以提出两种解决方案:
I could propose two solutions:
在我的工作中,我们开始使用 Subversion 的外部解决这个问题 文件夹。 您只需在您的根文件夹(或任何文件夹)上放置一个“外部”属性,例如:
当您更新项目时,将创建文件夹ExternalLib并填充存储库的内容。 任何提交都将反映在相应的存储库上。
因此,您可以让您的备份黑客解决方案也适用于 SVN =)
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:
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 =)
我们使用ClickOnce部署,非常可靠。 对于ClickOnce,虽然下载了许多文件(包括DLL),但对用户隐藏,概念上有一个对象,即应用程序。 然后通过共享项目处理共享代码。
但如果您实际上只需要一个文件,ClickOnce 将不适合您......
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...
也许可以考虑共享程序集,并在构建过程中使用 ILMerge 这样的工具将它们全部合并到一个错误程序集中。
maybe consider having shared assemblies and use a tool like ILMerge during your build process to merge them all to one bug assembly.