It seems to be finding a previous msbuild. Solution seems standard f# ref. Same on 2 PCs.
[22:18:50 DEBUG] MSBuild found at C:\Program Files (x86)\\MSBuild\14.0\Bin\MSBuild.exe
[22:18:50 DEBUG] MSBuild activated
/C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28 Ctrl+Alt+ keybindings should not be used by default under Windows. Offender: e for MSBuild.buildCurrent
e._assertNoCtrlAlt @ /C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28
extensionHost.ts:285 [Extension Host] Mapping language fsharp to initial scope source.fsharp
extensionHost.ts:285 [Extension Host] Found grammar for source.fsharp at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\fsharp\syntaxes\fsharp.json
extensionHost.ts:285 [Extension Host] [IONIDE-FSAC] REQ (001) -> {project}, File = "~\Asset.Common\2.Asset.Common.fsproj"
Data=Object
extensionHost.ts:285 [Extension Host] [msbuild] MSBuild found at C:\Program Files (x86)\\MSBuild\14.0\Bin\MSBuild.exe
extensionHost.ts:285 [Extension Host] [msbuild] MSBuild activated
extensionHost.ts:285 [Extension Host] [IONIDE-FSAC] RES (001) <- {project} in 306 ms: Kind={"error"}
Data=The system cannot find the file specified
extensionHost.ts:285 [Extension Host] [IONIDE-FSAC] REQ (002) -> {parse}, File = "~\Asset.Common\Prelude.fs"
Data=ObjectFileName: "c:\Users\Ant\src\asset\Asset.Common\Prelude.fs"IsAsync: trueLines: Array[86]Version: 1__proto__: Object
extensionHost.ts:285 [Extension Host] [IONIDE-FSAC] RES (002) <- {parse} in 3156 ms: Kind={"errors"}
Data=ObjectErrors: Array[1]File: "c:\Users\Ant\src\asset\Asset.Common\Prelude.fs"__proto__: Object
extensionHost.ts:285 [Extension Host] [IONIDE-FSAC] REQ (003) -> {lint}, File = "~\Asset.Common\Prelude.fs"
Data=Object
extensionHost.ts:285 [Extension Host] [IONIDE-FSAC] REQ (004) -> {project}, File = "~\Asset.Analytics\3.Asset.Analytics.fsproj"
Data=Object
extensionHost.ts:285 [Extension Host] [IONIDE-FSAC] RES (004) <- {project} in 8 ms: Kind={"error"}
Added the following location hints. Tried a new test solution with just a single test line added. Its still gives the same error. Not sure what else to try.
"FSharp.msbuildLocation": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin",
"FSharp.toolsDirPath": "C:\\Program Files (x86)\\Microsoft SDKs\\F#\\4.1\\Framework\\v4.0",
[13:51:43 DEBUG] MSBuild found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
[13:51:43 DEBUG] MSBuild activated
[13:51:43 INFO ] REQ (001) -> {project}, File = "~\Library1\Library1.fsproj"
Data={"FileName":"c:\\users\\ant\\documents\\visual studio 2017\\Projects\\Library1\\Library1\\Library1.fsproj"}
[13:51:44 DEBUG] RES (001) <- {project} in 345 ms: Kind={"error"}
Data="The system cannot find the file specified"
[13:51:44 INFO ] REQ (002) -> {parse}, File = "~\Library1\Library1.fs"
Data={"FileName":"c:\\users\\ant\\documents\\visual studio 2017\\Projects\\Library1\\Library1\\Library1.fs","IsAsync":true,"Lines":["namespace Library1\r","\r","type Class1() = \r"," member this.X =\r"," let z = Option.defaultWith (fun () -> 1) None\r"," \"F#\"\r",""],"Version":1}
[13:51:46 DEBUG] RES (002) <- {parse} in 2782 ms: Kind={"errors"}
Data={"File":"c:\\users\\ant\\documents\\visual studio 2017\\Projects\\Library1\\Library1\\Library1.fs","Errors":[{"FileName":"c:\\users\\ant\\documents\\visual studio 2017\\Projects\\Library1\\Library1\\Library1.fs","StartLine":5,"EndLine":5,"StartColumn":24,"EndColumn":35,"Severity":"Error","Message":"The value, constructor, namespace or type 'defaultWith' is not defined.","Subcategory":"typecheck"}]}
[13:51:46 INFO ] REQ (003) -> {parseProjects}, File = "~\Library1\Library1.fs"
Data={"FileName":"c:\\users\\ant\\documents\\visual studio 2017\\Projects\\Library1\\Library1\\Library1.fs"}
[13:51:46 DEBUG] RES (003) <- {parseProjects} in 113 ms: Kind={"errors"}
Data={"File":"c:\\users\\ant\\documents\\visual studio 2017\\Projects\\Library1\\Library1\\Library1.fs","Errors":[{"FileName":"c:\\users\\ant\\documents\\visual studio 2017\\Projects\\Library1\\Library1\\Library1.fs","StartLine":5,"EndLine":5,"StartColumn":24,"EndColumn":35,"Severity":"Error","Message":"The value, constructor, namespace or type 'defaultWith' is not defined.","Subcategory":"typecheck"},{"FileName":"c:\\users\\ant\\documents\\visual studio 2017\\Projects\\Library1\\Library1\\Library1.fs","StartLine":5,"EndLine":5,"StartColumn":24,"EndColumn":35,"Severity":"Error","Message":"The value, constructor, namespace or type 'defaultWith' is not defined.","Subcategory":"typecheck"}]}
I am having the same problem when trying to run fsx scripts using 4.1 features, but building with FAKE finds the correct version of MSBuild.
I think this section:
Needs to include some of the extra paths FAKE is using
However, I'm not sure if this will apply to running with FSI, I tried setting `FSharp.msbuildLocation to the vs 2017 msbuild and it didn't fix my problem.
Is this because FsAutoComplete is compiled with F# 4.0? Looks to be pinned to FSharp.Compiler.Service 11.0.9.
@Krzysztof-Cieslak @forki Any idea of if its possible to bump this or if there are issues?
I don't think it's problem with FSAC being compiled against F# 4.0, that shouldn't be any problem.
Also, the printed out path for MsBuild is used only for MsBuild: ... commands, it's not used for project cracking.
Can you post example fsproj file?
This is just a new project created in VS. Many thanks
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>b08e1d83-cb64-434d-8726-c29f652a1ae9</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Library1</RootNamespace>
<AssemblyName>Library1</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFSharpCoreVersion>4.4.1.0</TargetFSharpCoreVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Name>Library1</Name>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OutputPath>bin\$(Configuration)\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Tailcalls>true</Tailcalls>
<OutputPath>bin\$(Configuration)\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '11.0'">
<PropertyGroup Condition=" '$(FSharpTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets') ">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Condition=" '$(FSharpTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets') ">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</Otherwise>
</Choose>
<Import Project="$(FSharpTargetsPath)" />
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="Library1.fs" />
<None Include="Script.fsx" />
<Content Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="FSharp.Core">
<Name>FSharp.Core</Name>
<AssemblyName>FSharp.Core.dll</AssemblyName>
<HintPath>$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\$(TargetFSharpCoreVersion)\FSharp.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.ValueTuple">
<HintPath>..\..\..\..\..\..\..\Users\Ant\documents\visual studio 2017\Projects\Library1\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\$(TargetFSharpCoreVersion)\FSharp.Core.dll file exists?<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>b08e1d83-cb64-434d-8726-c29f652a1ae9</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Library1</RootNamespace>
<AssemblyName>Library1</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFSharpCoreVersion>4.4.1.0</TargetFSharpCoreVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Name>Library1</Name>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OutputPath>bin\$(Configuration)\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Tailcalls>true</Tailcalls>
<OutputPath>bin\$(Configuration)\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '11.0'">
<PropertyGroup Condition=" '$(FSharpTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets') ">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Condition=" '$(FSharpTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets') ">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</Otherwise>
</Choose>
<Import Project="$(FSharpTargetsPath)" />
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="Library1.fs" />
<None Include="Script.fsx" />
<Content Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\packages\FSharp.Core.4.1.17\lib\net45\FSharp.Core.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.ValueTuple">
<HintPath>..\..\..\..\..\..\..\Users\Ant\documents\visual studio 2017\Projects\Library1\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
You can build f#4.1 projects just fine with MSBuild 14, so I don't think the version of MSBuild is the issue.
You could run FSharp.Compiler.Service.ProjectCrackerTool.exe --text "Proj.fsproj" true and see what it says.
(it's located in %USERPROFILE%\.vscode\extensions\Ionide.ionide-fsharp-2.26.1\bin)
My problem is that I get a squiggly line when using f#4.1 features in .fsx-files only. In .fs-files and vscode's fsharp-interactive it works perfectly. It also builds fine with my fake-script.
Interesting, I get: "Process is terminated due to StackOverflowException."
There is an open StackOverflowException issue in ProjectCracker from a while ago. It has some commits Apr 29 which may have been released already. fsharp/FSharp.Compiler.Service#714 PR and Issue seem to be wrong way round?
Do you have MsBuild 2015 installed? And other requirements?
MsBuild 2015 was missing and corrects when installed. Many Thanks.
Most helpful comment
MsBuild 2015 was missing and corrects when installed. Many Thanks.