Closed zaaack closed 6 years ago
Update: I replaced the whole fsproj file with fsharp templates' form, and find out I cannot change the target to netstandard2.0 since it used some missing API's in dotnet core. But if I change target to net45, then I got an error:
Status: failed to load
Error:
MSBuild failed with exitCode 1 Working Directory: '/Users/z/Projects/Fable/FSharp.Data.GraphQL/src/FSharp.Data.GraphQL.Client' Exe Path: 'dotnet' Args: 'msbuild /Users/z/Projects/Fable/FSharp.Data.GraphQL/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj /p:SkipCompilerExecution=true /p:ProvideCommandLineArgs=true /p:CopyBuildOutputToOutputDirectory=false /p:UseCommonOutputDirectory=true /t:_Inspect_FscArgs /p:_Inspect_FscArgs_OutFile=/var/folders/vs/zmlqkcln7rx46sb2ygjvl7h40000gn/T/tmp5b13bf85.tmp.FscArgs.txt /p:DesignTimeBuild=true /t:_Inspect_GetResolvedProjectReferences /p:_Inspect_GetResolvedProjectReferences_OutFile=/var/folders/vs/zmlqkcln7rx46sb2ygjvl7h40000gn/T/tmp1834ea5a.tmp.GetResolvedProjectReferences.txt /t:_Inspect_GetProperties /p:_Inspect_GetProperties_OutFile=/var/folders/vs/zmlqkcln7rx46sb2ygjvl7h40000gn/T/tmp1834ea5a.tmp.GetProperties.txt /p:TargetFramework=net46 /nologo /verbosity:quiet' Log: writing helper target file in '/Users/z/Projects/Fable/FSharp.Data.GraphQL/src/FSharp.Data.GraphQL.Client/obj/FSharp.Data.GraphQL.Client.fsproj.proj-info.targets' /usr/local/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file '/Users/z/Projects/Fable/FSharp.Data.GraphQL/src/FSharp.Data.GraphQL.Client/obj/project.assets.json' doesn't have a target for '.NETFramework,Version=v4.6'. Ensure that restore has run and that you have included 'net46' in the TargetFrameworks for your project. [/Users/z/Projects/Fable/FSharp.Data.GraphQL/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj]
But building with msbuild is ok, just the editor's intellisense failed.
CC: @enricosada
I believe the same issue can be seen reproduced with the Swagger Provider:
code .
SwaggerProvider.TestsAndDocs.sln
as the workspace or solutionSwaggerProvider.ProviderTests.fsproj
project:Status: failed to load
Error:
Failed parsing project file: /Users/chet/code/oss/SwaggerProvider/tests/SwaggerProvider.ProviderTests/SwaggerProvider.ProviderTests.fsproj: Microsoft.Build.Exceptions.InvalidProjectFileException: /Users/chet/code/oss/SwaggerProvider/tests/SwaggerProvider.ProviderTests/SwaggerProvider.ProviderTests.fsproj: Object reference not set to an instance of an object at Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectCrackerTool+FSharpProjectFileInfo..ctor (System.String fsprojFileName, Microsoft.FSharp.Core.FSharpOption`1[T] properties, Microsoft.FSharp.Core.FSharpOption`1[T] enableLogging) [0x00129] in <599f46db06d737baa7450383db469f59>:0 at Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectCrackerTool.getOptions@387 (System.Boolean enableLogging, Microsoft.FSharp.Collections.FSharpList`1[T] properties, System.String file) [0x0000f] in <599f46db06d737baa7450383db469f59>:0 at Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectCrackerTool.getOptions (System.String file, System.Boolean enableLogging, Microsoft.FSharp.Collections.FSharpList`1[T] properties) [0x00005] in <599f46db06d737baa7450383db469f59>:0 at Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectCrackerTool.crackOpen (System.String[] argv) [0x000cc] in <599f46db06d737baa7450383db469f59>:0
This trace looks pretty similar to the one above.
You need to do dotnet restore
probably
Log of error
project.assets.json' doesn't have a target for '.NETFramework,Version=v4.6'. Ensure that restore has run and that you have included 'net46' in the TargetFrameworks f
It's a mono project and cannot be restored by dotnet cli. Actually I restored by msbuild /t:restore
It's the same, dotnet restore
-> dotnet msbuild /t:Restore
.
so is a project cracker issue
I'm not sure, the msbuild command I'm using is from mono, not sure dotnet cli's msbuild would have same effects, this project cannot be built if target to netstandard2... but if I setting target to netstandard2, the editor works, except messages as same as the build error.
@zaaack i added https://github.com/fsprojects/FSharp.Data.GraphQL/issues/131#issuecomment-333806061 about this.
Atm i cannot build the repo, so cannot check. If you want to move to new sdk, good, less work (i can also help about that). Otherwise what's a commit sha i can try with the initial error? because is related to old fsproj
@enricosada Thanks for your time of investigation! Upgrade the client project to dotnet core actually isn't an option, the client project contains type provider which currently doesn't support dotnet core (including 2.0), there is a trick to using mono fsharpc and type provider in a dotnet core project (IMO it means the type provider project cannot be built by dotnet core)(https://github.com/Microsoft/visualfsharp/issues/3303 https://github.com/fsprojects/FSharp.Data.GraphQL/pull/103), but I never got this trick work in fable..
I was hoping ionide to support project with old fashion .fsproj, but as you explained in another issue it seems is almost impossible, so this won't be an option, too.
Anyway, I am already given up FSharp.Data.GraphQL.Client in Fable
approach for now , and considering creating a new GraphQL query DSL by using graphql.js to generate fsharp source code directly or just seating here and waiting dotnet core supports type provider and starting using Fable's fantastic JSON serialization (which looks more realistic for my current case). So, feel free to close this issue.
Thanks again, for all of you!
@zaaack want to discuss in slack about options?
if you want to maintain old fsproj, np. but i need a valid commit sha to repro it locally, so i can check it. atm dev
branch is mixed.
NOTE using new sdk <> use .net core.
you can target net461 only, or both.
and if your type provider is erasing and cross targeting, can work on .net core too.
It just need to run mono msbuild OR use fsharpc
for .net full and .net core msbuild
@enricosada I think I get what you mean. But actually I'm not the maintainer of FSharp.Data.GraphQL and I'm not sure what's the best way to make the client project working in ionide.
At the beginning I'm just trying to make GraphQLTypeProvider working in Fable, so I looked into the GraphQLTypeProvider, the TP is working in editor (and built with dotnet core), but then turns out I cannot make TP work in Fable. I don't know much details of this project, maybe you can talk to @TOTBWF?
But IMO, targeting a new sdk is always a better choice, it makes life easier 😃 .
Atm i cannot build the repo, so cannot check
I can build this repo in macOS with clean ./built.sh
at the last commit, with manually cp paket.bootstrap.exe to paket.exe, and run paket install
? I think I might tried many commands and can't remember, but it built successfully finaly.
Only the editor cannot working. Not sure about other platform.
@zaaack my issue is in windows atm, build.cmd Build
fails.
i created https://github.com/fsprojects/FSharp.Data.GraphQL/pull/137 to check it build on appveyor and windows.
The badge on the readme say green, but the branch dev
didnt build with appveyor in 11 months ( https://ci.appveyor.com/project/bazingatechnologies/fsharp-data-graphql-ydavv/history )
and seems disabled ( https://github.com/fsprojects/FSharp.Data.GraphQL/issues/131#issuecomment-333855235 )
sry @zaaack i was thinking you where the maintainer of that project. i asked @Horusiath @TOTBWF too
I also have been experiencing this problem (it seems). I'm already using the new sdk, but targeting net461.
When I open https://github.com/fsprojects/FSharp.Data.GraphQL by ionide-vscode-fsharp, it failed loading many projects, e.g. client project, test projects. But building is success.
Here is the client project log after I add the missing targets property(`