C# Compiling Question

N

NvrBst

I'm wondering if this is possible... Basically say I have a lot of .cs
files but only 1 of them changes. Is there a way (with the csc.exe, or
VS.NET 2005, or another C# Compiler), that I can compile everything
before hand, keep the object files of the unchanged .cs files, and just
compile the 1 file I edit and somehow link it with my exsisting object
files?

IE in C++, all the .cpp files compiled to .o files. And you can keep
all the .o files and only update the .o file that you are working with
and link them at the end instead of compiling the entire project again.


Basically when I compile with VS.NET 2005 (if its after a "Clean
Solution" or After I already compiled and just changed 1 file, it seems
to always call the same line in the "Build Output", namely

------ Build started: Project: MyProject, Configuration: Debug Any CPU
------
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig
/unsafe- /nowarn:1701,1702 ....


I also see that a "\obj\Debug\" with a bunch of ".resources" and
".cashe" files are kept but I'm not sure how to use these (if at all
possible?) with the csc.exe if I only change 1 .cs file. The # of
files here are a lot less than the amount of .cs files I have. And I'd
like to see it manually (see what the csc.exe (or such) that its
calling with the obj\Debug\ files).

Is this at all possible with C#? Thanks

NB
 
N

NvrBst

I found it I think... I have to use modules. So basically I have it
like this...


Make 1 Modual (The class 1 Change Consantly) = myclass.netmodule
Make Another Modual (Everything Else) = everythingelse.netmodule

then I just have myProgram.cs (with my main() in it) and call

csc.exe /Addmodule:myclass.netmodule
/Addmodule:everythingelse.netmodule myProgram.cs

And I can just keep changing "myclass.netmodule" and not have to
re-compile the "everythingelse.netmodule".


But... Before I only had 1 .exe (it was cleaner). Now I have the exe
with 2 .netmodules that have to go with it else it wont run. I'll look
tomorrow after some sleep but is there a way to make them all into 1
..exe (AL.exe perhaps?).

PS. Now that I think about it I can probably just change the
"everythingelse.netmodule" to "/t=winexe" and add the
"/Addmodule:myclass.netmodule" to it... I'll try tomorrow, but would
it still be possible to combine the 2 files (.exe and
myclass.netmodule) after they both are created?
 
N

NvrBst

AL.exe wasn't able to do it. I made "everythingelse.module" and
"myclass.module" then called AL.exe with the
"/main:namespace.class.mainmethod" but it still needed all 3 files to
run.

:) Having 2 or 3 files isn't that big a deal with me, it was a
cleanliness value ("Cleanliness is next to Godliness"). Having a
single exe to hand out to people is harder for them to mess up, or for
example I keep a bunch of single programs in 1 folder, if I/someone
wanted to delete this one after a while they'd need to remember that
"mycalss.netmodule" was part of this exe. A folder with 2 files in it
is almost not worth it.
 
N

NvrBst

No, but the C++ linker (link.exe) can.

Ahh your right :) Many thanks, its the way I wanted it now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top