英文:
Build error when upgrading WPF application to .NET 7
问题
我正在尝试将一个WPF应用程序从.NET 4.6.1升级到.NET 7。在解决了初始问题后,我遇到了一个构建错误。
MC1000 未知的构建错误,'在程序集'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.5\ref\net7.0\System.Web.dll'中找不到类型'System.Web.PreApplicationStartMethodAttribute'。
我不知道从哪里开始查找解决此问题的方法。有人知道如何解决吗?或者有任何可以开始的想法。
英文:
I'm trying to upgrade a WPF application from .NET 4.6.1 to .NET 7. After working out the initial issues, I'm left with a single build error.
MC1000 Unknown build error, 'Could not find type 'System.Web.PreApplicationStartMethodAttribute' in assembly 'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref.0.5\ref\net7.0\System.Web.dll'.'
I have no idea where to start looking to fix this one. Does somebody know how to fix this? Or any idea where I can start.
答案1
得分: 0
你遇到的问题是预期的。
来自“.net framework”的System.Web.dll确实有以下类:
PreApplicationStartMethodAttribute Class
但在.NET 7中,它已被移除:
https://learn.microsoft.com/en-us/dotnet/api/system.web?view=net-7.0
因此,所有与此相关的代码需要重新检查,所有与此相关的代码需要重写。请检查您在哪一侧使用了PreApplicationStartMethodAttribute。
英文:
The issue you encountered is expected.
The System.Web.dll from '.net framwork' really has class:
PreApplicationStartMethodAttribute Class
But in .NET 7, it was been removed:
https://learn.microsoft.com/en-us/dotnet/api/system.web?view=net-7.0
So all the code that related to this need to be recheck, all of the code related to this need to be rewrite. Please check which side you used the PreApplicationStartMethodAttribute.
答案2
得分: 0
我通过卸载/安装一些NuGet包来实际解决了这个问题。也许其中一些仍然具有对System.Web命名空间的旧引用。
英文:
I actually fixed the issue by uninstalling/installing some nuget packages. Maybe some of them still had old references to the System.Web namespace.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论