wpf 警告-类型库“System_Windows_Forms”已从CLR程序集中导出,无法作为CLR程序集重新导入

0ve6wy6x  于 2023-01-06  发布在  Windows
关注(0)|答案(1)|浏览(362)

在使用VS2022的WPF应用程序中,我想考虑使用FolderBrowserDialog,所以添加了System_Windows_Forms引用。我决定不使用FolderBrowserDialog,也不需要此引用。
在解决方案中找不到引用Forms的示例。未使用FolderBrowserDialog。
此警告仍然存在。
右击项目-〉删除未使用的引用没有帮助("没有找到未使用的引用")。关闭VS并重新打开也没有帮助。
删除. obj目录没有帮助。
这只是一个警告,程序运行正常。有什么办法解决这个问题吗?
编辑:
我最初通过右键单击project-〉Add-〉COM Reference,然后选择System_Windows_Forms,version 2.4来添加引用。
编辑#2:. csproj文件

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <RootNamespace>BKMorse2</RootNamespace>
    <Nullable>enable</Nullable>
    <UseWPF>true</UseWPF>
    <PlatformTarget>x64</PlatformTarget>
    <StartupObject>BKMorse2.App</StartupObject>
    <ApplicationIcon>Resources\CodeKey1.ico</ApplicationIcon>
    <BaseOutputPath>C:\Users\bkrau\OneDrive\Desktop\BK Morse 2\Any CPU\Release</BaseOutputPath>
    <BaseIntermediateOutputPath></BaseIntermediateOutputPath>
    <Title>BK Morse 2</Title>
    <PackageProjectUrl>Copyright BK Morse 2022</PackageProjectUrl>
    <PackageIcon>Resources\CodeKey1.ico</PackageIcon>
    <PackageReleaseNotes>Initial Release</PackageReleaseNotes>
    <EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
    <AnalysisLevel>6.0-all</AnalysisLevel>
    <NeutralLanguage>en-US</NeutralLanguage>
    <AssemblyVersion>1.0.0.2</AssemblyVersion>
    <FileVersion>1.0.0.2</FileVersion>
    <UseWindowsForms>False</UseWindowsForms>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <Optimize>False</Optimize>
    <WarningLevel>7</WarningLevel>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <Optimize>False</Optimize>
    <WarningLevel>7</WarningLevel>
  </PropertyGroup>

  <ItemGroup>
    <None Remove="ARRL512.png" />
    <None Remove="CheckPng.png" />
    <None Remove="morse-code.ico" />
    <None Remove="Resources\BKMorse2ScreenshotWithNumbers.jpg" />
    <None Remove="Resources\Enter Copy Text Here.png" />
    <None Remove="Resources\EnterTextHere.gif" />
    <None Remove="Resources\FolderClosed.png" />
    <None Remove="Resources\NewEvent.png" />
    <None Remove="Resources\play-outline.png" />
    <None Remove="Resources\Play.svg" />
    <None Remove="Resources\Trash.png" />
    <None Remove="Resource\ARRLSessions.xml" />
    <None Remove="Resource\ARRL_diamond_logo.png" />
    <None Remove="Resource\DownArrow.png" />
    <None Remove="Resource\EnterTextHere.gif" />
    <None Remove="Resource\Plus48.png" />
    <None Remove="Resource\RedX.png" />
    <None Remove="Resource\Trashcan48.png" />
    <None Remove="Resource\UpArrow.png" />
  </ItemGroup>

  <ItemGroup>
    <COMReference Include="{215d64d2-031c-33c7-96e3-61794cd1ee61}">
      <WrapperTool>tlbimp</WrapperTool>
      <VersionMinor>4</VersionMinor>
      <VersionMajor>2</VersionMajor>
      <Guid>215d64d2-031c-33c7-96e3-61794cd1ee61</Guid>
    </COMReference>
  </ItemGroup>

  <ItemGroup>
    <Content Include="Resources\CodeKey1.ico" />
  </ItemGroup>

  <ItemGroup>
    <None Include="..\.editorconfig" Link=".editorconfig" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Extended.Wpf.Toolkit" Version="4.5.0" />
  </ItemGroup>

  <ItemGroup>
    <Resource Include="Resources\BKMorse2ScreenshotWithNumbers.jpg" />
    <Resource Include="Resources\CodeKey1.jpg" />
    <Resource Include="morse-code.ico" />
    <Resource Include="Resources\Enter Copy Text Here.png" />
    <Resource Include="Resources\EnterTextHere.gif" />
    <Resource Include="Resources\FolderClosed.png" />
    <Resource Include="Resources\NewEvent.png" />
    <Resource Include="Resources\play-outline.png" />
    <Resource Include="Resources\Play.svg" />
    <Resource Include="Resources\Trash.png" />
    <Resource Include="Resource\ARRLSessions.xml" />
    <Resource Include="Resource\ARRL_diamond_logo.png" />
    <Resource Include="Resource\CheckPng.png" />
    <Resource Include="Resource\ARRL512.png" />
    <Resource Include="Resource\DownArrow.png" />
    <Resource Include="Resource\EnterTextHere.gif" />
    <Resource Include="Resource\Plus48.png" />
    <Resource Include="Resource\RedX.png" />
    <Resource Include="Resource\Trashcan48.png" />
    <Resource Include="Resource\UpArrow.png" />
  </ItemGroup>

  <ItemGroup>
    <Compile Update="Properties\Resources.Designer.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Update="Properties\Settings.Designer.cs">
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
    </Compile>
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Update="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>

  <ItemGroup>
    <None Update="Resources\CodeKey1.jpg">
      <Pack>True</Pack>
      <PackagePath>\</PackagePath>
    </None>
    <None Update="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
  </ItemGroup>

</Project>
nnsrf1az

nnsrf1az1#

如果您的项目类型是“WPF .NET”,那么到窗体的链接就在项目属性中。
我在截图中显示了它,但我立即警告你,我有一个俄罗斯的工作室。我想你,但是,会理解的。
如果不清楚,那就写--我会让人在英语工作室里截图。

在提供项目文件的XML内容后更新响应。

在我看来,唯一有问题的元素是带有<COMReference Include="{215d64d2-031c-33c7-96e3-61794cd1ee61}">的组。尝试删除它,看看会发生什么。

相关问题