When working in a .NET core app with multiple target frameworks:
<PropertyGroup>
<TargetFrameworks>netstandard1.6;net40</TargetFrameworks>
</PropertyGroup>
dotnet restore -> dotnet build compiles successfully, but Ionide doesn't recognize any other files. It recognizes any types/modules/functions defined within the same file, but when opening a module in another file, I get "namespace or module Xyz is not defined".
If I then replace my target framework in the fsproj as follows:
<PropertyGroup>
<!--<TargetFrameworks>netstandard1.6;net40</TargetFrameworks>-->
<TargetFramework>netstandard1.6</TargetFramework>
</PropertyGroup>
delete my obj folder, dotnet restore -> dotnet build then all the intellisense starts working again.
Environment: Win10, Ionide 2.25.9, VS Code 1.11.2
related issues: #278
Cc: @enricosada
@Krzysztof-Cieslak problem is, fsc args are specific to a target framework.
ionide should ask fsac for a specific framework ihmo (ref https://github.com/ionide/ionide-vscode-fsharp/issues/278), that's really needed moving forward.
meanwhile dunno, i can try read that property, and use the first netstandard* or netcoreapp* if nothing is specified.
I think is a sensible default.
added https://github.com/fsharp/FsAutoComplete/issues/162 to track that
Oh yeah, I do realize that choosing target etc should be real fix for that. But I still don't know how to handle it well from UX point of view.
I think that choosing first target framework from the list should be sensible default and decent workaround for now
I'll do that, like linked issue.
But how the others extensions do something similar? Config file? Where is s good place for transitory config?
I'd say it's probably some config file, UX wise it could just be a command like ctrl/cmd+shift+P > Choose TargetFramework > (scan all fsproj for possible frameworks) present list to choose from > update config
support in FSAC will be implemented by https://github.com/fsharp/FsAutoComplete/pull/168
atm will be used the first, so if <TargetFrameworks>netcoreapp1.0;net461</TargetFrameworks> => netcoreapp1.0
Starting from that, FSAC will use the correct (same as Build target) framework for all project references.
I dont have found yet a satifying hipotetical way to specifiy my preference in vscode (settings, env var in tasks.json, etc), but FSAC is ready to accept the choice, if we want to improve the UX.
Two possible:
.fs file open is bad and cause bugswith workaround disabled (a setting? passed to FSAC in initialization?), a flow like:
Initial support for multi-targeting released in 2.27.5 - at the moment we just default to first target.
Most helpful comment
Initial support for multi-targeting released in
2.27.5- at the moment we just default to first target.