admin管理员组

文章数量:1204391

My system rebooted while I had a project open and now I get this error. Evert hing I find on this deals with xaml, this is not xaml. I have a c# windows project.

I have seen this before and I was sure the fix was to unload the project and remove a conflicting entry. But it seems I'm the only person to ever get this error not on a xaml project. So I'm wondering if anyone else has seen it.

this is my project settings

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns=";>
  <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>{B0235FD1-C723-4F60-825D-A1A78D19BC84}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>BlendTool</RootNamespace>
    <AssemblyName>BlendTool</AssemblyName>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <TargetFrameworkProfile />
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <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' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationIcon>icon_logo.ico</ApplicationIcon>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="LibUsbDotNet">
      <HintPath>.\LibUsbDotNet.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Management" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Update="BlendTool.Designer.cs">
     <DependentUpon>BlendTool.cs</DependentUpon>
    </Compile>
    <Compile Include="BlendTool.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="BlendTool.Designer.cs">
      <DependentUpon>BlendTool.cs</DependentUpon>
    </Compile>
    <Compile Include="flashUtils.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="USBInterface\ArrayHelpers.cs" />
    <Compile Include="USBInterface\DeviceScanner.cs" />
    <Compile Include="USBInterface\HidApi.cs" />
    <Compile Include="USBInterface\ReportEventArgs.cs" />
    <Compile Include="USBInterface\USBDevice.cs" />
    <EmbeddedResource Include="BlendTool.resx">
      <DependentUpon>BlendTool.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <SubType>Designer</SubType>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <None Include="packages.config" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <ItemGroup>
    <None Include="images\usb_info.png" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="bin\Release\" />
    <Folder Include="Resources\" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="hidapi.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="favicon.ico" />
    <Content Include="flash.ico" />
    <Content Include="icon_logo.ico" />
    <None Include="images\usb_info2.png" />
    <None Include="images\banner.png" />
    <None Include="images\usb4.png" />
    <None Include="images\usb3.png" />
    <None Include="images\usb2.jpg" />
    <None Include="images\usb2.jpg" />
    <None Include="images\usb2.png" />
    <None Include="images\usb1.png" />
    <None Include="images\logo.png" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="..\packages\Microsoft.NETFramework.ReferenceAssemblies45.1.0.3\build\Microsoft.NETFramework.ReferenceAssemblies45.targets" Condition="Exists('..\packages\Microsoft.NETFramework.ReferenceAssemblies45.1.0.3\build\Microsoft.NETFramework.ReferenceAssemblies45.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 /?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\Microsoft.NETFramework.ReferenceAssemblies45.1.0.3\build\Microsoft.NETFramework.ReferenceAssemblies45.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.NETFramework.ReferenceAssemblies45.1.0.3\build\Microsoft.NETFramework.ReferenceAssemblies45.targets'))" />
  </Target>

  <!-- 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>

My system rebooted while I had a project open and now I get this error. Evert hing I find on this deals with xaml, this is not xaml. I have a c# windows project.

I have seen this before and I was sure the fix was to unload the project and remove a conflicting entry. But it seems I'm the only person to ever get this error not on a xaml project. So I'm wondering if anyone else has seen it.

this is my project settings

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>{B0235FD1-C723-4F60-825D-A1A78D19BC84}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>BlendTool</RootNamespace>
    <AssemblyName>BlendTool</AssemblyName>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <TargetFrameworkProfile />
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <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' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationIcon>icon_logo.ico</ApplicationIcon>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="LibUsbDotNet">
      <HintPath>.\LibUsbDotNet.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Management" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Update="BlendTool.Designer.cs">
     <DependentUpon>BlendTool.cs</DependentUpon>
    </Compile>
    <Compile Include="BlendTool.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="BlendTool.Designer.cs">
      <DependentUpon>BlendTool.cs</DependentUpon>
    </Compile>
    <Compile Include="flashUtils.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="USBInterface\ArrayHelpers.cs" />
    <Compile Include="USBInterface\DeviceScanner.cs" />
    <Compile Include="USBInterface\HidApi.cs" />
    <Compile Include="USBInterface\ReportEventArgs.cs" />
    <Compile Include="USBInterface\USBDevice.cs" />
    <EmbeddedResource Include="BlendTool.resx">
      <DependentUpon>BlendTool.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <SubType>Designer</SubType>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <None Include="packages.config" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <ItemGroup>
    <None Include="images\usb_info.png" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="bin\Release\" />
    <Folder Include="Resources\" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="hidapi.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="favicon.ico" />
    <Content Include="flash.ico" />
    <Content Include="icon_logo.ico" />
    <None Include="images\usb_info2.png" />
    <None Include="images\banner.png" />
    <None Include="images\usb4.png" />
    <None Include="images\usb3.png" />
    <None Include="images\usb2.jpg" />
    <None Include="images\usb2.jpg" />
    <None Include="images\usb2.png" />
    <None Include="images\usb1.png" />
    <None Include="images\logo.png" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="..\packages\Microsoft.NETFramework.ReferenceAssemblies.net45.1.0.3\build\Microsoft.NETFramework.ReferenceAssemblies.net45.targets" Condition="Exists('..\packages\Microsoft.NETFramework.ReferenceAssemblies.net45.1.0.3\build\Microsoft.NETFramework.ReferenceAssemblies.net45.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\Microsoft.NETFramework.ReferenceAssemblies.net45.1.0.3\build\Microsoft.NETFramework.ReferenceAssemblies.net45.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.NETFramework.ReferenceAssemblies.net45.1.0.3\build\Microsoft.NETFramework.ReferenceAssemblies.net45.targets'))" />
  </Target>

  <!-- 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>
Share Improve this question asked Jan 20 at 16:10 user2144480user2144480 1,0977 silver badges12 bronze badges 2
  • The xml is irrelevant, instead do a Text search in *.cs and then you should find a file that defines InitializeComponent more than once. Then somehow you need to deal with that: in any case keep one, but if they are different then you'll have to maybe experiment which is the best one to keep. – Peter B Commented Jan 20 at 16:21
  • You posted the project file. Since code worked previously the problem is not with the project file. You can check the date of the project file and it did not change when the computer rebooted. I would do a clean build of the project which will remove the intermediate obj and files in the bin folder. Or you can delete the obj and bin folder and the compile. – jdweng Commented Jan 20 at 16:56
Add a comment  | 

1 Answer 1

Reset to default 0

some how this was added to my main cs file at the bottom

 private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // BlendTool
            // 
            this.ClientSize = new System.Drawing.Size(823, 639);
            this.Name = "BlendTool";
            this.ResumeLayout(false);

        }

I know for a fact I did not add that, hell I'm not even sure what it means.

本文标签: