Compiler Error CS0438
The type 'type' in 'module_1' conflicts with the namespace 'namespace' in 'module_2'.
This error occurs when a type in a source file conflicts with a namespace in another source file. This typically happens when one or both come from an added module. To resolve, rename the type or the namespace that caused the conflict.
The following example generates CS0438:
Compile this file first:
// CS0438_1.cs
// compile with: /target:module
public class Util
{
public class A { }
}
Then compile this file:
// CS0438_2.cs
// compile with: /target:module
namespace Util
{
public class A { }
}
And then compile this file:
// CS0438_3.cs
// compile with: /addmodule:CS0438_1.netmodule /addmodule:CS0438_2.netmodule
using System;
public class Test
{
public static void Main() {
Console.WriteLine(typeof(Util.A)); // CS0438
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for