I have reduced my problem to the following code.
using WeinCad.Plugin.MoineauMachinePath;
namespace WeinCad.Plugin.Foo
{
public class Foo
{
// This line is a compiler error
// (Cannot resolve symbol MoineauMachinePath )
private WeinCad.Plugin.MoineauMachinePath.MachinePathSolverPropertiesViewModel X;
// Implicity referenced it is ok
private MachinePathSolverPropertiesViewModel Y;
}
}
If I use an explicit reference to a class then I am getting a compiler error. To prove the namespace is correct I also import the namespace into scope and reference the class implicitly. Only the explicit reference is in error.
EDIT
The intellisense shows that there is a namespace nested double like so. That will be the source of the problem. Not sure how it code there.
EDIT
Source of the problem was a corrupted Resources.Designer.cs file.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WeinCad.Plugin.WeinCad.Plugin.BasicFolders.Properties
{
using System;
Not sure how this happened. Deleting the Resources file and then recreating it I get
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WeinCad.Plugin.BasicFolders.Properties {
using System;
without the nasty duplicate. It's still an open question on how this happened.
That error message suggests that there is a WeinCad.Plugin
inside the current scope, ie either WeinCad.Plugin.Foo.Foo.WeinCad.Plugin
, or WeinCad.Plugin.Foo.WeinCad.Plugin
. When the compiler is looking for WeinCad.Plugin
, it looks first at the local scopes, and only if it can't find a match does it look at the global scope.
The simplest and most correct fix for this is: don't have a scope that duplicates names inside itself (that is just asking for trouble). The other option is to explicitly specify the global scope, using the global::
prefix in front of the full type name, ie global::WeinCad.Plugin.Whatever
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.