Search code examples
c#asp.netvisual-studiovisual-studio-project

Visual Studio 2019 build errors


I have API project (.NET Framework 4.6) that contains a lot of different controllers, nuget packages, swagger, EF etc. If i load this project & make a build - everything succeeded (No issue found) and i can deploy my project to DevOps. However if i add atliest one line of code & make a build i get more that 6000 errors. I already tried to clean & rebuild my project but this does not help.

enter image description here

Some of those 6000 exeptions:

  • Consider merging the types defined in 'WebsiteApi' with another namespace.
  • Because the behavior of 'string.Format(string, object, object, object)' could vary based on the current user's locale settings, replace this call in 'CampusController.GetExternal()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'.
  • In member 'Controller.GetItems(DateTime, bool)', correct the casing of 'B' in parameter name 'B2B' by changing it to 'b'.
  • Modify 'CompanyController.GetCompany(Guid)' to catch a more specific exception than 'Exception' or rethrow the exception.

My workaround is: add code -> make build -> build will not succeded -> save project -> close VS -> open project again -> build = build succeeded.


Solution

  • Update from VS 16.8.3 to VS 16.9.0 solved this issue.

    For some reason VS 16.8.3 treat CA warnings as errors even if its set Properties > Build > Treat warnings and errors = None"

    Discussion