为什么 Visual Studio 在 Azure DevOps 签入时排除 BIN 和 OBJ 文件夹 [英] Why does visual studio exclude BIN and OBJ folders at Azure DevOps checkin

查看:35
本文介绍了为什么 Visual Studio 在 Azure DevOps 签入时排除 BIN 和 OBJ 文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道从 Visual Studio 或 Git-Bash 签入 Azure DevOps 上已在 Visual Studio 中编码的代码的通用方法是什么.发生的问题是 bin 文件夹包含许多第三方 dll,这些 dll 在构建项目之前保存在源中.那些第三方 dll 是项目所必需的.但是,在签入 Azure DevOps 后,bin 和 obj 不存在.这是由于 .gitignore 和 .gitattribute 文件造成的.到目前为止,我已经删除了这两个文件并检查了 bin 文件夹.这两个文件的用途是什么.有人可以提出解决方法.

I want to know what is the generic way to check-in code on Azure DevOps from Visual Studio or Git-Bash that has been coded in Visual Studio. The problem that occurs is the bin folder contains many third party dll's which are kept in the source before building the project. Those third party dll's are necessary to project. However after check-in to Azure DevOps the bin and obj are not present. This happens due to .gitignore and .gitattribute files. I have deleted both the files and checked in the bin folder as of now. What is the purpose of these two files. Can someone please suggest a way to resolve.

推荐答案

.gitignore 文件指定未跟踪的文件..gitattributes 定义每个路径的属性.它们是 Git 的配置文件.

.gitignore file specifies the untracked files. .gitattributes defines attributes per path. They are configuration files of Git.

在 Visual Studio 中,bin 和 obj 文件夹用于存储编译器生成的输出(参见 此处).由于这些输出文件是由编译器生成的,因此您不想在源代码管理中跟踪它们.

In Visual Studio, the bin and obj folders are used to store the output generated by compilers (see here). As these output files are generated by compilers, you don't want to track them in the source control.

如果您的项目需要引用某些 3rd 方 dll,最好的方法是将它们引用为 Nuget 包,前提是这些 dll 有可用的 Nuget 包.如果没有,您可以将它们放在 bin 或 obj 以外的文件夹中,以便在 Git 中跟踪它们.您不应更改 .gitignore 来跟踪 bin 或 obj 文件夹.

If your project need to reference to some 3rd party dlls, the best approach is to reference to them as Nuget packages if there are Nuget packages available for the dlls. If not, you can put them in a folder other than bin or obj so they can be tracked in Git. You should not change .gitignore to track bin or obj folders.

这篇关于为什么 Visual Studio 在 Azure DevOps 签入时排除 BIN 和 OBJ 文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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