无法在设计师中打开Windowsform

发布于 2025-01-19 17:49:00 字数 3274 浏览 0 评论 0原文

从 NetFramework 4.5 迁移到 .Net 5.0 后,我的 WindowsForm 无法在设计器中打开。

输出如下:

Microsoft.DotNet.DesignTools.Client.Host.ServerProcess.d__30.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     
    Microsoft.DotNet.DesignTools.Client.Host.ServerProcess.d__25.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    Microsoft.DotNet.DesignTools.Client.Host.ServerHostFactory.d__7.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    
    Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.d__28.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    
    Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.d__28.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    
    Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.<>c__DisplayClass24_1.<<-ctor>b__1>d.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    
    Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.d__26.MoveNext()  
 

我还查看了 Microsoft 应用程序事件管理器,发现:

 Application: DesignToolsServer.exe
    CoreCLR Version: 5.0.1522.11506
    .NET Version: 5.0.15
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.Logging, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
    File name: 'Microsoft.Extensions.Logging, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
       at Microsoft.DotNet.DesignTools.Server.Program.<>c.<Main>b__2_0(ILoggingBuilder configure)
       at Microsoft.Extensions.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(IServiceCollection services, Action`1 configure)
       at Microsoft.Extensions.Logging.LoggerFactory.Create(Action`1 configure)
       at Microsoft.DotNet.DesignTools.Server.Program.Main(String[] args, IEnumerable`1 designTimeAssemblies)
       at DesignToolsServerX64.Program.Main(String[] args)
    
And this error  too :

 DesignToolsServer.exe 
   1.100.22.12406 
   60ef187c 
   KERNELBASE.dll 
   10.0.14393.2189 
   5abdad60 
   e0434352 
   0000000000033c58 
   2804 
   01d84a6e072639cd 
   \\?\C:\Users\RUKZND062\AppData\Local\Temp\WinFormsCache\ljujc3vj.lbr\DesignToolsServer.exe 
   C:\Windows\System32\KERNELBASE.dll 
   39eed713-9956-4306-a2a0-7c2412a9dec7 

我应该如何将我的 WindowsForm 从 .NetFramework 4.5 和 32 位设计器迁移到 .Net5.0 和 64 位设计器?有可能吗?

After migration from NetFramework 4.5 to .Net 5.0 My WindowsForm doesnt open in Designer.

heres the output :

Microsoft.DotNet.DesignTools.Client.Host.ServerProcess.d__30.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     
    Microsoft.DotNet.DesignTools.Client.Host.ServerProcess.d__25.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    Microsoft.DotNet.DesignTools.Client.Host.ServerHostFactory.d__7.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    
    Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.d__28.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    
    Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.d__28.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    
    Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.<>c__DisplayClass24_1.<<-ctor>b__1>d.MoveNext()
    
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    
    Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.d__26.MoveNext()  
 

I also looked in Microsoft app event manager and found that :

 Application: DesignToolsServer.exe
    CoreCLR Version: 5.0.1522.11506
    .NET Version: 5.0.15
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.Logging, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
    File name: 'Microsoft.Extensions.Logging, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
       at Microsoft.DotNet.DesignTools.Server.Program.<>c.<Main>b__2_0(ILoggingBuilder configure)
       at Microsoft.Extensions.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(IServiceCollection services, Action`1 configure)
       at Microsoft.Extensions.Logging.LoggerFactory.Create(Action`1 configure)
       at Microsoft.DotNet.DesignTools.Server.Program.Main(String[] args, IEnumerable`1 designTimeAssemblies)
       at DesignToolsServerX64.Program.Main(String[] args)
    
And this error  too :

 DesignToolsServer.exe 
   1.100.22.12406 
   60ef187c 
   KERNELBASE.dll 
   10.0.14393.2189 
   5abdad60 
   e0434352 
   0000000000033c58 
   2804 
   01d84a6e072639cd 
   \\?\C:\Users\RUKZND062\AppData\Local\Temp\WinFormsCache\ljujc3vj.lbr\DesignToolsServer.exe 
   C:\Windows\System32\KERNELBASE.dll 
   39eed713-9956-4306-a2a0-7c2412a9dec7 

What i should doing to migrate my WindowsForm from .NetFramework 4.5 and 32bit Designer to .Net5.0 and 64bit Designer? Is it possible at all?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文