Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build F# .NET Standard project when referenced from C# .NET Core project #5640

Closed
cartermp opened this issue Sep 13, 2018 · 25 comments
Closed

Comments

@cartermp
Copy link
Contributor

cartermp commented Sep 13, 2018

Using VS 15.8.4:

  1. Create a new .NET Standard F# library
  2. Create a new .NET Core C# console app
  3. Add a reference from the console app to the library
  4. Build.

Two errors:

MSB4064 The "EmbeddedFiles" parameter is not supported by the "Fsc" task. Verify the parameter exists on the task, and it is a settable public instance property.

MSB4063 The "Fsc" task could not be initialized with its input parameters.

image

@cartermp cartermp changed the title Cannot build F# .NET Standard project when references from C# .NET Core project Cannot build F# .NET Standard project when referenced from C# .NET Core project Sep 13, 2018
@cartermp
Copy link
Contributor Author

cc @KevinRansom

@cartermp
Copy link
Contributor Author

Is this related to #4075?

@cartermp cartermp added Area-Compiler Area-SetupAndDelivery Setup, packages, templates, SDK, delivery channels labels Sep 13, 2018
@KevinRansom
Copy link
Member

@phillip, I tried this on my work machine it works fine; ans also I tried it on a clean VM and it works fine.

I think you may have environmental issues.

@cartermp
Copy link
Contributor Author

Yep, this seems like it was environmental. I had a bunch of SDKs on my machine, multiple previews, and other various weird things with my VS install that may have resulted in the wrong SDK being picked up. With a fresh install, it's all golden.

@irium
Copy link

irium commented Sep 19, 2018

I see the same error, but without any C# projects involved. Indeed, at stock Visual F# compilation is ok (version 15.8.20180810.4). But using any later nightly build I see this error:

c:\users\...\appdata\local\microsoft\visualstudio\15.0_7d18b74a\extensions\ld3hzrff.geh\Microsoft.FSharp.Targets(280,15): error MSB4064: The "EmbeddedFiles" parameter is not supported by the "Fsc" task. Verify the parameter exists on the task, and it is a settable public instance property.

c:\users\...\appdata\local\microsoft\visualstudio\15.0_7d18b74a\extensions\ld3hzrff.geh\Microsoft.FSharp.Targets(269,9): error MSB4063: The "Fsc" task could not be initialized with its input parameters.

Here appdata\local\microsoft\visualstudio\15.0_7d18b74a\extensions\ld3hzrff.geh\ is pointing to installation path of latest Visual F# Nightly 15.8.20180919.1.

But there is no error when compiling in console.

C:\src>dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.402
 Commit:    3599f217f4

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.402\

Host (useful for support):
  Version: 2.1.4
  Commit:  85255dde3e

.NET Core SDKs installed:
  2.1.402 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

The Microsoft.FSharp.Targets files in c:\Program Files\dotnet\sdk\2.1.402\FSharp\Microsoft.FSharp.Targets and c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\FSharp\Microsoft.FSharp.Targets (stock Visual F#) are same. But in nightly VF# it differs.

@irium
Copy link

irium commented Sep 23, 2018

@cartermp Upping the issue. Maybe open new issue for my problem?

@KevinRansom
Copy link
Member

So …

this is is the cause: https://github.com/Microsoft/visualfsharp/blame/89275d2ce1ec3953d737017a8be087c2579259f3/src/fsharp/FSharp.Build/Fsc.fs#L295

The buildtask property for Embedded Source files was renamed from Embed to EmbeddedFiles. The corresponding Microsoft.NetSdk.targets and Microsoft.FSharp.Targets file were updated at the same time. The error would seem to indicate that a mismatched set of targets and buildtask are in use.

Could you please set the build verbosity to diagnostic, and build the project within VS, and copy and paste the results to a text file and attach the file to this issue, and I can see if I can figure out why.

Thanks

Kevin

@cartermp cartermp reopened this Sep 24, 2018
@irium
Copy link

irium commented Sep 24, 2018

build.zip

@cartermp That's a very big file.

@KevinRansom
Copy link
Member

@irium yes it is.

@irium
Copy link

irium commented Sep 24, 2018

Hmm, now after updating Visual studio to 15.8.5 and installing latest nightly the behavior is strange:
after full clean the build (Rebuild solution) is failing with the errors as above. But if build again after this (not rebuild, just regular Ctrl+Shift+B) then the build succeeds.

@KevinRansom
Copy link
Member

There isn't really much that we can do about this. It seems to occur because msbuild processes are cached, and shared between instances of visual studio. Which seems a bit wierd to me ...

In order to repro this I had to:

  1. Install RTM VS 2017.8.5
  2. Install a VS2017 preview
  3. Add the F# nightly to the VS2017.8.5 RTM
  4. Open the VS2017 preview, build an F# project
  5. Open the VS2017.8.5 RTM
  6. Open and try to build the F# project

This wierdness gave me a reliable repro.
The fix was to type the following command in an administrator command window:
taskkill /f /im msbuild.exe

An explanation,
It seems that VS reuses the msbuild instance even between differing versions of Visual Studio. Personally, I think this is a fairly dubious idea. Anyway doing a taskkill on msbuild.exe seems to fix everything.

I hope this helps,

Kevin

@matthid
Copy link
Contributor

matthid commented Sep 24, 2018

One has to love the MSBuild node reuse feature. :)

@irium
Copy link

irium commented Sep 24, 2018

@KevinRansom Hmm, I have no VS2017 Preview installed. All my mentioned builds was executed in the same VS2017 Pro instance.

@0x53A
Copy link
Contributor

0x53A commented Sep 25, 2018

Can you try to set the environment variable MSBUILDDISABLENODEREUSE to 1?

Then reboot, to make sure it is actually applied.

This will globally disable the node reuse feature.

If you want, you can delete the env var again afterwards, but I always set it first thing after installing VS, got burnt too often ...

@KevinRansom
Copy link
Member

@0x53A, it seems as if this actually a bug in the project system. That causes the design time build to not use the compiler from the nightly. When we do a regular build, the wrong build task is already loaded.

Trying to track it down right now.

Kevin

@KevinRansom
Copy link
Member

@irium
Copy link

irium commented Sep 27, 2018

I confirm that killing running MSBuild.exe instances helps with the issue.

@cartermp cartermp removed Area-Compiler Area-SetupAndDelivery Setup, packages, templates, SDK, delivery channels labels Sep 28, 2018
@cartermp
Copy link
Contributor Author

Closing as an underlying root bug is being fixed in 15.8.6, and the F# component to this is solved with #5700. When 15.8.6 is released, the F# nightly feed should have the full fix.

@cartermp cartermp modified the milestones: 16.0, 15.8 Nov 19, 2018
@chadunit
Copy link

I am getting the two errors in the OP intermittently with VS 15.9.4 and F# nightly 15.8.20181217.1.

The comments above suggest it should be fixed in 15.8.6 and the nightlies, is that no longer the case?

I made sure also to delete the .vs folder as mentioned in the link above but the issue still reoccurs.

The errors get cleared by killing msbuild.exe but eventually reoccur.

Is there more to come regarding a fix in 16.0 or is there potentially another issue?

@majocha
Copy link
Contributor

majocha commented Dec 21, 2018

Yes, I'm seeing this from time to time, too. Repro:
new project, netstandard class library in recent nightly, VS2017
image
image
F6 to build, build failed. Updating FSharp.Core nuget resolves the issue.

@cartermp
Copy link
Contributor Author

@chadunit @majocha Do you see this without nightlies installed?

@majocha
Copy link
Contributor

majocha commented Dec 22, 2018

@cartermp tested now and couldn't reproduce with nightly uninstalled. However I reinstalled nightly and can't repro at all, so it's kind of random.

@chadunit
Copy link

With the nightly installed, I can generally repro a transient/recoverable occurrence of the error by adding a nuget reference to Microsoft.EntityFrameworkCore to a F# .NET Core class library. After producing the error upon package install, it still builds successfully and then clears the error. (I've also experienced a persistent version of the error where the build fails until doing the msbuild kill but don't know how to repro that on demand.)

With nightly uninstalled, I cannot repro the above recoverable error. I will run without nightly for a while to see if it occurs at all.

@majocha
Copy link
Contributor

majocha commented Dec 22, 2018

Another PC, nightly 1217.1:
new netstandard project, everything is fine. After updating FSharp.Core nuget from 4.5.2 to 4.5.4 the two errors show up on the list immediately. Project builds fine and errors disappear after build.

@chadunit
Copy link

No repro since uninstalling nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants