Build error (The type or namespace name could not be found

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<P>I am using VS.Net 2003. I have a solution that contains 4 projects. The first project contains the definitions of interfaces. The third project is using the interfaces defined in the first project. For the third project, I added a reference to the first project. But Im still getting a build error: </P>
<P>c:inetpubwwwrootRemoting2Project3WebForm1.aspx.cs(28): The type or namespace name IAuthenticateUserService could not be found (are you missing a using directive or an assembly reference?).</P>
<P>Thanks in advance,</P>
<P>Elizabeth Bradley</P>
<P>-------------------------------------------------------------------</P>
<P>Interfaces.cs (in the first project named remoting2project1)</P><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System;</P></FONT><FONT color=#0000ff size=2>
<P>namespace</FONT><FONT size=2> Remoting2Project1</P>
<P>{</P>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2><summary></P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> Summary description for Class1.</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2></summary></P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>interface</FONT><FONT size=2> IAuthenticateUserService</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> AuthenticateUser(</FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> username, </FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> password);</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>interface</FONT><FONT size=2> ICreateUserService</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> CreateUser(</FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> username, </FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> password);</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>interface</FONT><FONT size=2> IDeleteUserService</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> DeleteUser(</FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> username, </FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> password);</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>interface</FONT><FONT size=2> IUpdateUserService</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> UpdateUser(</FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> username, </FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> password);</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>interface</FONT><FONT size=2> ICreateGroupService</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> CreateGroup(</FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> groupname);</P>
<P>}</P>
<P></P>
<P>}</P>
<P>--------------------------------------------------------------------------</P>
<P>Webform1.aspx.cs (in the third project named remoting2project3)</P><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Collections;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.ComponentModel;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Data;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Drawing;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Web;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Web.SessionState;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Web.UI;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Web.UI.WebControls;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Web.UI.HtmlControls;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Runtime.Remoting;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Runtime.Remoting.Channels;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Runtime.Remoting.Channels.Tcp;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Runtime.Remoting.Messaging;</P></FONT><FONT color=#0000ff size=2>
<P>namespace</FONT><FONT size=2> Remoting2Project3</P>
<P>{</P>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2><summary></P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> Summary description for WebForm1.</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2></summary></P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>class</FONT><FONT size=2> WebForm1 : System.Web.UI.Page</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>delegate</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> MyDelegate(</FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> s);</P>
<P></FONT><FONT color=#0000ff size=2>private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> Page_Load(</FONT><FONT color=#0000ff size=2>object</FONT><FONT size=2> sender, System.EventArgs e)</P>
<P>{</P>
<P>TcpChannel m_TcpChan = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> TcpChannel();</P>
<P>ChannelServices.RegisterChannel(m_TcpChan);</P>
<P>IAuthenticateUserService m_RemoteObject = (IAuthenticateUserService)</P>
<P>Activator.GetObject(</FONT><FONT color=#0000ff size=2>typeof</FONT><FONT size=2>(IAuthenticateUserService),</P>
<P>"tcp://localhost/remoting2project1"); </P>
<P>MyDelegate m_delegate = </P>
<P></FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> MyDelegate(m_RemoteObject.AuthenticateUser);</P>
<P>m_delegate.BeginInvoke("Amazing", </P>
<P></FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> AsyncCallback(MyCallBack),</FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>);</P>
<P>ICreateUserService m_RemoteObject2 = (ICreateUserService)</P>
<P>Activator.GetObject(</FONT><FONT color=#0000ff size=2>typeof</FONT><FONT size=2>(ICreateUserService),</P>
<P>"tcp://localhost/remoting2project1"); </P>
<P>MyDelegate m_delegate2 = </P>
<P></FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> MyDelegate(m_RemoteObject.CreateUser);</P>
<P>m_delegate.BeginInvoke("Amazing", </P>
<P></FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> AsyncCallback(MyCallBack),</FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>);</P>
<P>IDeleteUserService m_RemoteObject = (IDeleteUserService)</P>
<P>Activator.GetObject(</FONT><FONT color=#0000ff size=2>typeof</FONT><FONT size=2>(IDeleteUserService),</P>
<P>"tcp://localhost/remoting2project1"); </P>
<P>MyDelegate m_delegate3 = </P>
<P></FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> MyDelegate(m_RemoteObject.DeleteUser);</P>
<P>m_delegate.BeginInvoke("Amazing", </P>
<P></FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> AsyncCallback(MyCallBack),</FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>);</P>
<P>IUpdateUserService m_RemoteObject = (IUpdateUserService)</P>
<P>Activator.GetObject(</FONT><FONT color=#0000ff size=2>typeof</FONT><FONT size=2>(IUpdateUserService),</P>
<P>"tcp://localhost/remoting2project1"); </P>
<P>MyDelegate m_delegate4 = </P>
<P></FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> MyDelegate(m_RemoteObject.UpdateUser);</P>
<P>m_delegate.BeginInvoke("Amazing", </P>
<P></FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> AsyncCallback(MyCallBack),</FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>);</P>
<P>ICreateGroupService m_RemoteObject = (ICreateGroupService)</P>
<P>Activator.GetObject(</FONT><FONT color=#0000ff size=2>typeof</FONT><FONT size=2>(ICreateGroupService),</P>
<P>"tcp://localhost/remoting2project1"); </P>
<P>MyDelegate m_delegate5 = </P>
<P></FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> MyDelegate(m_RemoteObject.CreateGroup);</P>
<P>m_delegate.BeginInvoke("Amazing", </P>
<P></FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> AsyncCallback(MyCallBack),</FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>);</P>
<P>System.Console.WriteLine("Press ENTER to quit");</P>
<P>System.Console.ReadLine();</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> MyCallBack(IAsyncResult ar)</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> l = ((MyDelegate)((AsyncResult)ar).AsyncDelegate).EndInvoke(ar);</P>
<P>Console.WriteLine(l);</P>
<P>} </P>
<P></P></FONT><FONT color=#0000ff size=2>
<P>#region</FONT><FONT size=2> Web Form Designer generated code</P>
<P></FONT><FONT color=#0000ff size=2>override</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> OnInit(EventArgs e)</P>
<P>{</P>
<P></FONT><FONT color=#008000 size=2>//</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// CODEGEN: This call is required by the ASP.NET Web Form Designer.</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//</P></FONT><FONT size=2>
<P>InitializeComponent();</P>
<P></FONT><FONT color=#0000ff size=2>base</FONT><FONT size=2>.OnInit(e);</P>
<P>}</P>
<P></P>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2><summary></P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> Required method for Designer support - do not modify</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> the contents of this method with the code editor.</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2></summary></P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> InitializeComponent()</P>
<P>{ </P>
<P></FONT><FONT color=#0000ff size=2>this</FONT><FONT size=2>.Load += </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> System.EventHandler(</FONT><FONT color=#0000ff size=2>this</FONT><FONT size=2>.Page_Load);</P>
<P>}</P></FONT><FONT color=#0000ff size=2>
<P>#endregion</P></FONT><FONT size=2>
<P>}</P>
<P>}</P></FONT></FONT>

View the full article
 
Back
Top