错误 CS0111 已经定义了一个名为“InitializeComponent”且具有相同参数类型的成员

问题描述 投票:0回答:1

当我打开一个项目时,我的系统重新启动,现在我收到此错误。我发现这涉及 xaml,这不是 xaml。我有一个 C# Windows 项目。

我以前见过这个,我确定修复方法是卸载项目并删除冲突的条目。但似乎我是唯一一个不是在 xaml 项目上遇到此错误的人。所以我想知道是否还有其他人看过。

这是我的项目设置

<?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>
c#
1个回答
0
投票

如何将其添加到底部的主 cs 文件中

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

        }

我知道我没有添加这一点,我什至不知道这意味着什么。

© www.soinside.com 2019 - 2024. All rights reserved.