Nagu
Nagu

Reputation: 5114

.cs to .dll conversion issue

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? )

Upvotes: 0

Views: 408

Answers (3)

Bernard Chen
Bernard Chen

Reputation: 6567

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

Upvotes: 2

3Dave
3Dave

Reputation: 29041

  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.

Upvotes: 4

user210936
user210936

Reputation: 51

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.

Upvotes: 0

Related Questions