更改自定义控件 dll 后 Windows 窗体设计器引发异常

发布于 2024-10-16 05:06:29 字数 1342 浏览 2 评论 0原文

在更改包含自定义控件的 dll 后,我收到来自构建

1 的警告>-------- 全部重建已开始:项目:Easy Labels,配置:调试 Win32 ------
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1360,9):警告 MSB3245:无法解析此引用。无法找到程序集“ResizeLabel,Version=1.0.4056.28976,Culture=neutral,PublicKeyToken=null”。检查以确保该程序集存在于磁盘上。如果您的代码需要此引用,您可能会遇到编译错误。
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1360,9):警告 MSB3245:无法解析此引用。无法找到程序集“ResizeLabel,Version=1.0.4056.28118,Culture=neutral,PublicKeyToken=null”。检查以确保该程序集存在于磁盘上。如果您的代码需要此引用,您可能会遇到编译错误。
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1360,9):警告 MSB3243:无法解决“ResizeLabel、Version=1.0.4056.28976、Culture=neutral、 PublicKeyToken=null”和“ResizeLabel,版本=1.0.4056.28118,Culture=neutral,PublicKeyToken=null”。任意选择“ResizeLabel、Version=1.0.4056.28976、Culture=neutral、PublicKeyToken=null”。
1> stdafx.cpp
1>程序集信息.cpp
1>简易标签.cpp
1>正在生成代码...
1> .NETFramework,版本=v4.0.AssemblyAttributes.cpp
1>简易标签.vcxproj -> C:\Users\bobinski\Documents\Visual Studio 2010\Projects\Easy Labels\Debug\Easy Labels.exe
========== 全部重建:1 成功,0 失败,0 跳过 ==========

似乎有对早期版本和新版本的引用。

我重置了工具箱,从代码中删除了新控件,这肯定不会留下对 dll 的引用,但设计器异常仍然发生。

显然我做了一些基本上错误的事情,但我不知道它可能是什么。

我想知道我是否应该使用 GAC,但真正安全地更改 dll 的建议可能正是我所需要的。

After I have changed my dll containing my custom control I am getting warnings from the build

1>------ Rebuild All started: Project: Easy Labels, Configuration: Debug Win32 ------
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "ResizeLabel, Version=1.0.4056.28976, Culture=neutral, PublicKeyToken=null". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "ResizeLabel, Version=1.0.4056.28118, Culture=neutral, PublicKeyToken=null". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1360,9): warning MSB3243: No way to resolve conflict between "ResizeLabel, Version=1.0.4056.28976, Culture=neutral, PublicKeyToken=null" and "ResizeLabel, Version=1.0.4056.28118, Culture=neutral, PublicKeyToken=null". Choosing "ResizeLabel, Version=1.0.4056.28976, Culture=neutral, PublicKeyToken=null" arbitrarily.
1> stdafx.cpp
1> AssemblyInfo.cpp
1> Easy Labels.cpp
1> Generating Code...
1> .NETFramework,Version=v4.0.AssemblyAttributes.cpp
1> Easy Labels.vcxproj -> C:\Users\bobinski\Documents\Visual Studio 2010\Projects\Easy Labels\Debug\Easy Labels.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

There seems to be references to the earlier version as well as the new version.

I reset the toolbox, removed the new controls from the code, which surely should leave no reference to the dll, but the designer exception still occurs.

I'm obviously doing something basically wrong, but I've no idea what it might be.

I'm wondering if I should be using the GAC, but really advice on changing a dll safely is probably what I need.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

感性 2024-10-23 05:06:29

尽管您确实不需要这样做,但它还是发生了。我假设您的自定义控件包含在解决方案中。完全关闭VS。转到项目文件夹并删除构建过程创建的所有文件夹 - bin、debug 和release。重新打开解决方案(其中应包括自定义控件)。构建它应该可以解决所有问题。如果您无法在解决方案中包含该控件,我认为您可能必须删除对其的所有引用,然后删除所有文件夹,然后将其放回各处。

Even though you really should not need to do this, it happens. I am assuming your custom control is included in the solution. Close VS completely. Go to your project folders and delete all the folders created by the build process - bin, debug, and release. Reopen the solution (which should include the custom control). Build and it should fix everything. If you cannot include the control in the solution, I think you may have to delete all references to it, then delete all the folders, then put it back in everywhere.

影子是时光的心 2024-10-23 05:06:29

如果工具箱中有旧版本的项目,请将其删除,关闭并重新打开解决方案即可解决。

If there is a toolbox item which is an old version, deleting it, closing and re-opening the solution sorts it out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文