I first thought I had some compiler setting wrong in VC# 2003 but it turns
out that it has something to do with .NET framework v1.1 itself.
If I understand correctly, .NET installer also installs a csc.exe C#
compiler. And VC# 2003 is using this csc.exe compiler.
Uninstalled an reinstalled both the .NET v1.0 and v1.1 framework multiple
times now.
I also repaired, uninstalled and installed VC# 2002 and 2003 and the full
trial version, no sollution.
What happened? Wel this:
I took a stupidly simple console program (with no unsafe code or any
modifications).
And I compile using the command line compiler like this:
----
D:\Source\Scratch\Managed\Testing\ConsoleApplicati on1>csc.exe /out:clas
:exe /r:MSCorLib.dll class1.cs
----
This is the result that I get, and the exe is there and works fine:
----
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
----
Now I add one simple additional command "/unsafe+"
----
D:\Source\Scratch\Managed\Testing\ConsoleApplicati on1>csc.exe /out:clas
:exe /r:MSCorLib.dll /unsafe+ class1.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
error CS1577: Assembly generation failed -- Unexpected exception
proces
attribute -- System.ArgumentException: Invalid directory on URL
----
So it seems that this *System.ArgumentException* is an error from the
csc.exe compiler??? No exec code exists.
One odd thing is that when I use "/unsafe-" (minus) then it compiles
without problems.
This works fine using the VC# 2002!!!!! And it also works fine using VC#
2003 at a different computer installed from the same installation disk.
One final test I did was using the C# csc.exe from framework 1.0 and this
one DID compile with "/unsafe+" !!!!!
See below:
D:\Source\Scratch\Managed\Testing\ConsoleApplicati on1>C:\WINNT\Microsoft.NET
\Fra
mework\v1.0.3705\csc /out:test.exe /unsafe+ class1.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
Mysteries, mysteries,....
Do we have here some .NET 1.1 csc.exe bug???