CS0012从哪里获取信息?

发布于 2025-02-12 02:07:57 字数 1374 浏览 2 评论 0原文

我有一个C#应用程序,基于某个DLL的84版。

我已经降级了DLL,现在我正在使用83版。我通过在.csproj文件中替换以下行来完成此操作:

<!-- <Reference Include="Firmware.Internal, Version=1.0.84.1,
                             Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\Product.Core.22.1.25.3\lib\Firmware.Internal.dll
  </HintPath>
  <Private>False</Private>
</Reference> -->
<Reference Include="Firmware.Internal, Version=1.0.83.1, Culture=neutral,
           PublicKeyToken=..., processorArchitecture=MSIL">
  <HintPath>..\packages\Product.Core.16.12.6.1\lib\Firmware.Internal.dll
  </HintPath>
  <Private>False</Private>
</Reference>

这似乎是不起作用的,因为我的源中的以下行代码:

Firmware.Internal.InternalGroup dockInternal = ...

错误消息是:

类型的“内部组”类型是在不是 引用。您必须向汇编'固件添加参考。内部, 版本= 1.0.84.1,文化=中性,publicKeyToken = null'。

这确实是正确的:对于版本84来说,这是正确的,对于版本83来说,这是不起作用的,因此我应该升级到84版以使其正常工作。

问题:编译器如何知道?我删除了对84版的引用,因此编译器如何知道,为了访问该internalGroup,版本84是要使用的版本(为什么不85、86、136,.. 。)?

备注:我刚刚删除了*。csproj文件中的评论行(&lt;!编译器绝对没有从该评论中获取该信息。

编辑:
PS:
我刚刚删除了“垃圾箱”和“ OBJ”目录,没有差异,因此在某些挥之不去的旧编译的二进制文件中找不到信息。

I have a C# application, based on version 84 of a certain DLL.

I have downgraded that DLL and now I'm using version 83. I have done this by replacing the following line in the .csproj file:

<!-- <Reference Include="Firmware.Internal, Version=1.0.84.1,
                             Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\Product.Core.22.1.25.3\lib\Firmware.Internal.dll
  </HintPath>
  <Private>False</Private>
</Reference> -->
<Reference Include="Firmware.Internal, Version=1.0.83.1, Culture=neutral,
           PublicKeyToken=..., processorArchitecture=MSIL">
  <HintPath>..\packages\Product.Core.16.12.6.1\lib\Firmware.Internal.dll
  </HintPath>
  <Private>False</Private>
</Reference>

This seems not to work, because of the following line in my source code:

Firmware.Internal.InternalGroup dockInternal = ...

The error message is:

The type 'InternalGroup' is defined in an assembly that is not
referenced. You must add a reference to assembly 'Firmware.Internal,
Version=1.0.84.1, Culture=neutral, PublicKeyToken=null'.

This is correct indeed: for version 84 this was working, and for version 83 this is not, so I should upgrade to version 84 in order to make it work.

Question: how does the compiler know that? I have removed the reference to version 84, so how can the compiler know that, in order to access that InternalGroup, version 84 is the one to be used (why not 85, 86, 136, ...)?

Remark: I have just deleted the commented lines (<!-- ... -->)in the *.csproj file and the result is equal, so the compiler is definitively not getting that information from that comment.

Edit:
P.s.:
I've just deleted the "bin" and the "obj" directories, no differences, so the information is not found in some lingering old compiled binaries neither.

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

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

发布评论

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

评论(1

鲜肉鲜肉永远不皱 2025-02-19 02:07:58

在解决方案中的其他项目中,您仍然可能会引用84版。检查是否是这种情况,降级所有项目并重建所有项目。

You still may have a reference to version 84 in other projects inside the solution. Check if it is the case, downgrade all projects and rebuild all.

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