I managed to reproduce one of the errors in a test project with a similar structure for my production code. It consists of three simple projects:
General (class library):
namespace Common { public enum PrimaryColor { Red, Green, Blue }; }
Library (WCF service library) that has a link to Common:
using Common; namespace Library { [ServiceContract] public interface ILibrary { [OperationContract] PrimaryColor GetColor(); } public class Library : ILibrary { public PrimaryColor GetColor() { return PrimaryColor.Red; } } }
ClientApp (console application), which has a link to Common, and a link to a service in the library called "LibraryServiceReference":
using Common; using ClientApp.LibraryServiceReference; namespace ClientApp { class Program { static void Main(string[] args) { LibraryClient client = new LibraryClient("WSHttpBinding_ILibrary"); PrimaryColor color = client.GetColor(); } } }
The app.config files in ClientApp and Library are automatically generated, and I did not modify them, and I did not change the default configuration for LibraryServiceReference in ClientApp.
When I compile this solution, I see the following errors in the ClientApp project:
Error 1
'PrimaryColor' is an ambiguous reference between 'Common.PrimaryColor' and 'ClientApp.LibraryServiceReference.PrimaryColor'
Error 2
Cannot implicitly convert type 'ClientApp.LibraryServiceReference.PrimaryColor' to 'Common.PrimaryColor'. An explicit conversion exists (are you missing a cast?)
please help me fix this.
source share