Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let IronPython Compiler only create one exe file when target to exe or winexe #1786

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

wherewhere
Copy link

@wherewhere wherewhere commented Mar 27, 2024

The issue is #1785
I add a new method CreateAssemblyGen in ClrModule to get AssemblyGen, so that I can add exe host code into ScriptCode assembly. Then I change the init code from

string currentDirectory = Environment.CurrentDirectory;
Environment.CurrentDirectory = new FileInfo(Assembly.GetEntryAssembly().Location).Directory.FullName;
string fullPath = Path.GetFullPath("bin/Program.dll");
Environment.CurrentDirectory = currentDirectory;
return PythonOps.InitializeModuleEx(Assembly.LoadFile(fullPath), "__main__", null, ignoreEnvVars: false, null);

to

return PythonOps.InitializeModuleEx(Assembly.GetExecutingAssembly(), "__main__", null, ignoreEnvVars: false, null);

since the ScriptCode assembly is itself.
But now it have some new problem. Since the AssemblyBuilder dose not have DefineIconResource method, I have no ideal to add win32 icon. And the Windows Defender said it is viruses when /standalone option is on...

PS. I use reflection to invoke SavableScriptCode.CompileForSave since SavableScriptCode is in DLR repository. It is better to add CreateAssemblyGen method for SavableScriptCode.

Have not add Win32 Icon since AssemblyBuilder dose not have DefineIconResource method
@wherewhere
Copy link
Author

Looks fine with .NET Core App
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant