Copied from bug 2981389
In addition you also might check "CompilerBase.cs".
Currently output dir must be created in advance. If not, a simple <csc>
task will fail
With the attached test-project.zip, I was able to recreate the problem. Basically when the specified output path includes non-existing directories, the task will fail. Instead to make the task more user firendly, the first step should automatically the directories automatically, then to allow the output binaries to be created.
Buildfile: file:///C:/cygwin/home/admin/nant/scratch/test.build
Target framework: Microsoft .NET Framework 2.0
[csc] Compiling 1 files to 'C:\cygwin\home\admin\nant\scratch\bin\HelloWorld.exe'.
[csc] warning CS1691: '0519' is not a valid warning number
[csc] fatal error CS0042: Unexpected error creating debug information file 'c:\cygwin\home\admin\nant\scratch\bin\
c:\cygwin\home\admin\nant\scratch\bin\HelloWorld.pdb: The system cannot find the path specified.
[csc] '
BUILD FAILED
C:\cygwin\home\admin\nant\scratch\test.build(3,6):
External Program Failed: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe (return code was 1)
Total time: 0.6 seconds.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Need to investigate the nature of this issue and whether it is also inconsistent with the other tasks.
With the attached test-project.zip, I was able to recreate the problem. Basically when the specified output path includes non-existing directories, the task will fail. Instead to make the task more user firendly, the first step should automatically the directories automatically, then to allow the output binaries to be created.
test.build
-----------
<?xml version="1.0"?>
<project name="Hello World">
<csc target="exe" output="bin\HelloWorld.exe" debug="true">
<nowarn>
<!-- do not report warnings for missing XML comments -->
<warning number="0519" />
</nowarn>
<sources>
<include name="*.cs" />
</sources>
<references>
<include name="System.dll" />
<include name="System.Data.dll" />
</references>
</csc>
</project>
Output
-------
NAnt 0.90 (Build 0.90.3742.0; alpha1; 3/31/2010)
Copyright (C) 2001-2010 Gerry Shaw
http://nant.sourceforge.net
Buildfile: file:///C:/cygwin/home/admin/nant/scratch/test.build
Target framework: Microsoft .NET Framework 2.0
[csc] Compiling 1 files to 'C:\cygwin\home\admin\nant\scratch\bin\HelloWorld.exe'.
[csc] warning CS1691: '0519' is not a valid warning number
[csc] fatal error CS0042: Unexpected error creating debug information file 'c:\cygwin\home\admin\nant\scratch\bin\ c:\cygwin\home\admin\nant\scratch\bin\HelloWorld.pdb: The system cannot find the path specified.
[csc] '
BUILD FAILED
C:\cygwin\home\admin\nant\scratch\test.build(3,6):
External Program Failed: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe (return code was 1)
Total time: 0.6 seconds.
Fixed.
src/NAnt.DotNet/Tasks/CompilerBase.cs
tests/NAnt.DotNet/Tasks/CscTaskTest.cs
tests/NAnt.DotNet/Tasks/JscTaskTest.cs
tests/NAnt.DotNet/Tasks/VbcTaskTest.cs
tests/NAnt.DotNet/Tasks/VjcTaskTest.cs
Checked into CVS.