私はNuge.Core
で動作するF#の偽のスクリプトを使用してパッケージファイルを抽出しています。私がC#console appでこれをしようとすると、すべて正常に動作します。しかし、もし私がf#の偽のスクリプトで全く同じスクリプトを実行するなら、それは動作しません。f#スクリプトでc#コードを実行すると予期しない動作が発生する
nuget.core
はあなたが必要とするC#のサンプルについてDocker.DotNet.2.124.3.nupkg
をダウンロードする必要があり、これを再現するために、docker.dotnet
、fake
、f#
:そこここに非常に多くの依存関係があり、私はどこに助けを探すには考えていますコンソールアプリケーションをインストールし、nuget.core
ナゲットパッケージをインストールします。これは動作しています! https://gist.github.com/mynkow/e6f0e550fcacc268dd1e9b743e17d344
ERROR:あなたはこれらの2つのファイルを並べて必要のF#のサンプルについて
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);
}
}
}
==============================================================================
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 <StartupCode$FSI_0005>[email protected]() in C:\Users\mynkow\Desktop\Reproduce\test.fsx:line 12
Stopped due to error
Output: [Loading C:\Users\mynkow\Desktop\Reproduce\test.fsx]
==============================================================================
Input: C:\Users\mynkow\Desktop\Reproduce\test.fsx
\Arguments:
C:\fsi.exe
Exception: Yaaf.FSharp.Scripting.FsiEvaluationException: Error while compiling or executing fsharp snippet. ---> System.Exception: Operation failed. The error text has been print the error stream. To return the corresponding FSharpErrorInfo use the EvalInteractionNonThrowing, EvalScriptNonThrowing or EvalExpressionNonThrowing
at Microsoft.FSharp.Compiler.Interactive.Shell.FsiEvaluationSession.commitResult[a,b](FSharpChoice`2 res)
at Microsoft.FSharp.Compiler.Interactive.Shell.FsiEvaluationSession.EvalScript(String filePath)
at [email protected](String arg00) in C:\code\FAKE\paket-files\matthid\Yaaf.FSharp.Scripting\src\source\Yaaf.FSharp.Scripting\YaafFSharpScripting.fs:line 1303
at [email protected](Unit unitVar0) in C:\code\FAKE\paket-files\matthid\Yaaf.FSharp.Scripting\src\source\Yaaf.FSharp.Scripting\YaafFSharpScripting.fs:line 1277
at Yaaf.FSharp.Scripting.Helper.consoleCapture[a](TextWriter out, TextWriter err, FSharpFunc`2 f) in C:\code\FAKE\paket-files\matthid\Yaaf.FSharp.Scripting\src\source\Yaaf.FSharp.Scripting\YaafFSharpScripting.fs:line 1221
at [email protected][a](Boolean preventStdOut, OutStreamHelper out, OutStreamHelper err, FSharpFunc`2 f) in C:\code\FAKE\paket-files\matthid\Yaaf.FSharp.Scripting\src\source\Yaaf.FSharp.Scripting\YaafFSharpScripting.fs:line 1254
at [email protected](String text) in C:\code\FAKE\paket-files\matthid\Yaaf.FSharp.Scripting\src\source\Yaaf.FSharp.Scripting\YaafFSharpScripting.fs:line 1276
--- End of inner exception stack trace ---
at [email protected](String text) in C:\code\FAKE\paket-files\matthid\Yaaf.FSharp.Scripting\src\source\Yaaf.FSharp.Scripting\YaafFSharpScripting.fs:line 1284
at [email protected]IFsiSession-EvalScriptWithOutput(String) in C:\code\FAKE\paket-files\matthid\Yaaf.FSharp.Scripting\src\source\Yaaf.FSharp.Scripting\YaafFSharpScripting.fs:line 1308
at Fake.FSIHelper.runScriptUncached(Boolean useCache, String scriptPath, IEnumerable`1 fsiOptions, Boolean printDetails, CacheInfo cacheInfo, TextWriter out, TextWriter err) in C:\code\FAKE\src\app\FakeLib\FSIHelper.fs:line 471
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 <StartupCode$FSI_0005>[email protected]() in C:\Users\mynkow\Desktop\Reproduce\test.fsx:line 12
Stopped due to error
私はすべての可能な依存関係の5つの最新バージョンで試してみました結果はまったく同じです。=> C#は動作していますが、f#は動作していません。あなたはこれを解決しようと私に助言することができる何か手がかりを持っていますか?
DIRTY SOLUTION:
これは私が例えばnetstandard1.6
すべての作品を削除した場合Docker.DotNet.2.124.3.nupkgがinside
どのように見えるかです。これは、問題がnuget.core
にあることを意味します。しかし、なぜそれがC#コンソールアプリで働いていますか?考えていない!
UPDATE:
#r @"./packages/FAKE/tools/FakeLib.dll"
#r @"./packages/NuGet.Core/lib/net40-Client/NuGet.Core.dll"
open System
open System.Collections.Generic
open System.IO
open Fake
Target "Test" (fun _ ->
printfn "=============================================================================="
global.NuGet.ZipPackage(@"Docker.DotNet.2.124.3.nupkg").GetFiles() |> Seq.iter(fun x -> printfn "%s" x.Path)
)
RunParameterTargetOrDefault "target" "test"
それが与える:私はpaketでパッケージをダウンロードし、スクリプトをこのように変更した適切F#コンソールアプリケーション
どちらの場合も同じバージョンの 'NuGet'ライブラリを参照していますか? –
はい、提供されたサンプルではこれは明確ではありませんが、これが最初に確認する必要がありました。また、私はすべての依存関係の複数のバージョンを試してみました。 – mynkow
代わりにfsi.exeでスクリプトを呼び出せますか? fsiでは動作しますが、FAKEでは動作しない場合、FAKE githubリポジトリにバグを記録することができます。ありがとう! – smoothdeveloper