Project fails to build after upgrading version of Unity

Our Unity project has recently been upgraded from 2017.3.1f1 to 2018.3.2f1. (I realise we are still behind the latest, but we’re hoping to upgrade to latest shortly)

After the upgrade, the game builds fine in Unity (no errors) and plays perfectly.

However, in Visual Studio the project fails to build with 167 errors.

These errors are not related to the games files but other projects that seem to have been automatically added to the solution. The following projects are causing us concerns:

  • Unity.Analytics.DataPrivacy
  • Unity.CollabProxy.Editor
  • Unity.PackageManagerUI.Editor
  • Unity.TextMeshPro
  • Unity.TextMeshPro.Editor

All of the errors relate to source files not being found. None of the above projects have any scripts within their project. The errors are, for example:

Error CS2001 Source file ‘[Path to Project]\Packages\com.unity.collab-proxy\Editor\Collab\Presenters\CollabHistoryPresenter.cs’ could not be found. Unity.CollabProxy.Editor

I have checked the above file path and the file it was looking for isn’t there. However, I didn’t remove it.

None of these projects were present in solution explorer before upgrading versions and the project built fine.

I have tried removing these projects which solved the immediate problem. However, relaunching Visual Studio re-adds them.

Project in question is on hold. I started a new project in Unity 2019 and this issue remained. Therefore I was aware this wasn’t a project issue but more environmental.

After looking across the internet I discovered this thread:
https://forum.unity.com/threads/error-building-project-with-visual-studio-in-unity-2018-unity-package-source-file-not-found-error.530766/

Upgrading to the latest version of Visual Studio 2017 has resolved the issue. Although judging from the thread above, upgrading to 2017 15.9.5 resolved the issue for a lot of people.