I have recently added a new .aspx page to my Web project, it's in C#, uses a DataSet from an XSD file to grab data from Sql Server. Project builds, runs, with no errors, until I try to access the new page, when I get the following error:
The type 'cs2dev.App_Code.DAL.DataSets.ProgressIndicatorsTableAdapters.OutcomeIndicatorTableAdapter' is ambiguous: it could come from assembly 'C:\Users\dtaylor\AppData\Local\Temp\Temporary ASP.NET Files\root\0c62f7de\15f094b3\App_Code.taf73im9.DLL' or from assembly 'C:\Users\dtaylor\Documents\Visual Studio 2010\Projects\cs2dev\cs2dev\bin\cs2dev.DLL'. Please specify the assembly explicitly in the type name.
The project has several other pages making similar calls to XSD files in this way, but only this one is encountering this ambiguity. Any suggestions would be appreciated.
And, yes, I have tried deleting cs2dev.dll, and I have tried deleting the contents of Temporary ASP.NET Files. Neither of these fixed the error.
This is happening because you have 2 functions or methods with the same name in 2 different classes. If you have set the USING xxxx; at the top of your code for both DLL's (classes), it will create a conflict when compiling, since the system will not know which class to execute the function from.
Here is a quick example of what I mean:
Class file 1:
public class Class1
{
public void DoSomething() { }
}
Class file 2:
public class Class2
{
public void DoSomething(){ }
}
Main Program:
Using Class1;
Using Class2;
public void ImDoingSomething()
{
// The system will not know if you are calling the function from Class1 or Class2
// and will cause the ambiguous error.
DoSomething();
}
I hope this helps.
Cheers,
G.