单元测试在Visual Studio Team Services上失败由于写入权限而构建运行器?

时间:2015-12-18 19:27:16

标签: c# visual-studio tfsbuild xunit azure-devops

我有一个在Visual Studio Team Services上运行的构建,它运行一套XUnit测试,这些测试都在我的本地计算机上传递。该错误与加载我的项目中引用的c ++ dll(Interface.dll)有关。当它们在构建服务器上运行时,我收到以下错误

2015-12-18T17:40:24.3167397Z ##[error]Error Message:
2015-12-18T17:40:24.3197403Z ##[error]  Microsoft.Practices.Unity.ResolutionFailedException : Resolution of the dependency failed, type = "myapp.EntityModule.Entities.calc", name = "(none)".
2015-12-18T17:40:24.3197403Z ##[error]Exception occurred while: Calling constructor myapp.EntityModule.Entities.calc().
2015-12-18T17:40:24.3207417Z ##[error]Exception is: FileLoadException - Could not load file or assembly 'Interface.DLL' or one of its dependencies. The media is write protected. (Exception from HRESULT: 0x80070013)
2015-12-18T17:40:24.3217444Z ##[error]-----------------------------------------------
2015-12-18T17:40:24.3217444Z ##[error]At the time of the exception, the container was:
2015-12-18T17:40:24.3227399Z ##[error]
2015-12-18T17:40:24.3237398Z ##[error]  Resolving myapp.EntityModule.Entities.calc,(none)
2015-12-18T17:40:24.3237398Z ##[error]  Calling constructor myapp.EntityModule.Entities.calc()
2015-12-18T17:40:24.3247420Z ##[error]
2015-12-18T17:40:24.3247420Z ##[error]---- System.IO.FileLoadException : Could not load file or assembly 'Interface.DLL' or one of its dependencies. The media is write protected. (Exception from HRESULT: 0x80070013)
2015-12-18T17:40:24.3257416Z ##[error]Stack Trace:
2015-12-18T17:40:24.3267400Z ##[error]   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
2015-12-18T17:40:24.3267400Z ##[error]   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides)
2015-12-18T17:40:24.3277398Z ##[error]   at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides)
2015-12-18T17:40:24.3277398Z ##[error]   at Microsoft.Practices.Unity.UnityContainerExtensions.Resolve[T](IUnityContainer container, ResolverOverride[] overrides)
2015-12-18T17:40:24.3287422Z ##[error]   at myapp.EntityModule.Tests.Entities.Car.OutingSetup.OutingsetupTests.GetNewcalc()
2015-12-18T17:40:24.3297428Z ##[error]   at myapp.EntityModule.Tests.Entities.Car.OutingSetup.OutingsetupTests.OutingSetups_Ready_Rule_CasterSlugFrontInRangeWithUpperControlArmForeAdjLength_Right_TestReadyStatusValues(String simDescription, Double casterSlugFront, Double mountAdjustmentLengthFore, ReadyStatus expected)
2015-12-18T17:40:24.3297428Z ##[error]----- Inner Stack Trace -----
2015-12-18T17:40:24.3307426Z ##[error]   at myapp.EntityModule.Entities.Results.DymolaResults..ctor()
2015-12-18T17:40:24.3307426Z ##[error]   at myapp.EntityModule.Entities.calc..ctor()
2015-12-18T17:40:24.3317440Z ##[error]   at lambda_method(Closure , IBuilderContext )
2015-12-18T17:40:24.3317440Z ##[error]   at Microsoft.Practices.ObjectBuilder2.DynamicBuildPlanGenerationContext.<>c__DisplayClass1.<GetBuildMethod>b__0(IBuilderContext context)
2015-12-18T17:40:24.3327420Z ##[error]   at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context)
2015-12-18T17:40:24.3337422Z ##[error]   at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
2015-12-18T17:40:24.3347418Z ##[error]   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)

有关如何解决此问题的任何想法?

1 个答案:

答案 0 :(得分:0)

如果您使用的是托管代理,则必须知道构建是在没有管理员权限的情况下启动的,但我怀疑您的问题与您机器上的某些内容有关,而与其环境无关。

要尝试重现,您可以使用VS 2015和您的代码启动Azure VM并尝试运行相同的命令。您可能能够重现并查明错误:)