Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

/r for including a .dll? 1

Status
Not open for further replies.

MichaelRed

Programmer
Dec 22, 1999
8,410
US
Code:
/// WROX C# 2008 pp 57-58 Mathlibrary (Example)
// Error 13,.4 & 13.26 " ... missing using directive of an assembly reference ... "

using System;
///using MathLibrary.dll;

namespace WROX.ProCSharp.Basics
{
	class Client
	{
		public static void Main()
		{
			MathLib mathObj = new MathLib();
			Console.WriteLine(mathObj.Add(7,8));
			Console.ReadLine();
		}
	}
}

but MathLlibrary did compile to "MathLibrary.DLL"

I have used the several variations of the command line to compile this (MathClient.cs) including:

/r:MathLibrary.dll (which is shown in the tome)
/r:{fully qualified path} & "\MathLibrary.dll"

MathLib is the public class within MathLibrary

any help appreciated




MichaelRed


 
Code:
using System;
[COLOR=blue]using MathLibrary;[/color] [COLOR=green]// where MathLibrary is the namespace for the class MathLib [/color]
 
Thanks for the effort. Still no joy in mudville. Similar / same error. The exercise is supposed to demonstrate the use of the .DLL (MathLibrary.dll) from within the console App (MathClient.exe).

I will show both here:

Code:
// WROX C# 2008 pp57-58 MathLab
/* This part builds:
  		 "MathLibrary.dll" 
	         from MathLibrary.cs
which ye olde booke says it should
it needs tobe accessible from the next procedure / (console) program: MathClient
*/

namespace ProCSharp.Basics
{
	public class MathLib
	{
		public int Add(int x, int y)
		{
			return x + y;
		}
	}
}

this generates:
C:\Program Files\Microsoft Visual Studio 9.0\VC\MathLibrary.dll



Code:
/// WROX C# 2008 pp 57-58 Mathlibrary (Example)
// Error: "the type or namespace 'ProCShar' could not be found <are you missing a directive or an assembly reference?>
using System;
///using MathLibrary.dll;

using ProCSharp.Basics;
// .using MathLibrary; //where MathLibrary is the namespace for the class MathLib";

namespace WROX.ProCSharp.Basics
{
	class Client
	{
		public static void Main()
		{
			MathLib mathObj = new MathLib();
			Console.WriteLine(mathObj.Add(7,8));
			Console.ReadLine();
		}
	}
}

MichaelRed


 
Sorry, jumped the gun. The added name space is necessary, but I also had an error in the command line (I put a space in the /reference part which the compiler objected to.

Thanks again



MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top