简体   繁体   English

Teamcity Nuget Pack忽略单元测试

[英]Teamcity Nuget Pack ignore unittests

I'm trying out Teamcity and am having a problem with the Nuget Pack runner type. 我正在尝试Teamcity,并且遇到了Nuget Pack跑步者类型的问题。 I've got my build working and it publishes the Nuget Package to the built in Nuget server. 我已经完成构建工作,并将发布的Nuget包发布到内置的Nuget服务器。 I'm able to use the package and everything is ok on that front. 我可以使用该程序包,并且在这方面一切正常。

However, I've adopted test driven development. 但是,我采用了测试驱动的开发。 The solution that contains the content of my Nuget Package also contains the code for my unit tests as well. 包含我的Nuget软件包内容的解决方案也包含我的单元测试的代码。 The unit tests are run in the build steps to ensure that the code is behaving as expected. 单元测试在构建步骤中运行,以确保代码按预期运行。

The problem is that the unit test projects are being exported as nuget packages in their own right! 问题在于,单元测试项目本身就是作为nuget包导出的! I'd like team city not to publish the unit test projects. 我希望Team City不要发布单元测试项目。

In the build step I have the following 在构建步骤中,我有以下内容

在此处输入图片说明

I've tried the following exlude files. 我尝试了以下排除文件。

在此处输入图片说明

The output of the build looks like this... 构建的输出如下所示:

在此处输入图片说明

I'd like to have Teamcity not create Cjd.LinchPin.UnitTests.*.nupkg. 我想让Teamcity不创建Cjd.LinchPin.UnitTests。*。nupkg。 It's not needed. 不需要

One last thing, I'm trying to create this as a build template which I'll be able to reuse for other projects in the future. 最后一件事,我正在尝试将其创建为构建模板,以后可以在其他项目中重用。 Hence why I'm trying to use Wildcards for the include and excludes. 因此,为什么要尝试对包含和排除使用通配符。

The question is, how can I make the nuget pack build step ignore any project with UnitTest in it's name? 问题是,如何使nuget pack的构建步骤忽略名称中带有UnitTest的任何项目?

I figured out an answer to this that will be acceptable. 我想出了一个可以接受的答案。 The trick is to use a .nuspec file. 诀窍是使用.nuspec文件。 This has to be created specifically for your nuget package. 这必须专门为您的nuget包创建。 It can be checked into the source control alongside the project. 可以将其与项目一起检查到源代码管理中。

This allows you to do clever things with the nuget package content as it's driven by the nuspec file rather than wildcards or anything like that. 这使您可以对nuget软件包的内容进行巧妙的处理,因为它是由nuspec文件而不是通配符或类似的东西驱动的。

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

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