简体   繁体   English

无法在 Visual Studio 2017 中构建我的单元测试项目

[英]Unable to build My Unit Test Project in Visual Studio 2017

I'm getting this error when I build my solution, including a Unit Test project.构建解决方案(包括单元测试项目)时出现此错误。

This project references NuGet package(s) that are missing on this computer.此项目引用此计算机上缺少的 NuGet 包。 Use NuGet Package Restore to download them.使用 NuGet Package Restore 来下载它们。 For more information, see http://go.microsoft.com/fwlink/?LinkID=322105 .有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkID=322105 The missing file is ..\\packages\\MSTest.TestAdapter.1.1.11\\build\\net45\\MSTest.TestAdapter.targets.丢失的文件是 ..\\packages\\MSTest.TestAdapter.1.1.11\\build\\net45\\MSTest.TestAdapter.targets。

.csproj file .csproj 文件

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{77FE5641-248D-4D82-850A-1B53495CB9A9}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>UnitTest</RootNamespace>
    <AssemblyName>UnitTest</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
    <IsCodedUITest>False</IsCodedUITest>
    <TestProjectType>UnitTest</TestProjectType>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
    </Reference>
    <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
    </Reference>
    <Reference Include="System.Web.Extensions" />
    <Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="GenerateConceptService\GenerateConceptServiceUnitTest.cs" />
    <Compile Include="SocialMedia\SocialMediaServiceTest.cs" />
    <Compile Include="SocialMedia\TwitterActionsTest.cs" />
    <Compile Include="UnitTest1.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config">
      <SubType>Designer</SubType>
    </None>
    <None Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Core.WindowsServices\Core.GenerateConcept\Core.GenerateConcept.csproj">
      <Project>{767FA3B9-55C4-4C3D-AEB8-7912A09AF868}</Project>
      <Name>Core.GenerateConcept</Name>
    </ProjectReference>
    <ProjectReference Include="..\CoreApi2\CoreApi2.Api\CoreApi2.Api.csproj">
      <Project>{55466732-A2A7-479D-B4A1-99FB2732DCE6}</Project>
      <Name>CoreApi2.Api</Name>
    </ProjectReference>
    <ProjectReference Include="..\CoreApi2\CoreApi2.Model\CoreApi2.Model.csproj">
      <Project>{24fba440-a133-4024-87c9-a77d0b7af659}</Project>
      <Name>CoreApi2.Model</Name>
    </ProjectReference>
    <ProjectReference Include="..\CoreApi2\CoreApi2.Services\CoreApi2.Services.csproj">
      <Project>{d2a117bf-d7e5-4483-bb35-71336b8e8404}</Project>
      <Name>CoreApi2.Services</Name>
    </ProjectReference>
    <ProjectReference Include="..\Infrastructure\Informanagement.Infrastructure\Informanagement.Infrastructure.csproj">
      <Project>{92C12E85-209B-4F16-BB1E-B1E120EFB4EB}</Project>
      <Name>Informanagement.Infrastructure</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props'))" />
    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets'))" />
  </Target>
  <Import Project="..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets')" />
</Project>

I have broken refrences:我已经打破了参考:

在此处输入图片说明

I got a fix around this error, actually I was having a different version of MSTest.TestAdapter (1.3.2) in my packages folder and in .csproj file references were pointing to MSTest.TestAdapter (1.1.0).我解决了这个错误,实际上我的包文件夹中有一个不同版本的MSTest.TestAdapter (1.3.2),在.csproj文件引用指向MSTest.TestAdapter (1.1.0)。 I have replaced all the MSTest.TestAdapter (1.1.0) to MSTest.TestAdapter (1.3.2), and this resolved my issue.我已将所有MSTest.TestAdapter (1.1.0) 替换为MSTest.TestAdapter (1.3.2),这解​​决了我的问题。

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

相关问题 无法在Visual Studio 2017 Enterprise MSTest硒单元测试C#中向我的项目中找到/添加订购的测试项目 - Unable to find/add ordered test item to my project in Visual Studio 2017 Enterprise MSTest Selenium Unit Tests C# 无法在Visual Studio 2017 Professional中运行单元测试 - Unable to run the unit test in visual studio 2017 professional Visual Studio 2017无法加载项目 - Visual Studio 2017 unable to load project Visual Studio 2017企业添加单元测试项目引发程序包安装错误 - Visual Studio 2017 Enterprise Add Unit Test project throws Package Installation Error 如何在仍然引用 NUnit 的同时使我的 Visual Studio 2017 项目不是测试项目 - How can I make my visual studio 2017 project NOT a test project while still referencing NUnit 如何在Visual Studio 2017 15.6.0中调试单元测试 - How can I debug unit test in Visual Studio 2017 15.6.0 Visual Studio 2017 + NUnit + Resharper中的配置文件单元测试 - Profile unit test in Visual Studio 2017 + NUnit + Resharper 如何在Visual Studio 2017中创建单元测试(包括数据库)? - How to create Unit Test (include Database) in visual studio 2017? 如何在视觉工作室之外对项目进行单元测试 - How to unit test a project outside visual studio Visual Studio 2017不在测试资源管理器中显示我的测试 - Visual Studio 2017 not displaying my test in the Test Explorer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM