将 Visual Studio 项目构建到公共目录而不是 bin?

发布于 2024-09-30 07:26:57 字数 189 浏览 6 评论 0原文

是否可以将项目构建到公共目录,而不是每个项目的 bin 文件夹?

目的是使我的所有二进制文件的源代码控制变得更容易。我该怎么做,这种方法有哪些陷阱?

您可以选择将项目构建到另一个目录(公共目录?),而不是 bin/debugbin/release

Is it possible to build projects to a common directory, instead of the per project bin folder?

The purpose would be to make it easier to source control all my binaries. How can I do it and, what are the pitfalls of this approach?

You have the option to build projects to another directory (a common directory?) rather than the bin/debug and bin/release.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

沉溺在你眼里的海 2024-10-07 07:26:57

如果您的意思是构建项目并将 DLL 文件放入共享文件夹中,是的,我们目前这样做,但我们使用 持续集成 (CI),这样我们就可以知道一个项目的更改何时导致另一个项目崩溃。

当您使用其他项目中引用的版本特定的 DLL 文件时,您也可能会遇到问题。

您还可以使用 Visual-Studio 内置的构建后命令,而不是使用 bat 文件复制 DLL 文件。它与批处理文件相同,不同之处在于 CruiseControl 中不需要进行特殊设置即可复制在文件上。如果开发人员对构建后命令进行更改并将其签入,CruiseControl 将自动执行该命令。

另外,如果您希望您的开发人员共享二进制文件,我会将它们放入源代码管理确保每个人共享相同的 DLL 文件,而不是他们自己本地构建的 DLL 文件副本(这可能与实际构建服务器不同,因为某些编译指令可能/可能未定义)。

If you mean building your projects and putting the DLL files in a shared folder, yes, we currently do this, but we use this using continuous integration (CI), so we can know when a change in a project caused another project to break.

You may also experience problems when you use a version-specific DLL file as referenced in your other projects.

You can also, rather than having a bat file copy over the DLL files, use Visual-Studio's built in post-build command. It's the same as a batch file, with the exception that no special setup is required in CruiseControl to copy over the files. If a developer makes a change to the post build command it and check it in it will automatically be executed by CruiseControl.

Also, if you'd like your developers to shared the binaries I'd put them in source control to make sure everyone share the same DLL files rather than their own local built copy of the DLL file (which might be different than the actual build server as some compile directives might/might not be defined).

舟遥客 2024-10-07 07:26:57

如果您指的是 DLL 文件/程序集,那么您像往常一样构建到 bin/release ,然后将所需的 DLL 文件复制到公共目录,然后引用这些文件,因此当您重建原始解决方案时,您不必担心您正在使用哪个版本或重新编译其他相关项目,因为公共目录中的版本没有更改。

If you mean DLL files/assemblies, then you build to bin/release as usual, then copy the DLL files you require to a common directory and then reference those, so when you rebuild the original solution, you don't have to worry about which version you are using or recompile other related projects as the version hasn't changed in the common dir.

节枝 2024-10-07 07:26:57

人们碰巧会构建到 bin 之外的另一个文件夹(例如解决方案目录中的 bin 文件夹而不是项目目录)。我怀疑你这样做会遇到任何问题。但由于您要签入它,因此必须记住不要将其设置为只读(以便您可以在它们之上进行构建)。源代码控制程序通常会锁定文件。

您还可以考虑使用一个 bat 脚本,在成功构建后将文件复制到另一个位置。

It happens that people build to another folder than bin (e.g. the bin folder in the solution directory rather than the project directory). I doubt you would have any problems doing this. But since you're going to check it in, you must remember to not have it read-only (so you can build over them). Source control programs often lock the files.

You could also consider having a bat script that copies the files to another location after a successful build.

乱世争霸 2024-10-07 07:26:57

我不会将你的二进制输出放入源代码管理中。只放源文件、项目文件和解决方案文件。

I would not put your binary output into source control. Only put the source files, project files and solution files.

凝望流年 2024-10-07 07:26:57

对于 C++ 项目:
右键单击项目->属性->链接器->输出文件
在那里设置你的目录。

对于 C# 项目:
右键单击项目->属性->构建->输出路径

For C++ projects:
Right click on the project -> Properties -> Linker -> Output File
set your directory there.

For C# Projects:
Right click on the project -> Properties -> Builld -> Output Path

花想c 2024-10-07 07:26:57

我们使用构建后脚本复制到预期位置。这可行,但非常繁琐(因为脚本编写起来很困难,调试起来也很困难)。

We use post-build scripts to copy to the intended location. This works, but is very fiddly (as the scripts are awkward to write & awkward to debug).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文