Why would I get “The type of namespace name 'b

2019-08-22 02:45发布

问题:

Why would I go from building with no errors to 3 of the type:

The type of namespace name 'bla' does not exist in the class or namespace 'blah' (are you missing an assembly reference?)

All three errors refer to the same group of files (two errors in "OpenNETCF" and one in "OpenNETCF.Win32"); How could it be that these types did exist in the class earlier in the day, and now they don't? I didn't remove or update those references...

UPDATE

When I went to compile this (the next) morning in the VM (XP Mode), I got:

Automatic Updates
Updating your computer is almost complete. Your computer needs to be restarted for the updates to take effect. Windows will restart your computer automatically in .... minutes.

I got this yesterday, too, and didn't think much of it - just clicked the Restart Now button.

After restarting and building, I get 0 errors again, so it was apparently not a problem with the code itself.

I don't know if this is pertinent, but I also got today (both times the XP Mode VM started up):

Devices or applications disabled
'Virtual PC/Windows CE Emulator' will cause Windows to become unstable. Windows has prevented these drivers from loading. Click here for more details.

...which took me to: http://support.microsoft.com/default.aspx?scid=kb;en-us;891667

回答1:

One thing to check is to see if your project is accidentally set to use the .NET client profile. That cause all kinds of odd 'unknown type' problems.

To check, go to your project properties, then to the Application tab, and check the "Target Framework" setting. If it's set to ".NET Framework 4 Client Profile", try changing it to ".NET Framework 4" and rebuild to see that's what's causing it.



回答2:

It's simply a matter of restarting, and letting Visual Studio get its breath back.