.NET 7 RC1 dotnet build fails without errors on MAC M1
Description
I was switching from .NET 7 Preview 7 to .NET 7 RC1 yesterday. Everything runs ok, but after some builds and runs, dotnet stops building my project.
╰─ dotnet build ─╯
MSBuild version 17.4.0-preview-22428-01+14c24b2d3 for .NET
Build FAILED.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.00
It's the second time this happens. I need to restart the machine to get it working again. Deleting obj and/or bin folder does not help.
Configuration
MSBuild version 17.4.0-preview-22428-01+14c24b2d3 for .NET Tye version 0.11.0-alpha.22111.1+3edef5428949c518c078844d6438e5ba86fce600
.NET SDK: Version: 7.0.100-rc.1.22431.12 Commit: f1cf61e1c0
Runtime Environment: OS Name: Mac OS X OS Version: 12.6 OS Platform: Darwin RID: osx.12-arm64 Base Path: /usr/local/share/dotnet/sdk/7.0.100-rc.1.22431.12/
Host: Version: 7.0.0-rc.1.22426.10 Architecture: arm64 Commit: 06aceb7015
.NET SDKs installed: 6.0.400 [/usr/local/share/dotnet/sdk] 7.0.100-preview.7.22377.5 [/usr/local/share/dotnet/sdk] 7.0.100-rc.1.22431.12 [/usr/local/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0-preview.7.22376.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0-rc.1.22427.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0-preview.7.22375.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0-rc.1.22426.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found: None
Environment variables: Not set
global.json file: Not found
Information
When this happens, vs code is not finding any references. Everything is signaled as red and unknown in vs code.
This is also happening on 4.2 GHz Quad-Core Intel Core i7 iMAC.
Can you please let us know how I can remove the .Net 7 version ? the dotnet-core-uninstall does not work and VS preivew automtically installed this version
I'm having the same issue, passing --disable-build-servers to dotnet build seems to get it to build again.
Thanks! -- for now I just ran :
dotnet new globaljson
and then changd the globaljson of my project to
{ "sdk": { "version": "6.0.401" } }
Good to know you have the option you provided as well!
We're experiencing w/Intel CPUs like @wickedw. May be helpful to correct the title.
Is there an env var for disabling build servers? Would be helpful for cross compile.
@rainersigwald is this related to msbuild?
Very plausibly. dotnet/sdk#28369 disables MSBuild Server for GA. Please try setting the environment variable DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER=1--if that resolves the issue the GA change will also take care of it.
cc @rokonec
Reproed consistently for me in Ubuntu. After setting the env variable and building once, it seems like things are working again, even after unsetting the environment variable. This might involve some sort of state corruption.
@agocke Can you please share with me repro steps? I would like to verify that it is known bug to us.
I downloaded the rc-1 tar.gz, extracted it to a local directory (over my preview 5 copy), then simply went to a directory and did dotnet build. Every invocation of MSBuild failed in the same way. I tried deleting a bunch of files -- I even wiped the files I extracted and re-extracted them. That didn't help.
Interestingly enough, if I extracted the files to a different directory, and tried again, that worked.
After I found this thread, I then set the environment variable and rebuilt and the problem went away immediately. I then removed the environment variable and tried building again. That also worked.
There must be some sort of cached information that causes this issue.
And just to confirm, did you download the Arm64 version since you mentioned you're on Mac M1?
I use the DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER=1 and it works, then I removed the env it failed again. The env is mandatory for a successful build. I'm on archlinux x64.
@sep2 Great. That workaround will no longer be required with the final 7.0.100 SDK (but is still needed for RC2). Sorry for the inconvenience!
Yup I downloaded arm64
Just an FYI— I've been working with .NET Core since its 1.0 days and haven't encountered this issue until now. However, with .NET 8 RC2, the problem surfaced for the first time. Fortunately, setting the DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER environment variable did the trick and resolved the issue.
@rokonec is @Ibro's experience expected? I thought server was off by default still.
I'm uncertain whether the DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER environment variable is still relevant to my issue. It seemed to resolve the issue temporarily, but the fix has been hit-or-miss lately.
@Ibro This is highly unexpected, env var DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER has been deprecated in net8 see https://github.com/dotnet/sdk/blob/62aa4b7c6c2f6fcf673ec2d9aacc8ca07f51913b/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs#L19 and is no longer in our codebase at all.
Please verify that given build is configured for net8 rc2 and if so please provide us with aka.ms/binlog
I have tested it on net8 rc2 Windows and msbuild server is still off by default - as designed.
Seems to be fine with .NET 8.