PC Review


Reply
Thread Tools Rate Thread

CompileAssemblyFromDomBatch and compile errors

 
 
=?Utf-8?B?SmF5?=
Guest
Posts: n/a
 
      2nd Feb 2005
I'm constructing a bunch of code into a set of CodeCompileUnit's and then
attempting to compile using the CompileAssemblyFromDomBatch method.
This works great assuming the compile is successful. If the compile is not
successful, the CompilerResults has a Errors collection with a set
CompilerError objects to point out the errors.

Here's the problem; internally the C# compiler is generating a bunch of temp
files and the CompilerError.FileName points back to the temp file name where
the error is. It doesn't seem to have any reference back to the original
CodeCompileUnit, so I have no idea where the error is.

Is there a way to correlate the CompilerError or FileName back to
CodeCompileUnits that caused the error rather than temp files? Or do I have
to explicitly generate the files and then compile the files to know which
compile units contain the errors myself?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmF5?=
Guest
Posts: n/a
 
      2nd Feb 2005
I accidentally found away around this problem.
I'm using a CodeSnippetCompileUnit because I was too lazy to build a
language independent CodeDom. The CodeSnippetCompileUnit has a LinePragma
object with filename and line #. When I set this before compilation, the
compiler uses my file name for the temp file. Who woulda thought?

What you would do to control the temp file name if you were using the base
CodeCompileUnit object, I don't know. That will be a later excersize.

"Jay" wrote:

> I'm constructing a bunch of code into a set of CodeCompileUnit's and then
> attempting to compile using the CompileAssemblyFromDomBatch method.
> This works great assuming the compile is successful. If the compile is not
> successful, the CompilerResults has a Errors collection with a set
> CompilerError objects to point out the errors.
>
> Here's the problem; internally the C# compiler is generating a bunch of temp
> files and the CompilerError.FileName points back to the temp file name where
> the error is. It doesn't seem to have any reference back to the original
> CodeCompileUnit, so I have no idea where the error is.
>
> Is there a way to correlate the CompilerError or FileName back to
> CodeCompileUnits that caused the error rather than temp files? Or do I have
> to explicitly generate the files and then compile the files to know which
> compile units contain the errors myself?

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compile errors Gerhard Microsoft ASP .NET 6 24th Sep 2009 04:22 PM
Compile Errors : Me ? =?Utf-8?B?TWF1cmljaW8gU2lsdmE=?= Microsoft Access 0 2nd May 2005 07:41 PM
No errors but did not compile =?Utf-8?B?U2NvdHRE?= Microsoft Dot NET Compact Framework 4 14th Jan 2005 04:43 AM
compile errors? Victoria Microsoft Access VBA Modules 0 29th Jun 2004 03:57 PM
compile errors? Victoria Microsoft Access VBA Modules 0 29th Jun 2004 03:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:00 PM.