I have a F # fake script that works with Nuge.Core to extract package files. If I try to do this using a C # console application, everything will work correctly. However, if I execute the exact same script in f # fake script, it does not work. There are so many dependencies, and I have no idea where to look for help: docker.dotnet , fake , f# , nuget.core
To reproduce this, you need to download Docker.DotNet.2.124.3.nupkg
For C # sample, you need a console application and install the nuget.core nuget package. It works!
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); } } }
For sample f #, you need these two files side by side: https://gist.github.com/mynkow/e6f0e550fcacc268dd1e9b743e17d344
ERROR:
============================================================================== 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> .$FSI_0005_Test$fsx.main@ () 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 Yaaf.FSharp.Scripting.Helper.evalScript@1303.Invoke (String arg00) in C:\code\FAKE\paket-files\matthid\Yaaf.FSharp.Scripting\src\source\Yaaf.FSharp.Scripting\YaafFSharpScripting.fs:line 1303 at Yaaf.FSharp.Scripting.Helper.save_@1276-2.Invoke (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 Yaaf.FSharp.Scripting.Helper.redirectOut@1247 [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 Yaaf.FSharp.Scripting.Helper.save_@1275-1.Invoke (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 Yaaf.FSharp.Scripting.Helper.save_@1275-1.Invoke (String text) in C:\code\FAKE\paket-files\matthid\Yaaf.FSharp.Scripting\src\source\Yaaf.FSharp.Scripting\YaafFSharpScripting.fs:line 1284 at Yaaf.FSharp.Scripting.Helper.session@1306.Yaaf-FSharp-Scripting- 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> .$FSI_0005_Test$fsx.main@ () in C:\Users\mynkow\Desktop\Reproduce\test.fsx:line 12 Stopped due to error
I tried with the 5 latest versions of all possible dependencies, and the results are exactly the same => C # works, f # does not. Do you have any hint or just everything that you can advise me to try to fix it?
DIRTY SOLUTION:
This is what Docker.DotNet.2.124.3.nupkg looks like inside
If I delete, for example, netstandard1.6 everything works. That means the problem is in nuget.core , right? But why does it work in a C # console application? I do not know!
UPDATE: I can correctly execute code from a console application F #