Compiling a C# Source File

  • Thread starter Thread starter OutdoorGuy
  • Start date Start date
O

OutdoorGuy

Greetings,

I was wondering if it is possible to compile two C# source files at the
same time? I am attempting to use the code below from a Command Prompt,
but am receiving an error:

csc C:\C#\C#_Samples\frmMain.cs frmInstructions.cs

[Note: "frmMain" is the first form which, in turn, calls the form,
"frmInstructions". If I just try to compile frmMain.cs, I receive an
error stating the following:
"The type or namespace 'frmInstructions' could not be found (are you
missing a using directive or an assembly reference?)].

Is there something wrong with my syntax?

Thanks in advance!

Sherwood
 
Could it simply be that your paths missing from the second cs file?

csc C:\C#\C#_Samples\frmMain.cs C:\C#\C#_Samples\frmInstructions.cs

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
OutdoorGuy said:
I was wondering if it is possible to compile two C# source files at the
same time? I am attempting to use the code below from a Command Prompt,
but am receiving an error:

csc C:\C#\C#_Samples\frmMain.cs frmInstructions.cs

[Note: "frmMain" is the first form which, in turn, calls the form,
"frmInstructions". If I just try to compile frmMain.cs, I receive an
error stating the following:
"The type or namespace 'frmInstructions' could not be found (are you
missing a using directive or an assembly reference?)].

Is there something wrong with my syntax?

Are both frmMain and frmInstructions.cs in the same namespace? If not,
does frmMain contain the appropriate using directive?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
OutdoorGuy said:
Greetings,

I was wondering if it is possible to compile two C# source files at the
same time? I am attempting to use the code below from a Command Prompt,
but am receiving an error:

csc C:\C#\C#_Samples\frmMain.cs frmInstructions.cs

[Note: "frmMain" is the first form which, in turn, calls the form,
"frmInstructions". If I just try to compile frmMain.cs, I receive an
error stating the following:
"The type or namespace 'frmInstructions' could not be found (are you
missing a using directive or an assembly reference?)].

Is there something wrong with my syntax?

Thanks in advance!

Sherwood

Your second file is missing the path.

csc C:\C#\C#_Samples\frmMain.cs frmInstructions.cs
make it:
csc C:\C#\C#_Samples\frmMain.cs C:\C#\C#_Samples\frmInstructions.cs

or better make C:\C#\C#_Samples you current directory so you can simply run:

csc frmMain.cs frmInstructions.cs

Willy.
 
Willy Denoyette said:
Your second file is missing the path.

I wondered whether that was the problem too, but if it *were* the
problem, the very first error message would be that frmInstructions.cs
wasn't found. I at least *hope* the OP would have investigated that
first!

<snip>
 
Jon Skeet said:
I wondered whether that was the problem too, but if it *were* the
problem, the very first error message would be that frmInstructions.cs
wasn't found. I at least *hope* the OP would have investigated that
first!

Jon,

Absolutely right, the problem must lay elsewere.

Willy.
 
Back
Top