MSBuild.Community.Tasks.Targets"没找到

时间:2016-12-14 19:07:21

标签: c# msbuild

我是C#的新手,我正在尝试打开解决方案文件并收到错误,因为" MSBuild.Community.Tasks.Targets"没找到,有谁能告诉我如何解决错误。我检查了各种解决方案无法解决这个问题

以下是错误

C:\Users\xxxxx\Desktop\HardwareDriver_R3\HardwareDriver_R3\HardwareDriver_R3\HardwareDrivers\HardwareDrivers.csproj : error  : The imported project "C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  C:\Users\xxxxx\Desktop\HardwareDriver_R3\HardwareDriver_R3\HardwareDriver_R3\HardwareDrivers\BTCommon.targets

以下是.csproj内容:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{89347491-E1C1-4604-AD3F-6EDB150A121F}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>HardwareDrivers</RootNamespace>
    <AssemblyName>HardwareDrivers</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </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>
    <PlatformTarget>x86</PlatformTarget>
    <DocumentationFile>bin\Debug\HardwareDrivers.XML</DocumentationFile>
    <NoWarn>1591</NoWarn>
  </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="ConfigurationReader, Version=0.1.0.0, Culture=neutral, processorArchitecture=x86">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>lib\ConfigurationReader.dll</HintPath>
    </Reference>
    <Reference Include="NationalInstruments.Common, Version=13.0.40.190, Culture=neutral, PublicKeyToken=dc6ad606294fc298, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>lib\NationalInstruments.Common.dll</HintPath>
    </Reference>
    <Reference Include="NationalInstruments.DAQmx, Version=9.9.40.39, Culture=neutral, PublicKeyToken=dc6ad606294fc298, processorArchitecture=x86">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>lib\NationalInstruments.DAQmx.dll</HintPath>
    </Reference>
    <Reference Include="OptoMMP2">
      <HintPath>lib\OptoMMP2.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Counters\CountersFactory.cs" />
    <Compile Include="Counters\CountersInterface.cs" />
    <Compile Include="Counters\NICounters\NICounters.cs" />
    <Compile Include="DigitalIO\DigitalIOBase.cs" />
    <Compile Include="DigitalIO\DigitalIOFactory.cs" />
    <Compile Include="DigitalIO\IDigitalIO.cs" />
    <Compile Include="DigitalIO\IDigitalIOBase.cs" />
    <Compile Include="DigitalIO\NIDigitalBase.cs" />
    <Compile Include="DigitalIO\NIDigitalIO.cs" />
    <Compile Include="DigitalIO\Opto22DigitalBase.cs" />
    <Compile Include="DigitalIO\Opto22DigitalIO.cs" />
    <Compile Include="Ethernet\EventArgs.cs" />
    <Compile Include="Ethernet\IEthernetClient.cs" />
    <Compile Include="Ethernet\IEthernetComm.cs" />
    <Compile Include="Ethernet\IEthernetServer.cs" />
    <Compile Include="Ethernet\VASTEthernetClient.cs" />
    <Compile Include="Ethernet\VASTEthernetServer.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Serial\AP4600SerialInterface.cs" />
    <Compile Include="Serial\DotNetSerial.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Serial\ISerial.cs" />
    <Compile Include="Serial\SerialFactory.cs" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="AnalogIO\placeholder.txt" />
  </ItemGroup>
  <ItemGroup />
  <Import Project="BTCommon.targets" Condition="Exists('BTCommon.targets')" />
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition="!Exists('BTCommon.targets')" />
  <PropertyGroup>
    <PostBuildEvent>
    </PostBuildEvent>
  </PropertyGroup>
  <PropertyGroup>
    <PreBuildEvent>copy "$(SolutionDir)HardwareDrivers\lib\ConfigurationReader.dll" "$(SolutionDir)HardwareDrivers\bin\Debug"
copy "$(SolutionDir)HardwareDrivers\lib\NationalInstruments.Common.dll" "$(SolutionDir)HardwareDrivers\bin\Debug"
copy "$(SolutionDir)HardwareDrivers\lib\NationalInstruments.Common.Native.dll" "$(SolutionDir)HardwareDrivers\bin\Debug"
copy "$(SolutionDir)HardwareDrivers\lib\NationalInstruments.Common.xml" "$(SolutionDir)HardwareDrivers\bin\Debug"
copy "$(SolutionDir)HardwareDrivers\lib\NationalInstruments.DAQmx.dll" "$(SolutionDir)HardwareDrivers\bin\Debug"
copy "$(SolutionDir)HardwareDrivers\lib\NationalInstruments.MStudioCLM.dll" "$(SolutionDir)HardwareDrivers\bin\Debug"
copy "$(SolutionDir)HardwareDrivers\lib\NationalInstruments.NiLmClientDLL.dll" "$(SolutionDir)HardwareDrivers\bin\Debug"</PreBuildEvent>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

1 个答案:

答案 0 :(得分:0)

  1. 步骤1:卸载出错的项目
  2. 步骤2:重建解决方案以恢复软件包
  3. 第3步:清洁解决方案
  4. 第4步:重新重建,问题将解决。