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

Exposes the DynamicAssembly so that it can be saved to disk by consumers. #365

Merged
merged 1 commit into from
Jul 8, 2015

Conversation

xavierzwirtz
Copy link
Contributor

I am working on using this to cache the compilation of FAKE's build script. This change lets you evaluate changes, and then save the in memory compiled assembly to disk using AssemblyBuilder.Save.

    let session = FsiEvaluationSession.Create(fsiConfig, commonOptions, stdin, outStream, errStream)
    session.EvalScript scriptPath
    let assemBuilder = session.DynamicAssembly :?> System.Reflection.Emit.AssemblyBuilder
    assemBuilder.Save("FSI-ASSEMBLY.dll")

@7sharp9
Copy link
Member

7sharp9 commented Jul 7, 2015

Is there not an issue with optdata and sigdata missing from the assembly?

@xavierzwirtz
Copy link
Contributor Author

Surprisingly no, I was able to load the assembly via reflection and execute the main method. I did have to save it as "FSI-ASSEMBLY" though.

@xavierzwirtz
Copy link
Contributor Author

I think I didnt have any issue with those missing because I am only loading the assembly and executing it through reflection. If you were to attempt to reference it from a project there would probably be issues.

dsyme added a commit that referenced this pull request Jul 8, 2015
Exposes the DynamicAssembly so that it can be saved to disk by consumers.
@dsyme dsyme merged commit e793f2f into fsharp:master Jul 8, 2015
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.

3 participants