Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 引用.NET标准1.6项目时,.NET 4.7 xunit测试项目无法生成_C#_.net_.net Core_Azure Devops - Fatal编程技术网

C# 引用.NET标准1.6项目时,.NET 4.7 xunit测试项目无法生成

C# 引用.NET标准1.6项目时,.NET 4.7 xunit测试项目无法生成,c#,.net,.net-core,azure-devops,C#,.net,.net Core,Azure Devops,因此,我有一个包含2个项目的简单解决方案: .NET标准1.6类库 .NET4.7框架类库,带有用于测试的xUnit 现在,当我尝试在本地构建(在VS2017中)时,一切正常 在Visual Studio Online/Team Services上构建时,会出现大量错误:- [command]"C:\Program Files\dotnet\dotnet.exe" build d:\a\1\s\src\Hornet.Services\Hornet.Services.csproj -c re

因此,我有一个包含2个项目的简单解决方案:

  • .NET标准1.6类库
  • .NET4.7框架类库,带有用于测试的xUnit

现在,当我尝试在本地构建(在VS2017中)时,一切正常

在Visual Studio Online/Team Services上构建时,会出现大量错误:-

[command]"C:\Program Files\dotnet\dotnet.exe" build d:\a\1\s\src\Hornet.Services\Hornet.Services.csproj -c release /p:Version=1.0.0
Microsoft(R) Build Engine version 15.1.1012.6693
Copyright(C) Microsoft Corporation.All rights reserved.

Hornet.Services -> d:\a\1\s\src\Hornet.Services\bin\release\netstandard1.6\Hornet.Services.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)
/\___工作!(不是NS1.6版本)

要在同一解决方案中构建的下一个项目

[command]"C:\Program Files\dotnet\dotnet.exe" build d:\a\1\s\tests\Hornet.Services.Tests\Hornet.Services.Tests.csproj -c release /p:Version= 1.0.0
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation.All rights reserved.

Hornet.Services -> d:\a\1\s\src\Hornet.Services\bin\release\netstandard1.6\Hornet.Services.dll
C:\Program Files\dotnet\sdk\1.0.4\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3245: Could not resolve this reference.Could not locate the assembly "Castle.Core, Version=4.1.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL". Check to make sure the assembly exists on disk.If this reference is required by your code, you may get compilation errors. [d:\a\1\s\tests\Hornet.Services.Tests\Hornet.Services.Tests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "FizzWare.NBuilder, Version=5.0.0.138, Culture=neutral, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [d:\a\1\s\tests\Hornet.Services.Tests\Hornet.Services.Tests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "FluentValidation, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [d:\a\1\s\tests\Hornet.Services.Tests\Hornet.Services.Tests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Google.Apis, Version=1.28.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [d:\a\1\s\tests\Hornet.Services.Tests\Hornet.Services.Tests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Google.Apis.Core, Version=1.28.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [d:\a\1\s\tests\Hornet.Services.Tests\Hornet.Services.Tests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Google.Apis.PlatformServices, Version=1.28.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [d:\a\1\s\tests\Hornet.Services.Tests\Hornet.Services.Tests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Google.Apis.QPXExpress.v1, Version=1.28.0.554, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [d:\a\1\s\tests\Hornet.Services.Tests\Hornet.Services.Tests.csproj]

.. <lots more snipped>
而我认为VSTS正在使用
1.0.2

==============================================================================
 Task         : .NET Core
 Description  : Build, test and publish using dotnet core command-line.
 Version      : 1.0.2
 Author       : Microsoft Corporation
 Help         : [More Information] (https://go.microsoft.com/fwlink/?linkid=832194)

我相信我找到了我的答案->我正在尝试执行以下步骤,所有步骤都以为目标。NET CORE

  • 恢复
  • 建造
  • 试验
  • 打包
  • 但这些都是.NET的核心步骤。。测试项目是一个.NET4.7项目

    所以我没有建立测试项目。。。这就是它出错的原因!该死

    非常尴尬


    因此,TL;博士;/这里的要点是仔细检查VSTS构建步骤,并确保它们针对的是正确的项目。

    尝试在您的代理上安装VS2017预览您的意思是
    代理队列:托管VS2017
    ?这就是当前值。不完全正确!我的意思是创建一个安装了vs2017预览版的私有代理!不难,但要让它工作起来有点假!查看这里的发行说明,框架/标准/核心互操作仅在preview3中引入。不确定更新了什么工具以允许此操作。希望有更多的人能帮助你。同时,您可以创建一个VSTS任务,以便在构建步骤之前安装最新的预览NetCore工具,并查看其中的帮助!
    ==============================================================================
     Task         : .NET Core
     Description  : Build, test and publish using dotnet core command-line.
     Version      : 1.0.2
     Author       : Microsoft Corporation
     Help         : [More Information] (https://go.microsoft.com/fwlink/?linkid=832194)