简体   繁体   English

TFS 2012 Build:sln还是csproj?

[英]TFS 2012 Build: sln or csproj?

Just wondering if there is a preference between sln or csproj files when building projects in TFS 2012. We typically build sln files in TFS to support our dev teams and that's usually the standard, but one team is asking why we can't build csproj files instead in TFS. 只是想知道在TFS 2012中构建项目时sln或csproj文件之间是否存在首选项。我们通常在TFS中构建sln文件以支持我们的开发团队,这通常是标准,但是一个团队问我们为什么不能构建csproj文件而是在TFS中。

I noticed that to build a csproj file you have to provide arguments in the MSBuild Arguments field for a TFS build definition, and you do not have to provide these arguments when building a solution file. 我注意到要构建一个csproj文件,您必须在MSBuild Arguments字段中为TFS构建定义提供参数,并且在构建解决方案文件时不必提供这些参数。 So other than this small detail I'm not sure what the pros and cons are between building an sln vs csproj. 除了这个小细节之外,我不确定构建sln与csproj之间的利弊是什么。

Can someone please shed some light on the benefits, pros/cons of building a sln vs csproj in TFS, is there a common practice, a standard, or does it really matter? 有人可以了解一下在TFS中建立sln vs csproj的好处,优点/缺点,是否有通用的做法,标准,还是真的重要?

Just wondering if there is a preference between sln or csproj files when building projects in TFS 2012. We typically build sln files in TFS to support our dev teams and that's usually the standard, but one team is asking why we can't build csproj files instead in TFS. 只是想知道在TFS 2012中构建项目时sln或csproj文件之间是否存在首选项。我们通常在TFS中构建sln文件以支持我们的开发团队,这通常是标准,但是一个团队问我们为什么不能构建csproj文件而是在TFS中。

Why do they want to do this? 他们为什么要这样做? Is there some sort of advantage articulated in this inquiry? 这次调查是否有某种优势?

I noticed that to build a csproj file you have to provide arguments in the MSBuild Arguments field for a TFS build definition, and you do not have to provide these arguments when building a solution file. 我注意到要构建一个csproj文件,您必须在MSBuild Arguments字段中为TFS构建定义提供参数,并且在构建解决方案文件时不必提供这些参数。 So other than this small detail I'm not sure what the pros and cons are between building an sln vs csproj. 除了这个小细节之外,我不确定构建sln与csproj之间的利弊是什么。

A .sln is a master project that is converted to an msbuild script at runtime and will use a metadata file using the same schema as the .csproj projects in your solution. .sln是一个主项目,在运行时转换为msbuild脚本,并将使用与解决方案中的.csproj项目相同的模式使用元数据文件。

To see what I'm talking about, open a command prompt, type "SET MSBUILDEMITSOLUTION=1" then "msbuild.exe solution.sln", then parse the new "solution.metaproj" and "solution.metaproj.tmp" files. 要查看我正在谈论的内容,请打开命令提示符,键入“SET MSBUILDEMITSOLUTION = 1”,然后键入“msbuild.exe solution.sln”,然后解析新的“solution.metaproj”和“solution.metaproj.tmp”文件。

Can someone please shed some light on the benefits, pros/cons of building a sln vs csproj in TFS, is there a common practice, a standard, or does it really matter? 有人可以了解一下在TFS中建立sln vs csproj的好处,优点/缺点,是否有通用的做法,标准,还是真的重要?

A .csproj would be a single project while a .sln would be a collection of projects. .csproj将是一个项目,而.sln将是项目的集合。 Building a single .csproj would yield the output binaries of that project (along with dependencies) and building the entire solution would yield the outputs of the entire solution. 构建单个.csproj将产生该项目的输出二进制文件(以及依赖项),并构建整个解决方案将产生整个解决方案的输出。

I had the same question. 我有同样的问题。 Build times may be a bit slower but I haven't tested this myself (probably a negliable difference). 构建时间可能会慢一些,但我自己没有测试过(可能是一个可忽略的差异)。 I believe that when you build using the solution file it will automatically set 'BuildInParallel' to true. 我相信当你使用解决方案文件构建时,它会自动将'BuildInParallel'设置为true。

Faster Buidls with MSBuild 使用MSBuild加快Buidls

I am currently working on the TFS 2012 deployment build. 我目前正在开发TFS 2012部署版本。 Based on what I experience, you don't have to provide MSBuild Arguments unless it is really required. 根据我的经验,除非确实需要,否则您不必提供MSBuild参数。

Lets take the following example: You have a solution with 2 projects, 让我们举个例子:你有一个包含2个项目的解决方案,

Soln
> Web Proj 1
> Console Proj 2
> Dependency Library Folder

case 1: building a sln 案例1:建立一个sln

a. 一个。 In source settings, you have to mention only your solution folder. 在源设置中,您只需提及解决方案文件夹。 The MSBuild will automatically take care of any dependencies as they are within the solution. MSBuild将自动处理解决方案中的任何依赖项。

b. In Process -> Items to build, you have to mention your solution file. 在Process - >要构建的项目中,您必须提及您的解决方案文件。

c. C。 For example, if your solution has a web project, then the MSBuild output will be as shown below, 例如,如果您的解决方案有一个Web项目,那么MSBuild输出将如下所示,

\\<build server> \d$\Builds\<Build Name>\<Build File Name>_20141210.6\_PublishedWebsites\<web proj>

Case 2: building a csproj 案例2:建立一个csproj

a. 一个。 In source settings, you have to mention only your csproject folder and also the dependency folder path separately. 在源设置中,您必须单独提及您的csproject文件夹以及依赖项文件夹路径。

b. In Process -> Items to build, you have to mention your csproject file. 在Process - >要构建的项目中,您必须提及您的csproject文件。

If you are looking for something more specific, please let us know. 如果您正在寻找更具体的信息,请告诉我们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM