类型“<类型名称>”的值 无法转换为

发布于 2024-07-21 00:34:33 字数 487 浏览 4 评论 0原文

我正在开发一个使用 VS 2008 内置测试工具的项目。

我会定期看到类似于以下内容的错误: “AcademyPro.Code.BLL.Appearance”类型的值无法转换为“AcademyPro.Code.BLL.Appearance”。 类型不匹配可能是由于文件引用与程序集“AcademyPro”的项目引用混合所致。 尝试将项目“AcademyPro”中对“academypro.dll”的文件引用替换为对“AcademyPro”的项目引用。

现在,在一个级别上,错误是正确的,有一个项目引用(编译代码所需)和一个文件引用(在名为 AcademyPro.accessor 的文件中)

如果我删除这些引用中的任何一个,则测试项目将无法编译。 我尝试删除这两个引用,清理构建并将它们添加回来。这似乎没有帮助。

看来我处于一种双输的境地,我需要项目引用来编译,我需要访问器引用,以便构建私有对象访问器,我需要能够编译它。

我需要做什么才能再次编译?

I'm working on a project that uses the testing tool built into VS 2008.

Periodically I will see an error comparable to:
Value of type 'AcademyPro.Code.BLL.Appearance' cannot be converted to 'AcademyPro.Code.BLL.Appearance'. Type mismatch could be due to the mixing of a file reference with a project reference to assembly 'AcademyPro'. Try replacing the file reference to 'academypro.dll' in project 'AcademyPro' with a project reference to 'AcademyPro'.

Now, on one level the error is correct, there is a project reference (required for the code to compile) and a file reference (in a file called AcademyPro.accessor)

If I remove either of these references then the test project fails to compile. I have tried removing both references, cleaning the build and adding them back in. this doesn't seem to help.

It seems I'm in a lose lose situaltion, I need the project reference to compile and I need the accessor reference so that the private object accessors are built, which I need to be able to compile.

What do I need to do to get this compiling again?

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

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

发布评论

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

评论(2

街道布景 2024-07-28 00:34:33

我也遇到了同样的问题,我通过删除项目的所有引用来修复它,再次重新打开解决方案,然后添加引用,它对我有用。 (从谷歌得到这个解决方案)

I also got the same problem, i fixed it by remove all the references of the project, reopened solution again and then added the references, it worked for me. (Got this solution from google)

◇流星雨 2024-07-28 00:34:33

经过大量挖掘后,我发现我试图测试的项目(不是单元测试项目)有一个对其自身的项目引用。 我不知道为什么或如何它会引用自身,但它确实如此。 我删除了这个引用,现在一切都可以正确编译。

After much digging around I discovered that the project I was trying to test (not the unit test project) has a project reference to itself. I don't know why or how it would have a reference to itself, but it did. I removed this reference and now everything compiles properly.

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