urasandesu / Prig

Prig is a lightweight framework for test indirections in .NET Framework.
Other
117 stars 21 forks source link

Namespace / typename confusion #83

Closed poizan42 closed 7 years ago

poizan42 commented 7 years ago

Bar in the following code cannot be redirected:

namespace Foo
{
  public class Foo
  {
    public void Bar()
    {

    }
  }
}

Error message:

1>  "C:\Users\kb\Documents\Visual Studio 2015\Projects\Test3\Test3\Foo.v4.0.30319.v1.0.0.0.MSIL.Prig\Foo.Prig.g.csproj" (rebuild target) (1) ->
1>  (CoreCompile target) -> 
1>C:\Users\kb\Documents\Visual Studio 2015\Projects\Test3\Test3\Foo\PFoo.g.cs(14,95): error CS0426: The type name 'Foo' does not exist in the type 'Foo' [C:\Users\kb\Documents\Visual Studio 2015\Projects\Test3\Test3\Foo.v4.0.30319.v1.0.0.0.MSIL.Prig\Foo.Prig.g.csproj]
1>C:\Users\kb\Documents\Visual Studio 2015\Projects\Test3\Test3\Foo\PProxyFoo.g.cs(15,88): error CS0426: The type name 'Foo' does not exist in the type 'Foo' [C:\Users\kb\Documents\Visual Studio 2015\Projects\Test3\Test3\Foo.v4.0.30319.v1.0.0.0.MSIL.Prig\Foo.Prig.g.csproj]
1>C:\Users\kb\Documents\Visual Studio 2015\Projects\Test3\Test3\Foo\PProxyFoo.g.cs(21,45): error CS0426: The type name 'Foo' does not exist in the type 'Foo' [C:\Users\kb\Documents\Visual Studio 2015\Projects\Test3\Test3\Foo.v4.0.30319.v1.0.0.0.MSIL.Prig\Foo.Prig.g.csproj]
urasandesu commented 7 years ago

Thank you for the reporting! I'm going to investigate the cause later.

urasandesu commented 7 years ago

MEMO To fix this problem, it looks that we should only add the global namespace alias when generating Prig Assembly. See also How to: Use the Global Namespace Alias (C# Programming Guide).