Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't understand why we're getting error CS0234

Tags:

c#

wpf

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:

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

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

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.

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

like image 860
Rod Avatar asked Feb 15 '16 22:02

Rod


People also ask

How do I fix cs0234 error?

To fix this error, simply update the example . csproj file to use a previous System. CommandLine version. Note that this package is only used to parse the options for the example.

Why am I getting error CS0246 the type or namespace name could not be found?

This often occurs because the casing used in the name of the type is not correct. For example, Dataset ds; generates CS0246 because the s in Dataset must be capitalized. If the error is for a type name, did you include the proper using directive, or, alternatively, fully qualify the name of the type?


1 Answers

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

like image 200
Rod Avatar answered Sep 21 '22 17:09

Rod