msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

I'm trying to build a Xamarin iOS project on a new computer with a fresh install of Visual Studio for Mac and MSBuild is treating warnings as errors, even though the setting to treat them as errors is turned off.

Open jtorvald opened this issue 2 years ago • 7 comments

I'm trying to build a Xamarin iOS project on a new computer with a fresh install of Visual Studio for Mac and MSBuild is treating warnings as errors, even though the setting to treat them as errors is turned off. Also I tried properties like: TreatWarningsAsErrors and WarningsNotAsErrors but they don't have any effect. When I move WarningLevel from 4 to 0 I'm able to build again.

~~The same code works on my older MacBook with the same msbuild version without problems. It shows warnings as warnings and not as errors.~~

Apparently the build also stopped working on my other computer, probably after the latest version update: Warning CS0618 for obsolete class members gets treated as an error.

Is there some global setting somewhere outside of the project? Either in the solution or global settings that turns warnings into errors?

Microsoft (R) Build Engine version 16.10.1 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

Originally posted by @jtorvald in https://github.com/dotnet/msbuild/discussions/7614

jtorvald avatar May 11 '22 11:05 jtorvald

Can you share a binary log of the failing build? Please note the warnings in that document about what is shared in the log. If you'd like to share it more privately, please open a Visual Studio feedback ticket and mark it as private-to-Microsoft, then link the ticket here.

We're not aware of anything that would cause this specifically. You can set warning-as-error behavior using Directory.Build.props or Directory.Build.targets files in addition to the individual projects, but that is not new and shouldn't have changed.

rainersigwald avatar May 12 '22 17:05 rainersigwald

Thanks for your reply @rainersigwald and sorry for the delayed response. I've been having a lot of build issues in the last week so didn't have the time to update the ticket. I will find some time to run a build with a binary log. I think I will submit that in private to MS and I will also update you here.

jtorvald avatar May 18 '22 15:05 jtorvald

@jtorvald friendly ping :)

benvillalobos avatar Aug 18 '22 16:08 benvillalobos

@BenVillalobos thanks for the reminder. I have a binlog. I don't see an option to mark the issue private on the developercommunity. I prefer not to have it public. I have an enterprise license so I could also create a ticket elsewhere maybe? Or email @rainersigwald a download link?

edit: I did the latter

jtorvald avatar Aug 18 '22 20:08 jtorvald

@jtorvald There should be a way to mark items uploaded as private, we get lots of dev community tickets with private logs uploaded. We double checked with Rainer and he did not receive an email.

benvillalobos avatar Sep 01 '22 16:09 benvillalobos

Ah, I see now that reporting an issue from within visual studio for mac the attachments are private. It says something different on the website.

I just uploaded the file as attachment in the issue reported through VS Mac

Website: image

From Visual Studio for Mac: image

jtorvald avatar Sep 01 '22 17:09 jtorvald

FYI https://developercommunity.visualstudio.com/t/MSBuild-issue-7615/10137592?space=41&ftype=problem&sort=newest&stateGroup=active

@BenVillalobos @rainersigwald the internal ticket has the binlog.

kdubau avatar Sep 02 '22 16:09 kdubau

We agree this looks like a bug. We're going to close this issue and reopen the ticket so it can be routed to the VS for mac folks. As a temporary workaround, you can add <NoWarn>$(NoWarn);CS0618</NoWarn> to your project and it should stop that specific warning from coming up.

benvillalobos avatar Oct 27 '22 16:10 benvillalobos