我无法在F#签名文件中定义文字.
我有一个文件,File.fs
如下所示:
module Thingo =
[<Literal>]
let hello = "world"
Run Code Online (Sandbox Code Playgroud)
我需要为它创建一个签名文件,所以最初尝试this(File.fsi
):
module Thingo =
[<Literal>]
val hello : string
Run Code Online (Sandbox Code Playgroud)
这导致以下错误File.fsi
:A declaration may only be the [<Literal>] attribute if a constant value is also given, e.g. 'val x : int = 1'
我放弃了:
module Thingo =
[<Literal>]
val hello : string = "world"
Run Code Online (Sandbox Code Playgroud)
声明后的行val hello
收到错误:Incomplete structured construct at or before this point in signature file. Expected incomplete structured construct …
我需要System.Timers.Timer
在F#PCL库中使用。
我目前的目标是框架4.5并使用Profile7(我使用VS模板),并且它不允许访问System.Timer。
根据此SO答案,这是一个已知问题,已在4.5.1中解决。
我创建了一个4.5.1 C#PCL,并检查了其.csproj。它针对框架4.6,并使用Profile32。
在F#项目中有没有针对相同目标的方法?我天真地尝试使用C#值更新.fsproj,但它破坏了一切。:)
非常感谢!