Skip to content

WriteCodeFragment should support IsLiteral suffix for parity with MSBuild #18084

@Youssef1313

Description

@Youssef1313

See dotnet/msbuild#9724 for the original bug report.

MSBuild PR that implemented the feature for C#/VB in the past: dotnet/msbuild#6285

See https://learn.microsoft.com/en-us/visualstudio/msbuild/writecodefragment-task for documentation for IsLiteral. (NOTE: The doc page says it's not supported by F# and will need to be updated when/if this is implemented)

cc @Evangelink

The WriteCodeFragment implementation currently resides at src/FSharp.Build/WriteCodeFragment.fs and is part of the Fsharp.Build project.

This is the part that requires changing in order to support assignment of named properties as part of the attribute generation.

The syntax to set properties in F# attributes is: $nameOfAttribute = $valueOfAttribute, like this:
[<CommandLine.Verb("start", HelpText = "Start the game", IsDefault = true)>]

("start" is a regular constructor argument, HelpText and IsDefault are property assignments).

Make sure you add tests for the newly added FSharp.Build feature.
The tests should go to tests/FSharp.Build.UnitTests/WriteCodeFragmentTests.fs

You will need to define an attribute that allows public property setting

Metadata

Metadata

Assignees

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions