Discussion: Using custom crossgen for JitBench
I'm looking for a way to force the dotnet store in AspNet-GenerateStore.ps1 to pickup a custom crossgen (say, available at D:\coreclr\bin\Product\Windows_NT.x64.Release) to generate native images, rather than use the version pulled in to JitBench\.temp\Optimize\netcoreapp. Any suggestions for this? @rynowak @litian2025
The best place to ask for this might be https://github.com/dotnet/sdk - I neither work on the SDK nor the CLR so I don't have much experience for the workflow of using custom builds.
The msbuild file that fundamentally runs the store is here: https://github.com/dotnet/sdk/blob/b5aa4a2b0db4f6203050063139e1873fa024337a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.ComposeStore.targets
/cc @eerhardt @JosephTremoulet in case they have any ideas about the best way to proceed
Thanks for the pointer! I'll ask there and reply back once I have my solution.
FWIW, when I want to use a custom clrjit.dll, then, working in the dev branch of JitBench, I just copy clrjit.dll out of D:\coreclr\bin\Product\Windows_NT.x64.Release over top of the copy under the local .dotnet directory. I'd imagine the same would work for crossgen.exe.
The crossgen executable that dotnet store uses is resolved from the runtime.{RID}.Microsoft.NETCore.App NuGet package. See
https://github.com/dotnet/sdk/blob/cd25d6bbfc2aac61cc790c511900427ac64fdaa8/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.CrossGen.targets#L60-L89
I tried overwriting the /p:CrossgenDir property on the command line, but that doesn't work since these properties are being set in a Target, and unconditionally set. If we wanted to support this scenario more, we could change that code to check if the property was already defined.
I haven't tried @JosephTremoulet's recommendation, but that sounds reasonable - overwriting the file in the NuGet cache, which is where dotnet store will pick it up from. ex. C:\Users\eerhardt\.nuget\packages\runtime.win-x64.microsoft.netcore.app\2.0.0\runtimes\win-x64\native\..\..\..\tools.
Thanks for the suggestions! Overwriting the crossgen executable at C:\Users\Varun\.nuget\packages\runtime.win-x64.microsoft.netcore.app\2.1.0-preview2-25616-02\tools was the easiest fix for this.
Cool, glad you found a solution.
I'm re-opening this to track updating the docs to explain this. If you this suggestion please file an issue on SDK so they can track the feedback.
Done: #1614