我正在尝试为使用 Fakes 库进行单元测试的项目设置自动构建和单元测试.该项目在我的 Windows 10 PC(安装了 VS 2017 Enterprise)上构建和测试良好,但是使用相同的命令在构建服务器上编译项目(也是带有 VS 2017 Enterprise 的 Windows 10)给出了几个关于 Fakes 不存在的错误.确切的错误如下所示:
I'm trying to set up automated builds and unit testing for a project which uses the Fakes library for it's unit tests. The project builds and tests fine on my Windows 10 PC (VS 2017 Enterprise installed), however using the same command to compile the project on the build server (also windows 10 with VS 2017 Enterprise) gives several errors about the Fakes not existing. The exact errors look like this:
XControllerTests.cs(10,20):错误 CS0234:命名空间System.Data.Common"中不存在类型或命名空间Fakes"(您是否缺少程序集引用?)[C:RunneruildsxxxXTests.csproj]
根据我的研究,这是由使用旧版本的 MSBuild 引起的,但是我检查了服务器,并确认它具有最新版本 &安装了 Visual Studio 的更新.我还确认构建脚本使用的是正确版本的 MSBuild.exe,即 c:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuild15.0BinMSBuild.exe代码>.在我的桌面上使用这个版本可以正确编译项目.
From my research, this is caused by using an old version of MSBuild, however I have checked the server, and confirmed it has the latest version & updates for visual studio installed. I also confirmed that the build script is using the correct version of MSBuild.exe, which is c:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuild15.0BinMSBuild.exe. Using this version on my desktop correctly compiles the project.
为什么构建不能在(相同设置)构建服务器上工作?
Why does the build not work on the (identical setup) build server?
为了扩展上面@McMlok 的答案,我将包括我所做的.
To extend @McMlok's answer above, i'll include what i did.
复制Fakes文件夹:
c:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuildMicrosoftVisualStudiov15.0c:Program Files (x86)Microsoft Visual Studio2017BuildToolsMSBuildMicrosoftVisualStudiov15.0复制 Microsoft.QualityTools.Testing.Fakes.ImportAfter.targets 文件:
c:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuild15.0Microsoft.Common.targetsImportAfterc:Program Files (x86)Microsoft Visual Studio2017BuildToolsMSBuild15.0Microsoft.Common.TargetsImportAfter复制 Microsoft.QualityTools.Testing.Fakes.dll 文件:
c:Program Files (x86)Microsoft Visual Studio2017EnterpriseCommon7IDEPublicAssembliesGAC/%windir%Microsoft.NETassembly现在构建良好.谢谢麦克姆洛克.
Builds fine now. Thanks McMlok.
这篇关于MSBuild 15 - 命名空间中不存在类型或命名空间“Fakes"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
是否有执行 Excel NORMINV 函数的 C# 库?Is there a C# library that will perform the Excel NORMINV function?(是否有执行 Excel NORMINV 函数的 C# 库?)
从 C# 中的加权列表中选择 x 个随机元素(无需替换Select x random elements from a weighted list in C# (without replacement)(从 C# 中的加权列表中选择 x 个随机元素(无需替换))
给定轮班列表,创建时间表的摘要描述Create a summary description of a schedule given a list of shifts(给定轮班列表,创建时间表的摘要描述)
C# 普通随机数C# Normal Random Number(C# 普通随机数)
通用列表的标准偏差?Standard deviation of generic list?(通用列表的标准偏差?)
AsyncCTP:创建一个 IAwaitable 的类AsyncCTP: Creating a class that is IAwaitable(AsyncCTP:创建一个 IAwaitable 的类)