-
Notifications
You must be signed in to change notification settings - Fork 833
Labels
Milestone
Description
I have a F# class library with a literal in it and a C# console application that uses it. When the literal is changed, the F# library is rebuilt, but not the C# project, resulting in printing the wrong value. Also, if the C# project is changed and "rebuilt" (incremental), the old literal is used. Only if you make a clean rebuild, the proper literal value is used.
The F# library:
namespace ClassLibrary
module Literals =
[<Literal>]
let Number = 2048
C# app:
Console.WriteLine($"The number is {ClassLibrary.Literals.Number}");
- The output of a clean rebuild is 2048.
- When the literal is changed to something else, the output is still 2048.
- When the C# project is changed to e.g. print
ClassLibrary.Literals.Number + 1, it will print 2049 as if the literal still was 2048.
You need to manually trigger a rebuild (RMB -> Rebuild in VS) or clean the solution to resolve the inconsistency.
I'm using VS 17.14.8 with the .NET 8.0.411 SDK.
You can also clone this repository to reproduce the issue:
https://github.com/luithefirst/FSharpLiteral
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done