Jamie Hartnoll
Jamie Hartnoll

Reputation: 7361

Visual Studio (Community 2019) throwing errors which should be warnings regardless of settings in one project only

A couple of weeks ago I cleared the NuGet cache in Visual Studio... this broke everything for some time as it would not automatically restore all the NuGet packages for some reason.

After a lot of effort and manually restoring stuff, I have now got most projects in my (quite large) solution working, except one.

I am in the process of moving most of my code from .NETFramework projects, to .NETStandard and the websites to .NETCore, that in itself is a headache and may/may not be related to the problem, but I don't think so.

Anyway, this one project, which is a .NETFramework (4.7.2) web application and references many other projects in my solution, will not build properly.

Each time I build it, I get thousands of stupid errors from MSBuild, see the screenshot (ignore the top 4,they are genuine!). These are all errors which should be warnings, or ignored.

In the Project settings page I do NOT have "treat all warnings as errors" checked - in fact, in an effort to fix this, I have turned warnings off altogether as well.

The weird thing is, that if I build every individual project in the solution first, usually twice, and then build this one with out touching anything else, it then will build and launch in IIS (or publish)

So the site is actually working but something is wrong in MSBuild or VS that is breaking it.

I have tried running a Visual Studio repair, but that made no difference either.

EDIT also, it only does it on one PC, if I load the same solution onto my laptop, it will all build fine.

enter image description here

Upvotes: 0

Views: 89

Answers (1)

Mr Qian
Mr Qian

Reputation: 23848

And from some of the errors, if seems that the you should change the Assembly Name of the SAM project to Sam. It is quite strange. Not sure whether you have install some extra Code Analysis extensions on your current PC but other PCs works well.

So please try the following steps:

Steps

1) disable any third party installed vs extensions under Extensions-->Manage Extensions-->Installed

It needs a restart.

2) run update-package -reinstall under Tools-->Nuget Package Manager-->Package Manager Console

3) close VS, delete .vs hidden folder under the solution folder, every bin and obj folder of the projects under the solution.

Besides, you could use devenv /safemode to start a initial VS without any third party tools to test whether the issue happens.

Upvotes: 0

Related Questions