1

I'm trying to build 2 F# projects in one solution using MSBuild on 2 different computers.

  • Computer 1 has VS2015 installed without any reinstalls or repairs.
  • On computer 2, VS2015 got mental after a Xamarin install went bad. VS2015 has been repaired (didn't help), then uninstalled leaving 4.5GB of residual junk, then again uninstalled by MS VisualStudioUninstaller to get rid of the residues, and finally reinstalled.

This is what happens when I build:

  • Computer 1: MSBuild works.

  • Computer 2: MSBuild fails with the The target "Build" does not exist in the project error for one project and The value "" of the "Project" attribute in element <Import> is invalid. Parameter "path" cannot have zero length for the other. Before the Xamarin misadventure, computer 2 built the solution without problems.

  • Building with Visual Studio works on both computers.

The problem with computer 2 might be solved by nuking the Windows install and reinstalling everything from scratch, but any solution that's less brutal would be welcome.

This question sounds a bit like the existing FSharp build fails in MSBuild, but works ok in Visual Studio question, but the .fsproj file in question already uses TargetFSharpCoreVersion in the way the accepted answer prescribes.

Community
  • 1
  • 1
John Reynolds
  • 4,927
  • 4
  • 34
  • 42
  • Have you lokked at this: http://stackoverflow.com/questions/2035414/target-build-does-not-exist-in-the-project-for-visual-studio ? If you add this to your .fsproj file with the correct location: ? Maybe check if the $(MSBuildBinPath) is pointing to the correct place? – Svein Terje Gaup Oct 31 '16 at 11:32
  • 2
    The VS2015 installers behave very poorly on a dirty machine. Even on a clean one (well I thought mine was squeaky clean), the slightest mishap creates havoc. Two and a half days of my life I'll never get back, just because of one missing file, it wasn't smart enough to put it back. The next version is going to do it very differently, fingers crossed. Even if you fix this problem you'd still haven't found the original problem. Nuke from orbit, only way to be sure. – Hans Passant Oct 31 '16 at 12:43
  • @SveinTerjeGaup That's the C# version of the F# answer I already linked to in the question. – John Reynolds Oct 31 '16 at 13:48
  • @HansPassant: That's why I hate non-portable apps. Looking forward to reinstalling every app, re-applying all options in all of them etc. But after one last try to manually remove all traces of VS2015, my chances seem slim, given your experiences with this. – John Reynolds Oct 31 '16 at 13:53
  • I fired up a completely clean virtual machine, installed VS2015 Update 3 in it and tried MSBuild. Same errors as in 'computer 2' above. Weird, and implies nuking wouldn't help. Maybe something is different when you install VS2015 Update 3 from scratch, compared to installing VS2015 and separately climbing the update ladder. – John Reynolds Oct 31 '16 at 23:47
  • According to description, I create a F# solution with two projects by using visual studio 2015 update2, then open the solution with another machine, which has visual studio 2015 update3. It works fine. Could you please provide a simple demo with the issue via OneDrive? In addition, please create a simple F# with 2 project on computer 2 and check if it works. If it works, please compare the content of .fsproj file and check if it different. – starian chen-MSFT Nov 01 '16 at 06:50
  • @starain: The project in question is [Mpir.NET](https://github.com/wezeku/Mpir.NET). Found a more specific difference between the computers: On PC 1, I can Mpir.NET from a plain-vanilla command prompt. On PC 2, all F# projects that I got from GitHub build from plain-vanilla prompt, except Mpir.NET which requires either "Developer Command Prompt for VS2015" or "MSBuild Command Prompt for VS2015". So, probably an environment variable that got set in the PC 1 but not in PC 2, and that only matters for the FAKE (F# Make) script used in Mpir.NET. I should've tried MSBuild Cmd Prompt first of all. – John Reynolds Nov 01 '16 at 15:22
  • Ok, found the environment variable setting: `VisualStudioVersion=14.0`. Setting this, will enable me to build from plain-vanilla prompt, although the only reason that I didn't build from MSBuild prompt was that I forgot about it, because I never needed it before. Still a bit of a mystery though, that PC 1 doesn't have `VisualStudioVersion` set, but it works there anyway. Not worth the time to find out why. – John Reynolds Nov 01 '16 at 15:43
  • So, you solved the issue? You can post an answer and mark it after 24 hours. – starian chen-MSFT Nov 02 '16 at 01:05

1 Answers1

1

It seems that just about every GitHub F# project using FAKE (F# Make) can be built from a plain-vanilla command prompt, but so far I've found one exception: my own Mpir.NET. This has to be built using either Developer Command Prompt for Visual Studio or MSBuild Command Prompt for Visual Studio.

The developer prompts set a number of environment variables. In this specific case, it was the VisualStudioVersion variable that made the difference on computer 2 in the question. Oddly, computer 1 didn't have that variable set either, but it worked anyway. Finding out exactly why, isn't worth the trouble. Just use the MSBuild command prompt.

John Reynolds
  • 4,927
  • 4
  • 34
  • 42