Question

From Can I build 2 or more dlls from C# project in Visual Studio 2008?, I have another idea to create only 1 big project. After that, I separate a project dll(that contains many classes.) into 1 dll per class by using post-build event to call Win app project(for separate a big dll). How to do this?

Moreover, I need to manage attached file in a big dll too.

Update I found some trick that could guide me to solve this problem by custom build? Moreover, I think I can create custom handler that generate dynamic assembly file by using separate module file & al.exe. But this feature is over my expect and unnessary(sourcecode is rarely changed).

Multi-file Assemblies: What and How

How to: Build a Multifile Assembly

POCO Custom Multifile Assembly and ReSharper

Thanks,

Was it helpful?

Solution 3

This problem is solved by custom script for MSBuild that was explained in another question.

<ItemGroup> 
  <Compile Include="Class1.cs"> 
    <Plugin>true</Plugin> 
  </Compile> 
  <Compile Include="Class2.cs" /> 
  <Compile Include="Class3.cs"> 
    <Plugin>true</Plugin> 
  </Compile> 
  <Compile Include="Program.cs" /> 
  <Compile Include="Properties\AssemblyInfo.cs" /> 
</ItemGroup> 

Visual studio one project with several dlls as output?

Thanks @franko_camron for suggestion.

OTHER TIPS

Just... why? Having lots of dlls can have a performance impact on app startup (due to "fusion"). It will also pretty-much immediately suffer from circular references, which is a bad thing.

Since .NET code (by default) gets JITted when first used, there isn't a huge amount of impact in having extra classes in a dll that don't get used in that application. They just sit there, quietly, being no bother to anyone.

The sheer management cost of having a dll per class will make deployment etc excruciating.

All in all, I can't think of a sensible reason to do this...

The answer that you will get here is no different from the answer in the other question: put in a separate project for each separate dll.

What I want to ask you is what your understanding of the definition of a "class" is. One class per DLL probably means that you're not very familiar with how assemblies, namespaces, and classes work.

Tell us, what do you really want to be able to do? Because what you think you should be doing to solve that problem (e.g., creating one DLL per class) is not practical.

Update

Considering the context of your requirement (e.g., Silverlight web application), my conclusion is that splitting your classes to several DLLs will not result in a performance improvement in an ASP.NET web page because:

  • DLLs are only used by the server, they are not downloaded via HTTP to your browser
  • Once a DLL is loaded by a web application it won't load it again -- regardless of how many users are using your site at the same time. One DLL instance per server.
  • When you start your web application it will load all DLLs that it depended on to compile, whether or not you will use it.

So with your requirements, it's probably best NOT to use Silverlight for your application, considering the bandwidth limit. The avenues you can explore are:

  • Learning AJAX techniques, specifically JSON, (and probably not ASP.NET AJAX and its easy-to-misuse UpdatePanel)
  • Learning jQuery to find controls that will implement in JavaScript what you want to do using Silverlight
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top