管理源代码的方法 [英] Methods of managing source code

查看:59
本文介绍了管理源代码的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

近年来,我编写了大量软件,其中大部分都倾向于共享一个或多个通用库.(最常用的库,是我用来调用 SQL 存储过程和返回对象数组的库)

I've written a fair amount of software over recent years, most of which all tend to share one or more common libraries. (The most common library, being one that I use for calling SQL stored procedures and returning arrays of objects)

我对我管理图书馆的方式不满意,我正在寻找改进我工作方式的建议.

I'm not happy with the way I manage the libraries, and I'm looking for suggestions to improve the way I work.

我第一次创建现在是共享库时,我将该库作为单独的类库项目添加到解决方案中.

The first time I created what is now a shared library, I added the library as a separate class library project within the solution.

现在,当我开始一个新的解决方案并且我知道我将需要一个我已经拥有的库时,我会去查找库的项目并将文件复制到新的解决方案中.

Now, when I start a new solution and I know I'm going to need a library I already have, I will go and find the library's project and copy the files into the new solution.

这让我的文件系统(和 SVN 服务器)周围散布着同一个库项目的几个副本,感觉不太对.

This leaves me with several copies of the the same library project dotted around my filesystem (and the SVN server), and it just doesn't feel right.

是否有更好的工作方式,以便我只有一个所有解决方案共享的该库的主副本,而不是每个解决方案都有自己的库项目副本?

Is there a better way of working, so that I only have one master copy of this library that all the solutions share, rather than each solution having its own copy of the library project?

推荐答案

只需构建一次库,然后从需要使用它的项目中引用编译后的二进制文件.

Just build the library once, and reference the compiled binary from your project that needs to use it.

在 Visual Studio 中,右键单击项目并单击添加引用",然后选择浏览"选项卡并找到您的库二进制文件.

In visual studio, right click on the project and click "add reference", then choose the "browse" tab and locate your libraries binary.

(您显然需要将库程序集与您的应用程序一起分发)

(You will obviously need to distribute the library assembly along with your application)

这篇关于管理源代码的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆