I’m playing around a bit with the CodeDom. So I kind of converted my DCL PASCAL command from C# to an Oxygene command line program and added some code generation. It’s not for any use, a playground and … and …
CodeDomOptimizeTest.exe --help
-f, --Files Files to be compiled, delimited by coma.
-b, --Binary Filename of the DLL.
-o, --Optimize (Default: False) Specifies optimize or not.
-d, --Debug (Default: False) Specifies debug mode or not.
-w, --WarningLevel (Default: 4) Specifies the warning level.
-a, --Attributes Specifies a list of assembly attributes separated by coma, ex: Company=AXA.
–createdummy (Default: False) Creates a dummy source file.
–help Display this help screen.
So, when I compile a dummy file (–createdummy creates a pas file with a class containing two fields) and produce an AssemblyInfo.pas with AssemblyCompany set to axa, then I get (as expected) a DLL containing the compiled dummy file and the assembly info.
Now, I can compile with debug or not and with optimize or not, the Assembly Info always looks the same (ILSpy):
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.None)]
[assembly: AssemblyCompany("axa")]
When I analyze the DLL header, it sais:
File Version Information :
Version language : German (Switzerland)
ProductVersion : 1.0
FileVersion : 1.0.0.0
CompanyName : axa
Creation Date : 21/11/2017 17:39:21
Last Modif. Date : 21/11/2017 17:41:09
Last Access Date : 21/11/2017 17:39:21
FileSize : 2560 bytes ( 2.500 KB, 0.002 MB )
FileVersionInfoSize : 708 bytes
File type : Dynamic Link Library (0x2)
Target OS : Win32 (0x4)
File/Product version : 1.0.0.0 / 1.0.0.0
Language : German (Switzerland) (0x0)
Character Set : Not referenced (0x0)
Build Information :
Debug Version : no
Patched Version : no
Prerelease Version : no
Private Version : no
Special Build : no
Same result for:
- CodeDomOptimizeTest --createdummy -a"namespace=aa,company=axa" -O
- CodeDomOptimizeTest --createdummy -a"namespace=aa,company=axa" -debug
- CodeDomOptimizeTest --createdummy -a"namespace=aa,company=axa"
I also double checked (and it works as expected):
- by debugger that the CompilerOptions contains the -O:
parameters.CompilerOptions := “-allowglobals:yes -allowlegacywith:yes -delphicompatibility:yes -allowimplicitout:yes -delphidivide:yes” + if optimize then " -O" else String.Empty;
- and that the mdb and pdb files are created when I compile with -debug.
I might look at it again tomorrow, but so far I have no idea.
CodeDomOptimizeTest.zip (36.1 KB)
P.S. You have to first restore the nuget package to compile it.