2016-11-22 16 views
5

Paket dosyalarını ayıklamak için Nuge.Core ile çalışan bir F # sahte komut dosyası var. Bunu C# konsol uygulaması ile yapmaya çalışırsam her şey düzgün çalışıyor. Ancak tam olarak aynı betiği bir # fake betiğinde çalıştırırsam, çalışmaz.f # betiğinde C# kodu yürütme beklenmedik bir davranışa sahiptir

nuget.core İhtiyacınız C# örneği için Docker.DotNet.2.124.3.nupkg


indirmenize gerek bu çoğaltmak için docker.dotnet, fake, f#: Orada burada bu kadar çok bağımlılıkları vardır ve nerede bir yardım aramak için hiçbir fikrim yok konsol uygulaması ve nuget.core nuget paketini yükleyin. Bu çalışıyor! f # numunesi için

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); 
     } 
    } 
} 

Eğer yan bu iki dosya yan gerekir: https://gist.github.com/mynkow/e6f0e550fcacc268dd1e9b743e17d344

HATA: Tüm olası bağımlılıkları 5 en son sürümleri ile çalıştık

============================================================================== 
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 

ve sonuçlar tam olarak aynı => C# çalışıyor, f # değil. Bunu düzeltmek için bana tavsiyede bulunabilecek herhangi bir fikrin var mı?


KİRLİ ÇÖZÜM:
Ben netstandard1.6 her şey çalışıyor örneğin kaldırırsanız Docker.DotNet.2.124.3.nupkg inside
nasıl göründüğünü budur. Bu, sorunun nuget.core'da olduğu anlamına gelir, değil mi? Ama neden C# konsol uygulamasında çalışıyor? Fikrim yok!


GÜNCELLEME: Ben PAKET ile paketleri indirdikten

+0

Her iki durumda da 'NuGet' kitaplığının aynı sürümüne başvurduğunuzdan emin misiniz? –

+0

evet, verilen örneklerde bu net değil, ancak kontrol edilmesi gereken ilk şeydi. Ayrıca her bağımlılığın birden çok versiyonunu denedim. – mynkow

+0

Komut dosyanızı bunun yerine fsi.exe ile çağırmayı deneyebilir misiniz? FAKE ile değil, FAKE ile çalışıyorsa, FAKE github deposunda bir hatayı günlüğe kaydetmek isteyebilirsiniz. Teşekkürler! – smoothdeveloper

cevap

1

F # konsol uygulamasından düzgün kod çalıştırabilir benim ve komut dosyası bu şekilde değiştirildi:

#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" 

O verir NuGet.Core bu

Microsoft (R) F# Interactive version 14.0.23413.0 
Copyright (c) Microsoft Corporation. All Rights Reserved. 

For help type #help;; 

> 

--> Referenced 'C:\tmp\visualfsharp.issue.nuget\./packages/FAKE/tools/FakeLib.dll' 


--> Referenced 'C:\tmp\visualfsharp.issue.nuget\./packages/NuGet.Core/lib/net40-Client/NuGet.Core.dll' 

Building project with version: LocalBuild 
Shortened DependencyGraph for Target Test: 
<== Test 

The resulting target order is: 
- Test 
Starting Target: Test 
============================================================================== 
Running build failed. 
Error: 
System.InvalidOperationException: The schema version of 'Docker.DotNet' is incompatible with version 1.6.30117.9648 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942. 
    at NuGet.Manifest.CheckSchemaVersion(XDocument document) 
    at NuGet.Manifest.ValidateManifestSchema(XDocument document, String schemaNamespace) 
    at NuGet.Manifest.ReadFrom(Stream stream, IPropertyProvider propertyProvider) 
    at NuGet.ZipPackage.EnsureManifest() 
    at [email protected](Unit _arg1) in C:\tmp\visualfsharp.issue.nuget\test.fsx:line 11 
    at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\FAKE\src\app\FakeLib\TargetHelper.fs:line 493 

--------------------------------------------------------------------- 
Build Time Report 
No target was successfully completed 
--------------------------------------------------------------------- 
--------------------------------------------------------------------- 

val it : unit =() 

> 

sürüm 2.12 olduğunu ve bunu Mi başvuran görüyorum yüklü olmayan crosoft.Web.Xdt.

Paketinizi kullanarak ve Docker.DotNet'i bağımlı olarak ekleyerek istediğiniz şeyi elde edersiniz, bunu sizin için çıkaracaktır.

Tanımladığınız yeniden üretilebilir bir hata varsa, lütfen bir ZIP yapın ve visualfsharp deposuna bir sorun bildirin.

+1

+1. Önerdiğiniz gibi bir sorun yayınladım. Orada zip bulabilirsiniz => https://github.com/Microsoft/visualfsharp/issues/1824 – mynkow