tags:

views:

75

answers:

3

Hi, I've 10 .cs files in my app_code folder. Now I want to convert all 10 class files into one dll. Is if possible?

I'm trying to convert it by using csc /t:library admin.cs --> like this

But it is showing error like The type of namespace dbConnection could not be found (Are you missing a using directive or an assembly refference? )

Thanks in advance Nagu

A: 

You can create a new Class Library project in your solution and move your code files into there. The Class Library project will compile into a single DLL.

+4  A: 
  1. Why are you using the command line compiler?

  2. You don't want to create a DLL - you want to create an Assembly. This is important because you need to know the terminology to solve this.

  3. The code you're compiling has errors. The message you quote means that you are missing an assembly reference, or you are missing a "using" statement in admin.cs, or (most likely) there are syntax errors - in this case, dbConnection is being used in a context where it is not defined.

  4. Do yourself a favor and open this up in visual studio. Create a new "class library" project (it's on the list available in the "new project" dialog) and add all of your .cs files to it. Compile, find the bugs, fix them.

Given the form of your question, you're obviously pretty new at C# and .NET. Use the tools that are available (namely, Visual Studio) and give it some time.

David Lively
Thank you very much.. I'll try
Nagu
Of course. BTW, these are the types of questions that we like to help with - just provide as much information as you can, and make uses of the resources available to you. Google is a good helper.
David Lively
When I try to add dbconnection.cs into my class library project it is showing error.public SqlConnection GetConnection() { ConnectionStringSettings _connectionString = ConfigurationManager.ConnectionStrings["begoniafeeder"]; SqlConnection myCon = new SqlConnection(_connectionString.ConnectionString); return myCon; }this is my code in dbConection.cs classIt is showing ConnectionStringSettings could not be found error
Nagu
As to point #3 above, it's not that he's missing an assembly reference. Instead, he didn't specify the assemblies that need to be referenced to the csc.exe command. These files in app_code were probably part of a larger web site that had references that his command line did not know about.
Bernard Chen
+2  A: 

If you really want to use the command line compiler, you can list of the assemblies that you depend on with the /r option.

Bernard Chen