Closed susloparovdenis closed 7 years ago
OK. I can confirm. This seems to be happen for me (and a few others based on some Slack comments). It looks like the code for detecting the presence of F# is reporting false negatives in some case.
@pblasucci I'll fix this now (was about to make the changes to remove SourceLink)
@susloparovdenis @pblasucci I can't repro this. Which prompt are you running from - a VS2017 developer prompt or...
Could you try again now https://github.com/fsprojects/ProjectScaffold/pull/296 has been merged? thanks
@dsyme just tried again... same results. I'm using a bog standard instance of cmd.exe
.
OK. I found a clue. It's looking in:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v\FSharp\Microsoft.FSharp.Targets
Notice the \v\
? That should probably be \v15.0\
(or at least some number after the v
). Not sure how to fix this (yet). I mean, what would cause the CheckFSharpInstallation.fsproj
to have an empty value for $(VisualStudioVersion)
?
Yes, VisualStudioVersion is not set, I have no idea why. I thought it was always set.
Can you try ToolsVersion="15.0"
at the top of the project files? Just wondering.
@pblasucci Note that using a VS2017 developer command prompt will work. But we should make it work from cmd.exe as well
Changing the tools version did not alter the behavior. And, just to confirm, the VS2017 developer command prompt does work. This is due to the dev prompt is putting the Visual Studio version into an environment variable (which is absent in the vanilla prompt). Also, as an aside, even though the dev prompt works correctly, it emits a (spurious) warning about F# Tools not being installed... but one issue at a time. :-)
Do you know which MSBUILD is being run? When I use
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe
it works but when I use the very old
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
it doesn't. I assume FAKE is in charge of choosing the right MSBuild, but I thought that FAKE 4.61.3 had an appropriate fix to always find the right version in all circumstances
Seems it's using
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
Seems it's using
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
Does it work when you invoke that MSBUILD.EXE directly?
BTW here's a relevant FAKE issue: https://github.com/fsharp/FAKE/issues/1442. And here's the list of search paths it uses to find MSBuild.exe: https://github.com/fsharp/FAKE/blob/master/src/app/FakeLib/MSBuildHelper.fs#L25
No luck. Invoking MSBuild.exe
directly causes the same result.
How about if you add
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
to CheckFSharpInstallation.fsproj at the top of the file
OK, adding the Microsoft.Common.Props entry fixes this for me
(I can repro this now. I was not focusing on CheckFSharpInstallation.fsproj - I was building the generated project (which has the Microsoft.Common.props entry))
Ding! Ding! Ding! We have a winner! Adding that sorted it.
However, I still get the following (spurious) warning:
C:\Program Files\Git\cmd\git.exe remote -v
System.Exception: Build script aborted: please install F# and try again.
at <StartupCode$FSI_0005>.$FSI_0005_Init$fsx.main@() in C:\Projects\ProjectScaffold\init.fsx:line 36
Stopped due to error
However, everything does build and run correctly..
Print the exception being caught here:
let checkFSharpInstallation () =
try
MSBuildRelease "." "CheckFSharpInstallation" ["CheckFSharpInstallation.fsproj"] |> ignore
true
with e ->
false
Make sure you're starting from clean each time, i.e.
git reset --hard master
git clean -xfd .
I'd been starting clean each time. But printing the caught error seems to have fixed everything. No idea why/how, though
O_o
Anyway, at least we have the fixes... now someone just needs to prepare PR.
@pblasucci Could you verify? There is no printing of the caught error in that PR (did you actually get an error printed?)
Yup. Everything looks peachy now! 👍
There's no error being displayed now.
I have windows10 and vs2017 with all the updates.
CheckFSharpInstallation.fsproj(19,5): error : File Microsoft.FSharp.Targets not found. Is F# correctly installed on this system?
I have Microsoft.FSharp.Targets in following locations. I am confused![image](https://user-images.githubusercontent.com/5947908/26974609-658ada7e-4d1c-11e7-9542-67785e2d2bac.png)
full output: