Adding .cs file to dll  
Author Message
pgomes





PostPosted: .NET Base Class Library, Adding .cs file to dll Top

I'm new at c# and .net and the site of dll's leaves me slightly dizzy...

The thing is:

I have .cs files for datasets (extracted from a BD through xml). I want my application to update a dll, deleting the classes that exist and "appending" my .cs files. The same thing as deleting and then adding existing items in a project but not in visual studio. Is that possible

I've been reading about reflection and I understand that I can create classes with Emit. But I can't find anywhere if I can delete existing classes or create new ones based on .cs files on disk...

I also came across the csc with the /res... Is that the way to go

Can anybody tell me if what I want to do is possible (or if it makes sense) and what should I start looking for

Thanks a lot!



.NET Development18  
 
 
Mattias Sjogren





PostPosted: .NET Base Class Library, Adding .cs file to dll Top

Reflection will not let you modify existing assemblies.

Why do you need to do that Don't you have the source code for the DLL



 
 
pgomes





PostPosted: .NET Base Class Library, Adding .cs file to dll Top


I have 2 applications that use a DB that is still growing.

My idea was that using strongly typed datasets would make the detecting of bugs in the apps (that derive from the changes on the BD) easier.

The problem is that the BD has a real lot of tables. So i was trying to make the dll that contains the datasets ease to update (instead of having to update them in the Visual Studio, which would take some time).

I managed to create de .cs (by accessing the BD, creating de .xml and using xsd) but then i bump in the dll.

I don't know if I'm looking at the this the wrong way or even if it is to much trouble for what it's worth...

Thanks.

 
 
robinjam





PostPosted: .NET Base Class Library, Adding .cs file to dll Top

You cannot compile DLLs at runtime. It's that simple.

You could, however, save the C# code into a text file and have the app dynamically run it. But it's probably more trouble than simply using C# to recompile the DLLs when they are modified.



 
 
Mattias Sjogren





PostPosted: .NET Base Class Library, Adding .cs file to dll Top


I don't know if I'm looking at the this the wrong way or even if it is to much trouble for what it's worth...

It sure sounds that way to me.



 
 
pgomes





PostPosted: .NET Base Class Library, Adding .cs file to dll Top

Thanks you. I'll move on :)