CS0012从哪里获取信息?
我有一个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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在解决方案中的其他项目中,您仍然可能会引用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.