Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8515907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:16:29+00:00 2026-06-11T05:16:29+00:00

I am trying to compile one .Net c# project into multiple dlls. But here

  • 0

I am trying to compile one .Net c# project into multiple dlls. But here is the thing.

This is my project structure.

Bin 
Dir1 
Dir2 
File1.cs 
File2.cs 
myproject.csproj

I want to compile this project into File1.dll and File2.dll. Both File1.dll and File2.dll use code in various .cs files that are in Dir1 and Dir2. Some of these classes in the .cs files present in the sub directories are required by File1.cs and the others by File2.cs. There will be some that are used by both File1.cs and File2.cs.

I used the following:

csc /t:library /out:File1.dll /recurse:*.cs
csc /t:library /out:File2.dll /recurse:*.cs

But the resulting dlls were exact copies of each other with just different file names. Is there a way for me to compile them so that when I inspect each dll in the object browser, it has only those classes from the .cs files in the Dir1 and Dir2 that are referenced within File1.cs for File1.dll and similarly for File2.dll?

I want to do this preferably as a part of a post build step in Visual studio.

Thanks for your time…

EDIT

Thanks for all your responses. There were many suggestions for splitting up the solution into many projects. While that is one way to do it, I am not sure if I want the any dependencies created for the two dlls ie File1.dll and File2.dll. Let me explain..

The problem I see with creating multiple projects is that there will be some code that both File1.cs and File2.cs need. I dont want them to be repeated in both projects. Keeping the common code in a third project would mean a third dll will be created that is required for both File1.dll and File2.dll. I dont want this. I want only File1.dll and File2.dll created which is why I am keeping them both in one project. Any suggestions on how to make this happen?

Thanks again for your replies.

cheers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:16:30+00:00Added an answer on June 11, 2026 at 5:16 am

    You need to split your project up into multiple projects within the same solution if you want separate libraries for each component.

    You can have the same file included in multiple projects without creating duplicated copies (Add as link) to avoid issues with duplicated code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to compile a one-off script, an autogenerated C# program. This program
I am trying to make a WebForms project and ASP.NET MVC per this question
For few days I'm trying to compile one project written in C++ using Code::Blocks
I am trying to compile a project in VB.net 2010 that uses Microsoft Excel
I have a .net 3.5 project in vs2008 and I'm trying to use this
I'm trying to compile a version of convert (one of the ImageMagick tools) for
I'm trying to compile a piece of software in my home directory (OpenMPI). One
Trying to compile a iPhone/iPad application with SDK3.2 and am getting this error: Undefined
When trying to compile this code: #include <iostream> #include <vector> using namespace std; class
While trying to compile my project, that uses some third party headers, with mingw

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.