不明白为什么我们会收到错误CS0234 [英] Don't understand why we're getting error CS0234

查看:126
本文介绍了不明白为什么我们会收到错误CS0234的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Visual Studio 2015进行WPF项目。我们在项目中有一个名为Assets的文件夹。它在VS 2015中显示良好。其中的文件在解决方案资源管理器中显示良好。但是当我们构建它时,VS 2015会抱怨以下错误:

We're working on a WPF project using Visual Studio 2015. We've got a folder in the project named Assets. It shows up fine in VS 2015. The files in it show up fine in the Solution Explorer. But when we build it, VS 2015 complains with the following error:

错误CS0234类型或名称空间名称'Assets'在名称空间'CoreFramework'中不存在(您是否缺少程序集引用?)

"Error CS0234 The type or namespace name 'Assets' does not exist in the namespace 'CoreFramework' (are you missing an assembly reference?)"

(CoreFramework是我们的解决方案和Assets所在项目的名称。)

(CoreFramework is the name of our solution and the project that Assets is in.)

我不知道CoreFramework中的文件夹如何,但是在构建它时,VS 2015只是看不到它。我曾尝试在VS 2015中清理项目和解决方案,但这完全没有帮助。同样的错误不断弹出。并且它们也会在我们的夜间版本中弹出。

I don't get how the folder is there in CoreFramework, but when building it, VS 2015 just doesn't see it. I've tried cleaning both the project and the solution in VS 2015, but it doesn't help at all. The same errors keep popping up. And they popup in our nightly builds as well.

那么是什么原因导致VS 2015同时看到项目中的文件夹而又看不到项目中的同一文件夹? / p>

So what is causing VS 2015 to simultaneously see a folder within a project and not see that same folder in the project?

推荐答案

在这种情况下,我要做的就是删除项目主文件夹下obj文件夹中的所有内容。该解决方案的名称为CoreFramework,而主项目的名称也为CoreFramework。所以我要做的是转到\CoreFramework\CoreFramework\obj,并删除其中的所有内容。由于此时我们仅处理调试版本,因此唯一的问题是Debug文件夹及其下的所有临时文件和文件夹。完成该操作后,重新构建解决方案即可重新创建所有临时文件和文件夹,而不会出现Assets文件夹出现的问题。

In this case what I had to do was to delete everything in the obj folder beneath our project main folder. The solution's name is CoreFramework and the main project's name is also CoreFramework. So what I did was go to \CoreFramework\CoreFramework\obj and deleted everything there. Since at this point we're only dealing with a debug version, the only thing there was the Debug folder and all temporary files and folders under that. Once I did that, then rebuilding the solution re-created all of the temporary files and folders, without the problem I was having with the Assets folder. It built fine.

YMMV

这篇关于不明白为什么我们会收到错误CS0234的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆