繁体   English   中英

我用 ILSpy 反编译了一个 do.net.dll 但 xaml 文件有一些问题

[英]I decompiled a dotnet .dll with ILSpy but the xaml files have some issues

我用 ILSpy 反编译了 a.dll,代码看起来不错,但我有一个 xaml 文件,它是:

<Window x:Class="PrinterManager.ShellView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:PrinterManager" xmlns:sys="clr-namespace:System;assembly=mscorlib" Title="Printer Manager" Height="450" Width="400" ResizeMode="NoResize" Icon="C:\Program Files (x86)\CENSURED" WindowState="Minimized" ShowInTaskbar="False" Visibility="Hidden">
.....MORE XAML STUFF....
      <Style x:Key="btnStyle" TargetType="{x:Type Button}">
....MORE XAML....

我有一堆错误:

Severity    Code    Description Project Path    File    Line    Suppression State
Error   CS0102  The type 'ShellView' already contains a definition for '_contentLoaded' PrinterManager  C:\Users\PietroConvalle\Documents\DotNetDecompileThingy\source\PrinterManager\obj\Debug\net5.0-windows  C:\Users\PietroConvalle\Documents\DotNetDecompileThingy\source\PrinterManager\obj\Debug\net5.0-windows\shellview.g.cs   44  Active
Error   CS0111  Type 'ShellView' already defines a member called 'InitializeComponent' with the same parameter types    PrinterManager  C:\Users\PietroConvalle\Documents\DotNetDecompileThingy\source\PrinterManager\obj\Debug\net5.0-windows  C:\Users\PietroConvalle\Documents\DotNetDecompileThingy\source\PrinterManager\obj\Debug\net5.0-windows\shellview.g.cs   51  Active
Error   CS0111  Type 'ShellView' already defines a member called 'System.Windows.Markup.IComponentConnector.Connect' with the same parameter types  PrinterManager  C:\Users\PietroConvalle\Documents\DotNetDecompileThingy\source\PrinterManager\obj\Debug\net5.0-windows  C:\Users\PietroConvalle\Documents\DotNetDecompileThingy\source\PrinterManager\obj\Debug\net5.0-windows\shellview.g.cs   71  Active


And many more

但是,如果我只是删除x:Class="PrinterManager.ShellView"错误就消失了,它可以正常构建和运行。

我确定这是一个微不足道的修复,但我从未在 C# 中编码,我怀疑这是一些依赖或配置问题?

抱歉,由于版权原因无法分享完整的源代码,但如果有帮助,我们很乐意分享一些额外的内容。

使用最新的 ILSpy 稳定版导出,c# 10.0 / VS 2022

更新:这似乎是我的问题https://stackoverflow.com/a/25849873/8340761但我不确定我应该更改什么?

要修复它,我只需要将每个 .xaml 文件移动到同一个文件名.cs 旁边

这个问题实际上已在 ILSpy 8 中修复

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM