我遇到了以下代码,无法理解双感叹号提供的操作.此代码snipet来自CICD系统中使用的FAKE脚本.Microsoft的符号和运算符参考不会列出此运算符,也无法在FAKE的API参考中找到它.
!! (projectPackagePath + "/*.zip")
|> Seq.iter(fun path ->
trace ("Removing " + path)
ShellExec tfCommand ("delete " + path + " /noprompt")
Run Code Online (Sandbox Code Playgroud)
另一个使用示例
let buildLabelFiles =
!!(labelPath @@ "*.txt")
Run Code Online (Sandbox Code Playgroud) 我想从FAKE发布nuget包.但我不使用NuGet来创建这些包.我在一些项目中安装了OctoPack,我正在使用/ p运行build:RunOctoPack = True.这会将.nupkg文件转储到bin目录中.然后我如何收集这些包并将它们推送到NuGet服务器?我似乎无法让NuGetPublish和FileIncludes一起工作.
编辑:现在我使用ExecProcess解决了这个问题
Target "Publish" (fun _ ->
let result = ExecProcess (fun info ->
info.FileName <- "MySolution/.nuget/NuGet.exe"
info.WorkingDirectory <- "MySolutionDirectory"
info.Arguments <- "push \"**/bin/**/*.nupkg\" -s http://my-nuget-server") TimeSpan.MaxValue
if result <> 0 then failwithf "NuGet.exe push returned with a non-zero exit code"
Run Code Online (Sandbox Code Playgroud)
)
假设我有一个以下文件夹结构
build
build.fsx
build.bat
//build tools etc.
src
Project1
Project2
//...
Run Code Online (Sandbox Code Playgroud)
当我在build.fsx中运行我的RestorePackages()时,它将在"./**/packages.config"中查找packages.config(根据文档),并将忽略要在项目文件夹中恢复的所有包.
我可以使用这个方法,并且可能会逐个地为每个项目的packages.config提供路径,但是我不希望每次将新项目添加到解决方案时都更改构建脚本.
有没有办法让RestorePackages()在某个特定路径中查找所有packages.config?
编辑:
另外,相关的问题.我明白了,我必须将nuget路径传递给RestorePackage,因为默认情况下它似乎是在./tools/nuget/nuget.exe中.我可以这样做:
RestorePackage(fun p -> { p with ToolPath = "my/nuget/path"})
Run Code Online (Sandbox Code Playgroud)
但我不知道如何将它与你提供的例子联系起来.管道和函数调用对我来说,F#语法仍然有点混乱.
我目前在我的机器上安装了VS2013和VS2015.
默认情况下,FAKE F#Make似乎正在构建VS2015.
我尝试将VisualStudioVersion 12.0传递给我的MSBuild任务,但似乎没有任何效果.
我看到一些文章说改变Fake.exe.config中的MSBuildPath但我没有在那个exe中看到MSBuildPath.
如何确保它使用随Visual Studio 2012(12.0)提供的MSBuild?
我刚刚在ProjectScaffold生成的FAKE构建脚本中找到了这个目标:
// Copies binaries from default VS location to expected bin folder
// But keeps a subdirectory structure for each project in the
// src folder to support multiple project outputs
Target "CopyBinaries" (fun _ ->
!! "src/**/*.??proj"
-- "src/**/*.shproj"
|> Seq.map (fun f -> ((System.IO.Path.GetDirectoryName f)
</> "bin/Release", "bin"
</> (System.IO.Path.GetFileNameWithoutExtension f)))
|> Seq.iter (fun (fromDir, toDir) -> CopyDir toDir fromDir (fun _ -> true))
)
Run Code Online (Sandbox Code Playgroud)
我的问题:这个奇怪的</>
操作员做什么?
(我的互联网搜索不是很成功.)
给出一个简单的F#控制台应用:
[<EntryPoint>]
let main argv =
printfn "Hello world"
Console.ReadLine() |> ignore
0
Run Code Online (Sandbox Code Playgroud)
我需要做什么才能以与ctrl F5在Visual Studio中相同的方式启动控制台应用程序.我尝试使用Fake.ProcessHelper从FAKE构建脚本运行它:
Target "Run" (fun _ ->
let exe = @"C:\Source\code\fs_console_app\build\fs_console_app.exe"
let errorCode = Shell.AsyncExec(exe, "", buildDir)
()
)
Run Code Online (Sandbox Code Playgroud)
点击Ctrl F5我收到以下构建报告:
Target Duration
------ --------
Build 00:00:00.3916039
Run 00:00:00.0743197
Total: 00:00:00.5605493
Status: Ok
Run Code Online (Sandbox Code Playgroud)
但没有控制台应用程序启动和等待输入的迹象.
我正在尝试设置一个可以运行FsUnit的基本FAKE F#项目,但我无法弄清楚如何解决这些Method not found: 'Void FsUnit.TopLevelOperators.should(Microsoft.FSharp.Core.FSharpFunc`2<!!0,!!1>, !!0, System.Object)'
错误.
我已经阅读了以下似乎相关的帖子,但我显然仍然不喜欢它:
我已经JunkTest
使用以下设置创建了一个库项目:
source https://www.nuget.org/api/v2
nuget FAKE
nuget FSharp.Core
nuget FsUnit
nuget NUnit
nuget NUnit.Console
Run Code Online (Sandbox Code Playgroud)
FSharp.Core
FsUnit
NUnit
Run Code Online (Sandbox Code Playgroud)
module JunkTest
open FsUnit
open NUnit.Framework
[<Test>]
let ``Example Test`` () =
1 |> should equal 1 // this does not work
//Assert.That(1, Is.EqualTo(1)) // this works (NUnit)
Run Code Online (Sandbox Code Playgroud)
Target "Test" (fun _ ->
!! (buildDir + "JunkTest.dll")
|> NUnit3 (fun p ->
{p …
Run Code Online (Sandbox Code Playgroud) 我是VS code/F#的新手(如果这很傻,那就是preapologies),我正在尝试构建一个F#控制台应用程序(在Windows工作站和我的Linux计算机上).
我和FAKE一起安装了Ionide扩展.
我正在考虑的代码是Iris示例(请参阅如何将介绍ML.Net演示转换为F#?),使用Ionide创建一个新的F#项目并使用Microsoft.ML.
我的iris.fsproj
是
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
<DebugType>portable</DebugType>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Compile Include="iris.fs" />
<None Include="App.config" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
Run Code Online (Sandbox Code Playgroud)
运行脚本时(我使用"播放"按钮,也就是F#:运行VS Code/Ionide提供的脚本),我得到:
C:\Users\MyUser\.nuget\packages\microsoft.ml\0.2.0\build\Microsoft.ML.targets(16,5): error : Microsoft.ML currently supports 'x64' processor architectures. Please ensure your application is targeting 'x64'.
和...一起
Running build failed.
Error:
System.Exception: dotnet build failed
如何使用Ionide提供的项目结构来定位x64?
我有一个F#假脚本,可以解Nuge.Core
压缩包文件.如果我尝试使用c#console app执行此操作,一切正常.但是,如果我在af#fake脚本中执行完全相同的脚本,则它无效.这里有这么多的依赖关系,我不知道到哪里寻找帮助:docker.dotnet
,fake
,f#
,nuget.core
要重现这一点,您需要下载Docker.DotNet.2.124.3.nupkg
对于c#示例,您需要控制台应用程序并安装nuget.core
nuget包.这很有效!
class Program
{
static void Main()
{
var zip = new NuGet.ZipPackage(@"Docker.DotNet.2.124.3.nupkg");
foreach (var file in zip.GetFiles())
{
System.Console.WriteLine(file.Path);
}
}
}
Run Code Online (Sandbox Code Playgroud)
对于f#示例,您需要并排使用这两个文件:https: //gist.github.com/mynkow/e6f0e550fcacc268dd1e9b743e17d344
错误:
==============================================================================
FsiEvaluationException:
Error: System.InvalidOperationException: 'NETStandard.Library' already has a dependency defined for 'Microsoft.NETCore.Platforms'.
at NuGet.Manifest.ValidateDependencySets(IPackageMetadata metadata)
at NuGet.Manifest.Validate(Manifest manifest)
at NuGet.Manifest.ReadFrom(Stream stream, IPropertyProvider propertyProvider, Boolean validateSchema)
at NuGet.LocalPackage.ReadManifest(Stream manifestStream)
at NuGet.ZipPackage.EnsureManifest(Func`1 manifestStreamFactory)
at NuGet.ZipPackage..ctor(String filePath, Boolean enableCaching)
at …
Run Code Online (Sandbox Code Playgroud) 你好,我正在学习 F#,我想用 F# 编译一些东西
这些是我遵循的步骤:
然后我收到错误:项目中不存在目标“Build”。
在 Visual Studio Code 中编译 F# 解决方案需要遵循哪些步骤?
---------------------------------------------------------------------
1) Building c:\Users\sfyir\Code\fsharp\ConsoleTest\ConsoleTest.fsproj failed with exitcode 1.
---------------------------------------------------------------------
2) MSB4057: c:\Users\sfyir\Code\fsharp\ConsoleTest\ConsoleTest.fsproj(0,0): The target "Build" does not exist in the project.
Run Code Online (Sandbox Code Playgroud)