我有一个包含两个项目的 .Net 框架 4.7.1 解决方案。其中一个用于单元测试。这些单元测试在本地成功运行,但未在 Azure Pipelines 中运行。
管道:
YAML 下面,
<块引用>#您的构建管道引用了一个名为“BuildPlatform”的未定义变量。创建或编辑此 YAML 文件的构建管道,在变量选项卡上定义变量。见https://go.microsoft.com/fwlink/?linkid=865972 #您的构建管道引用了一个名为“BuildConfiguration”的未定义变量。创建或编辑此 YAML 文件的构建管道,在变量选项卡上定义变量。见https://go.microsoft.com/fwlink/?linkid=865972
步骤:
以下是错误日志:
<块引用> 2021-04-21T22:17:33.7444190Z **************** Starting test execution *********************
2021-04-21T22:17:33.7577516Z [command]C:\hostedtoolcache\windows\VsTest\16.9.4\x64\tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe
"@D:\a_temp\vgsj2dnktuj.tmp"
2021-04-21T22:17:33.9074880Z Microsoft (R) 测试执行命令行工具版本 16.9.4
2021-04-21T22:17:33.9075586Z 版权所有 (c) Microsoft Corporation。版权所有。
2021-04-21T22:17:33.9229321Z vstest.console.exe "D:\a\8\s\VentureAccess5NunitTest\bin\Debug\VentureAccess5NunitTest.dll"
2021-04-21T22:17:33.9230164Z /Settings:"D:\a_temp\j4c4nybwlvx.tmp.runsettings"
2021-04-21T22:17:33.9230650Z /记录器:“trx”
2021-04-21T22:17:33.9231040Z /TestAdapterPath:"D:\a\8\s"
2021-04-21T22:17:35.1891001Z 开始测试执行,请稍候...
2021-04-21T22:17:35.8177732Z 共有 1 个测试文件与指定模式匹配。
2021-04-21T22:17:54.0142297Z DocDelvAuditTest 失败 [15 秒]
2021-04-21T22:17:54.0269893Z 错误消息:
2021-04-21T22:17:54.0271211Z 无法创建 VentureAccess5NunitTest.Model.DocDelvEmailModelTest 类的实例。错误:
System.Exception:应用程序密钥:未找到 SQLCommandTimeOut。在
System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:54.0272513Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:54.0273141Z Stack Trace: 2021-04-21T22:17:54.0273699Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:54.0274405Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:54.0274954Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:54.0277235Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:54.0278511Z Standard Output Messages: 2021-04-21T22:17:54.0279077Z log4net: Configuration update mode [Merge]. 2021-04-21T22:17:54.0279660Z log4net: Logger [root] Level string is [ALL]. 2021-04-21T22:17:54.0280320Z log4net: Logger [root] level set to [name="ALL",value=-2147483648]. 2021-04-21T22:17:54.0281128Z log4net: Loading Appender [RollingLogFileAppender] type: [log4net.Appender.RollingFileAppender] 2021-04-21T22:17:54.0282039Z log4net: Setting Property [File] to String value [D:\\DebugLogs\\VentureAccess50Dev.log] 2021-04-21T22:17:54.0282811Z log4net: Setting Property [AppendToFile] to Boolean value [True] 2021-04-21T22:17:54.0283501Z log4net: Setting Property [RollingStyle] to RollingMode value [Size] 2021-04-21T22:17:54.0284203Z log4net: Setting Property [MaxSizeRollBackups] to Int32 value [10] 2021-04-21T22:17:54.0284846Z log4net: Setting Property [MaximumFileSize] to String value [1MB] 2021-04-21T22:17:54.0286546Z log4net: Setting Property [StaticLogFileName] to Boolean value [True] 2021-04-21T22:17:54.0287306Z log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0288078Z log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0288908Z log4net: Setting Property [ConversionPattern] to String value [%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n] 2021-04-21T22:17:54.0289714Z log4net: Converter [p] Option [] Format [min=5,max=2147483647,leftAlign=True] 2021-04-21T22:17:54.0291911Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0297285Z log4net: Converter [d] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0298738Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0300034Z log4net: Converter [r] Option [] Format [min=5,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0300823Z log4net: Converter [literal] Option [ms ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0301568Z log4net: Converter [c] Option [1] Format [min=22,max=22,leftAlign=True] 2021-04-21T22:17:54.0302349Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0303092Z log4net: Converter [M] Option [] Format [min=18,max=18,leftAlign=True] 2021-04-21T22:17:54.0303851Z log4net: Converter [literal] Option [ - ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0310200Z log4net: Converter [m] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0312287Z log4net: Converter [n] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0313144Z log4net: Setting Property [Layout] to object [log4net.Layout.PatternLayout] 2021-04-21T22:17:54.0313920Z log4net: Searched for existing files in [D:\DebugLogs] 2021-04-21T22:17:54.0314646Z log4net: curSizeRollBackups starts at [0] 2021-04-21T22:17:54.0315899Z log4net: Opening file for writing [D:\DebugLogs\VentureAccess50Dev.log] append [True] 2021-04-21T22:17:54.0316649Z log4net: Created Appender [RollingLogFileAppender] 2021-04-21T22:17:54.0317349Z log4net: Adding appender named [RollingLogFileAppender] to logger [root]. 2021-04-21T22:17:54.0317966Z log4net: Hierarchy Threshold [] 2021-04-21T22:17:54.0318406Z 2021-04-21T22:17:54.0318814Z Debug Trace: 2021-04-21T22:17:54.0319315Z log4net: Configuration update mode [Merge]. 2021-04-21T22:17:54.0319893Z log4net: Logger [root] Level string is [ALL]. 2021-04-21T22:17:54.0320554Z log4net: Logger [root] level set to [name="ALL",value=-2147483648]. 2021-04-21T22:17:54.0321380Z log4net: Loading Appender [RollingLogFileAppender] type: [log4net.Appender.RollingFileAppender] 2021-04-21T22:17:54.0322290Z log4net: Setting Property [File] to String value [D:\\DebugLogs\\VentureAccess50Dev.log] 2021-04-21T22:17:54.0323066Z log4net: Setting Property [AppendToFile] to Boolean value [True] 2021-04-21T22:17:54.0323956Z log4net: Setting Property [RollingStyle] to RollingMode value [Size] 2021-04-21T22:17:54.0324668Z log4net: Setting Property [MaxSizeRollBackups] to Int32 value [10] 2021-04-21T22:17:54.0325784Z log4net: Setting Property [MaximumFileSize] to String value [1MB] 2021-04-21T22:17:54.0326487Z log4net: Setting Property [StaticLogFileName] to Boolean value [True] 2021-04-21T22:17:54.0327224Z log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0327944Z log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0328761Z log4net: Setting Property [ConversionPattern] to String value [%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n] 2021-04-21T22:17:54.0329556Z log4net: Converter [p] Option [] Format [min=5,max=2147483647,leftAlign=True] 2021-04-21T22:17:54.0330315Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0331097Z log4net: Converter [d] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0331871Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0332656Z log4net: Converter [r] Option [] Format [min=5,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0333361Z log4net: Converter [literal] Option [ms ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0333990Z log4net: Converter [c] Option [1] Format [min=22,max=22,leftAlign=True] 2021-04-21T22:17:54.0334724Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0336066Z log4net: Converter [M] Option [] Format [min=18,max=18,leftAlign=True] 2021-04-21T22:17:54.0336746Z log4net: Converter [literal] Option [ - ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0337497Z log4net: Converter [m] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0338245Z log4net: Converter [n] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0339015Z log4net: Setting Property [Layout] to object [log4net.Layout.PatternLayout] 2021-04-21T22:17:54.0339633Z log4net: Searched for existing files in [D:\DebugLogs] 2021-04-21T22:17:54.0340225Z log4net: curSizeRollBackups starts at [0] 2021-04-21T22:17:54.0340980Z log4net: Opening file for writing [D:\DebugLogs\VentureAccess50Dev.log] append [True] 2021-04-21T22:17:54.0341662Z log4net: Created Appender [RollingLogFileAppender] 2021-04-21T22:17:54.0342326Z log4net: Adding appender named [RollingLogFileAppender] to logger [root]. 2021-04-21T22:17:54.0343202Z log4net: Hierarchy Threshold [] 2021-04-21T22:17:54.0492287Z log4net: Shutdown called on Hierarchy [log4net-default-repository] 2021-04-21T22:17:54.1082194Z NUnit Adapter 3.17.0.0: Test execution started 2021-04-21T22:17:54.3154715Z Running all tests in D:\a\8\s\VentureAccess5NunitTest\bin\Debug\VentureAccess5NunitTest.dll 2021-04-21T22:17:54.9317980Z NUnit3TestExecutor discovered 239 of 239 NUnit test cases 2021-04-21T22:17:55.4623137Z Failed DocDelvAuditTest_Negative [3 ms] 2021-04-21T22:17:55.4624317Z Error Message: 2021-04-21T22:17:55.4625714Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvEmailModelTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary
2.get_Item(TKey key)
2021-04-21T22:17:55.4627189Z 在 VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String
钥匙)。
2021-04-21T22:17:55.4628800Z 堆栈跟踪:
2021-04-21T22:17:55.4639153Z 在 VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String
钥匙)
2021-04-21T22:17:55.4640388Z 在 VentureAccess5.DAL.Database..ctor()
2021-04-21T22:17:55.4641271Z 在 VentureAccess5.Models.DocDelvEmail..ctor()
2021-04-21T22:17:55.4644686Z 在 VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() 中
D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line
29
2021-04-21T22:17:55.4653553Z GetEmailImageUrlTest 失败 [1 毫秒]
2021-04-21T22:17:55.4654749Z 错误消息:
2021-04-21T22:17:55.4657218Z 无法创建 VentureAccess5NunitTest.Model.DocDelvEmailModelTest 类的实例。错误:
System.Exception:应用程序密钥:未找到 SQLCommandTimeOut。在
System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:55.4658473Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:55.4665795Z Stack Trace: 2021-04-21T22:17:55.4666361Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:55.4666992Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:55.4667461Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:55.4668265Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:55.4669143Z Failed GetNextUniqueIdTest [1 ms] 2021-04-21T22:17:55.4669563Z Error Message: 2021-04-21T22:17:55.4674006Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvEmailModelTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary
2.get_Item(TKey key)
2021-04-21T22:17:55.4683289Z 在 VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String
钥匙)。
2021-04-21T22:17:55.4684012Z 堆栈跟踪:
2021-04-21T22:17:55.4684678Z 在 VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String
钥匙)
2021-04-21T22:17:55.4685367Z 在 VentureAccess5.DAL.Database..ctor()
2021-04-21T22:17:55.4685943Z 在 VentureAccess5.Models.DocDelvEmail..ctor()
2021-04-21T22:17:55.4686869Z 在 VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() 中
D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line
29
2021-04-21T22:17:55.4687746Z GetRetEmail 失败 [1 毫秒]
2021-04-21T22:17:55.4688235Z 错误消息:
2021-04-21T22:17:55.4689308Z 无法创建 VentureAccess5NunitTest.Model.DocDelvEmailModelTest 类的实例。错误:
System.Exception:应用程序密钥:未找到 SQLCommandTimeOut。在
System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:55.4690713Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:55.4691348Z Stack Trace: 2021-04-21T22:17:55.4691976Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:55.4692959Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:55.4693514Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:55.4694411Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:55.4695281Z Failed GetRetEmail2 [1 ms] 2021-04-21T22:17:55.4695762Z Error Message: 2021-04-21T22:17:55.4696850Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvEmailModelTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary
2.get_Item(TKey key)
2021-04-21T22:17:55.4698326Z 在 VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String
钥匙)。
2021-04-21T22:17:55.4698938Z 堆栈跟踪:
2021-04-21T22:17:55.4699578Z 在 VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String
钥匙)
2021-04-21T22:17:55.4700226Z 在 VentureAccess5.DAL.Database..ctor()
2021-04-21T22:17:55.4700806Z 在 VentureAccess5.Models.DocDelvEmail..ctor()
2021-04-21T22:17:55.4701713Z 在 VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() 中
D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line
29
2021-04-21T22:17:55.4702577Z GetSkipEmailData 失败 [1 毫秒]
2021-04-21T22:17:55.4703074Z 错误消息:
2021-04-21T22:17:55.4704340Z 无法创建 VentureAccess5NunitTest.Model.DocDelvEmailModelTest 类的实例。错误:
System.Exception:应用程序密钥:未找到 SQLCommandTimeOut。在
System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:55.4705809Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:55.4706424Z Stack Trace: 2021-04-21T22:17:55.4707047Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:55.4707729Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:55.4708295Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:55.4709203Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:55.4710089Z Failed DocDelvAuditTest [3 ms] 2021-04-21T22:17:55.4710716Z Error Message: 2021-04-21T22:17:55.4711786Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvFaxTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary
2.get_Item(TKey key)
2021-04-21T22:17:55.4712961Z 在 VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String
键)。
答案 0 :(得分:0)
首先,如果您不介意,可以使用自托管代理,那么您的应用就相当于在本地运行,不会受到 Azure DevOps 计费限制。
单击 this document 可了解有关自托管代理和 Microsoft 托管代理的详细信息。
点击 Self-hosted Windows agents 获取有关创建自托管代理的教程:
如果您想使用 Microsoft 托管的代理,这里有一些故障排除建议:
经典 UI 管道默认使用 vs2017-win2016
代理,它不支持许多新功能。我建议您使用 windows-2019
代理。
确保应用中的所有路径都是相对路径。 Microsoft 托管的代理不会读取您的本地内容,因此如果您需要本地引用,您应该将它们上传到存储库,或者通过 NuGet 还原、cmd 等将它们下载到代理。
与 2 类似,here 是 Microsoft 托管代理的下载软件列表。请检查是否有任何您需要的软件,但尚未下载 Microsoft 代理。您需要在运行测试任务之前下载它们。