Default out filename of crossgen is confusing
I made a helloworld.dll example as follows. Default extension of helloword application is dll.
$ uname -a
Linux 48b709a6472b 3.13.0-107-generic dotnet/runtime#3928-Ubuntu SMP Tue Dec 20 09:57:27 UTC 2016 x86_64 GNU/Linux
$ dotnet --info
.NET Command Line Tools (1.0.1)
Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40cd1
Runtime Environment:
OS Name: debian
OS Version: 8
OS Platform: Linux
RID: debian.8-x64
Base Path: /usr/share/dotnet/sdk/1.0.1
$ dotnet new console
Content generation time: 52.2026 ms
The template "Console Application" created successfully.
$ dotnet restore
...
$ dotnet build
...
$ ls bin/Debug/netcoreapp1.1/
helloworld.deps.json helloworld.pdb helloworld.runtimeconfig.json
helloworld.dll helloworld.runtimeconfig.dev.json
Make native image from helloworld.dll using crossgen.
$ ./crossgen /ReadyToRun /Platform_Assemblies_Paths `pwd` helloworld.dll
Microsoft (R) CoreCLR Native Image Generator - Version 4.5.22220.0
Copyright (c) Microsoft Corporation. All rights reserved.
Native image /home/hqueue/tmp/coreoverlay/helloworld.ni.exe generated successfully.
Expected Result
Expected out filename is helloworld.ni.dll, since input filename is helloworld.dll.
Actual Result
Actual out filename is helloworld.ni.exe
It was quite confusing that input filename and output filename have different extension.
Is this intended behavior of crossgen ?
Or should helloworld have exe as extension at the first place when generated from dotnet cli?
It seems that extension is determined at https://github.com/dotnet/coreclr/blob/master/src/zap/zapper.cpp#L1587
And for non-dll file, it appends ni.exe to module name.
Is anybody working on this? If not, I'm willing to take this one.
But what's the expected behavior actually? Should we generate .exe instead of .dll at the beginning, or append the extension according to the file name instead of checking IsDll() ?
Is there any update on this?
cc @alpencolt @jkotas
@fadimounir Any changes planned here?
crossgen is typically run from a build script that passes explicit name for the output.
The default is there for convenience if you run the tool manually. I think the most convenient default for that would be to replace the input file.
There are no changes planned here so far. We typically use the /out to specify output file names as @jkotas explained. I think we should probably change the output extension to be the same as the input file. That would be a reasonable change. Anyways, the typical way we use crossgen is to specify the /out parameter, and replace the input file with the output file created by crossgen.
The crossgen tool has been replaced with crossgen2. This query represents a retired workflow. @hqueue If this remains with crossgen2, please let us know.