Skip to content

Conversation

@brettfo
Copy link
Member

@brettfo brettfo commented Oct 4, 2017

Enables the <WriteCodeFragment /> task for F#.

Since F# doesn't have CodeDOM support, both the CodeDOM and CoreCLR branches end up calling the same function to do the generation. This should enable things like assembly name/version attributes to be generated.

Due to some oddities in how F# code must be structured, there are two things to point out in the generated code:

  1. Files must (not really, but it's complicated) start with a namespace declaration. This value doesn't matter and won't end up in the compiled assembly, so the value of FSharp was selected.
  2. F# files that contain no types/modules must have some executable code and the F# way of doing this is to add a do() expression at the bottom of the file.

Otherwise the code generated for CoreCLR C# was used as the model and a VB-specific test was copied.

Fixes #2584.

@AndyGerlicher
Copy link
Contributor

This seems like it should be in the F# SDK? Ideally even C# / VB wouldn't be here either, but I'd at least rather not expand when possible. Any reason it couldn't go there?

@brettfo
Copy link
Member Author

brettfo commented Oct 5, 2017

No reason this couldn't go in the F# SDK; I was just mimicking what C#/VB does. I'd be happy to have this PR closed and put it there if that's what you'd prefer.

@brettfo
Copy link
Member Author

brettfo commented Oct 6, 2017

Closing in favor of dotnet/fsharp#3702

@brettfo brettfo closed this Oct 6, 2017
@brettfo brettfo deleted the writecodefragment-fsharp branch October 6, 2017 23:52
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