fsprojects / FSharp.Configuration

The FSharp.Configuration project contains type providers for the configuration of .NET projects.
http://fsprojects.github.io/FSharp.Configuration/
Other
114 stars 63 forks source link

[WIP] Net standard 2.0 #133

Closed vasily-kirichenko closed 6 years ago

dsyme commented 6 years ago

@vasily-kirichenko I added https://github.com/fsprojects/FSharp.Configuration/pull/133/commits/f3945c63f27898e4334dbd4bac44950e69de9f8d and it gets a bit further but we hit a problem later.

Will keep working on this (don't bother looking at it again yet)

vasily-kirichenko commented 6 years ago

@dsyme thank you.

dsyme commented 6 years ago

@vasily-kirichenko I pushed a PR to this PR. https://github.com/vasily-kirichenko/FSharp.Configuration/pull/1

Could you possibly also give me write access to your repo so I can push directly into the PR if needed?

dsyme commented 6 years ago

@forki @matthid I didn't have any luck getting paket.references as a way to reference things in the context of .NET SDK 2.0 projects, see https://github.com/vasily-kirichenko/FSharp.Configuration/pull/1/files#diff-779d38522b9a20363b68bfa4828841f6R16

I'm not sure what I'm doing wrong, I read the docs and it seems it should just magically work

dsyme commented 6 years ago

@vasily-kirichenko The PR gets as far as this sequence of steps working:

dotnet build FSharp.Configuration.sln ## succeeds, builds Debug

dotnet build FSharp.Configuration.Tests.sln ## fails, but creates whacky obj\project.assets.json

msbuild FSharp.Configuration.Tests.sln ## succeeds

Notes

  1. I don't understand why plain msbuild doesn't succeed, i.e. why the project.assets.json is needed. If I just use build.cmd from the top I get

C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(323,5): Assets file 'C:\GitHub\dsyme\FSharp.Configuration\src\FSharp.Configuration\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(165,5): Assets file 'C:\GitHub\dsyme\FSharp.Configuration\src\FSharp.Configuration\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.

  1. If you want the second step to succeed you have to make dotnet use the F# compiler running on .NET Framework/Mono, by adding fsc.props and importing it

  2. The first step is building Debug version of the type provider, referenced in the second step

matthid commented 6 years ago

@dsyme I cannot test right now but for new SDK projects (and FSharp.Configuration.Tests.fsproj already looks like a new style project) usually all you need to do is to edit the corresponding paket.references to add the package you want (https://github.com/vasily-kirichenko/FSharp.Configuration/pull/1/files#diff-0416bd63c42a303643978cdcd47b1665). Paket will no longer emit any direct dll references (just like NuGet is not anymore either)

In worst case a git clean/dotnet restore is required.

dsyme commented 6 years ago

@matthid Yeah, I know, thanks. That's what wasn't working for me. I didn't look into it and added an explicit reference into the package directory instead

vasily-kirichenko commented 6 years ago

@dsyme I included fsc.props into the tests project, but it's not helped, I've got the same error:

The type provider 'D:\WLCR\github\FSharp.Configuration\src\FSharp.Configuration\bin\Debug\netstandard2.0\FSharp.Configuration.dll' reported an error: Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FSharp.Configuration' which cannot be loaded or doesn't exist. Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)

dsyme commented 6 years ago

@vasily-kirichenko Could you write out the step-by-step to get to the point you mention above? The AppVeyor log is currently showing

[00:01:17]          C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file 'C:\projects\fsharp-configuration\src\FSharp.Configuration\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\projects\fsharp-configuration\src\FSharp.Configuration\FSharp.Configuration.fsproj]

which is the error mentioned in https://github.com/fsprojects/FSharp.Configuration/pull/133#issuecomment-339154895 which I don't really understand

vasily-kirichenko commented 6 years ago

I've merged master and https://github.com/fsprojects/FSharp.Configuration/pull/139