Friday, November 11, 2005

doc generation, source compilation

all right, today i implemented the generation of the documentation and the source code compilation. for the GetFiles method from the ProjectServerAccess class i made a temporary solution that gets the files from the same machine. i think for the first prototype it should be enough.
with the compilation i have one little problem. i can't find out, how i can specify the output path for the assembly. the rest runs properly. at the moment, the compiler saves the assembly in the same folder, in which the executing assembly locates. for the assembly i have a solution, which is a little hack. i can copy the assembly to that directory in which it should be. but it's a hack. have you any ideas, how i can specify the output path?

thats the code part, which makes the compilation:

// all files, which should compiled
string[] sourceFileNames = Directory.GetFiles(sourcePath, "*.cs");

// get csharp compiler
Microsoft.CSharp.CSharpCodeProvider provider = new Microsoft.CSharp.CSharpCodeProvider();
ICodeCompiler comp = provider.CreateCompiler();

// create compiler options
CompilerParameters compilerParam = new CompilerParameters();
compilerParam.CompilerOptions =
"/doc:SharedCodeDoc.xml /t:library";

compilerParam.OutputAssembly = "SharedCodeDoc.dll";


// compile it and pray ;-)
CompilerResults results = comp.CompileAssemblyFromFileBatch(compilerParam, sourceFileNames);

i hope i can start with the gui this weekend, so that we can see something ;-)

2 Comments:

At 8:29 PM, Anonymous Anonymous said...

Have you tried something like this:

compilerParam.OutputAssembly = targetDir + "\" +"SharedCodeDoc.dll";

Doesn't the compiler need to know the referenced assemblies e.g. System.XML.dll? If yes, where will it read them from? .csproj?
How will you handle several projects in different folders? Is there a way to feed a .sln file into a compiler class and it does it all for you?

 
At 1:55 PM, Anonymous Anonymous said...

Not really important input, but you can enable some "word confirmation" setting for the blog, so that it makes it more difficult to post spam to the blog.
sln files are just xml files, so they should be easy to parse if the compiler doesn't do it, which I assume it doesn't.
Will try to call in for tomorrows meeting, but not sure if we have reception, we are out in the desert near to pakistans border in a tent village. internet speed is about 20k...

 

Post a Comment

<< Home