假 CscHelper:Csc vs csc?
FAKE CscHelper: Csc vs csc?
我不明白这两者的区别
我想使用 FAKE 的 CscHelper 将单个 c# 文件编译成一个 dll。这是我的构建文件:
// include Fake lib
#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open CscHelper
Target "Default" (fun _ ->
["Discover.cs"] |> csc (fun p -> { p with Output="Discover.dll"; Target=Library })
)
RunTargetOrDefault "Default"
这是我得到的错误:
build.fsx(7,24): error FS0001: Type mismatch. Expecting a
string list -> unit
but given a
string list -> int
The type 'unit' does not match the type 'int'
如果我将 "csc" 替换为 "Csc",它会正确编译。为什么?在文档中,除了那个单个字符外,代码示例在字面上是相同的。除了 return 类型之外,方法签名看起来相同。为什么有两种变体?如何使小写的变体起作用?
小写形式是正确的。您始终可以将结果通过管道传递给忽略函数,以确保 return 一个单位 ().
// include Fake lib
#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open CscHelper
Target "Default" (fun _ ->
["Discover.cs"] |> csc (fun p -> { p with Output="Discover.dll"; Target=Library }) |> ignore
)
RunTargetOrDefault "Default"
实际的工具提示会告诉您发生了什么(它 returns 退出状态代码 是 int 类型):
Type mismatch. Expecting a
'string list -> unit'
but given a
'string list -> int'
The type 'unit' does not match the type 'int'
val csc : setParams:(CscParams -> CscParams) -> inputFiles:string list -> int
Full name: Fake.CscHelper.csc
Compiles the given C# source files with the specified parameters.
Parameters
setParams
- Function used to overwrite the default CSC parameters.
inputFiles
- The C# input files.
Returns
The exit status code of the compile process.
Sample
["file1.cs"; "file2.cs"] |> csc (fun parameters -> { parameters with Output = ... Target = ... ... })
您可能已经发现或没有发现这一点,但是每个人都知道有选择是件好事。谢谢你。美好的一天。
我不明白这两者的区别
我想使用 FAKE 的 CscHelper 将单个 c# 文件编译成一个 dll。这是我的构建文件:
// include Fake lib
#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open CscHelper
Target "Default" (fun _ ->
["Discover.cs"] |> csc (fun p -> { p with Output="Discover.dll"; Target=Library })
)
RunTargetOrDefault "Default"
这是我得到的错误:
build.fsx(7,24): error FS0001: Type mismatch. Expecting a
string list -> unit
but given a
string list -> int
The type 'unit' does not match the type 'int'
如果我将 "csc" 替换为 "Csc",它会正确编译。为什么?在文档中,除了那个单个字符外,代码示例在字面上是相同的。除了 return 类型之外,方法签名看起来相同。为什么有两种变体?如何使小写的变体起作用?
小写形式是正确的。您始终可以将结果通过管道传递给忽略函数,以确保 return 一个单位 ().
// include Fake lib
#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open CscHelper
Target "Default" (fun _ ->
["Discover.cs"] |> csc (fun p -> { p with Output="Discover.dll"; Target=Library }) |> ignore
)
RunTargetOrDefault "Default"
实际的工具提示会告诉您发生了什么(它 returns 退出状态代码 是 int 类型):
Type mismatch. Expecting a 'string list -> unit'
but given a 'string list -> int'
The type 'unit' does not match the type 'int' val csc : setParams:(CscParams -> CscParams) -> inputFiles:string list -> int Full name: Fake.CscHelper.csc Compiles the given C# source files with the specified parameters.Parameters
setParams
- Function used to overwrite the default CSC parameters.inputFiles
- The C# input files.Returns
The exit status code of the compile process.
Sample
["file1.cs"; "file2.cs"] |> csc (fun parameters -> { parameters with Output = ... Target = ... ... })
您可能已经发现或没有发现这一点,但是每个人都知道有选择是件好事。谢谢你。美好的一天。