1>CSC : error CS2001: Source file ‘\Packages\com.unity.test-framework\UnityEngine.TestRunner\AssemblyInfo.cs’ could not be found.
1>CSC : error CS2001: Source file ‘\Packages\com.unity.test-framework\UnityEngine.TestRunner\Assertions\AllocatingGCMemoryConstraint.cs’ could not be found.
It seems the VS project files that get generated mistakenly think the source to these packages is inside my project folder, which they are not. Unity doesn’t show the errors, only VS.
Usually by removing and re-installing the packages the problem goes away. but its enoying to have to do this over and over. Not sure what happens when the issue starts. happens every few days for me it seems. I use perforce for source control, and switch streams between different platforms now and then, could this somehow cause it?
editor log. note that includes a lot of DllNotFoundException errors, but that’s because i am working on the PC with some platform dependent code. I got those sorted in the latest. Also note that the compile errors only happen in visual studio, and do not happen in editor.
I would also need the version of VS and VSTU (Visual Studio Tools for Unity, a VS extension) that you’re using.
These errors only happen in VS, which is because Unity uses its own internal compilation pipeline that is not based on .sln/.csproj files. Those are files generated specifically for Visual Studio, so when VS compiles, it may result in something different from Unity (as is the case right now).
i attached the generated project file for one of the packages that’s failing. Thing is, i am not sure why Unity singled out these packages and created project files for them and added them to the solution, and not others?
it seems that instead of going to the cache folder or where ever it downloads the packages to, it wants to go to my game’s package folder. example when looking for ChannelBuffer, it looks for it here:
H:\w\main\project\tin\TrackMayhem\Packages\com.unity.multiplayer-hlapi\Runtime\ChannelBuffer.cs
instead of where it is:
H:\w\main\project\tin\TrackMayhem\Library\PackageCache\com.unity.multiplayer-hlapi@1.0.4\Runtime\ChannelBuffer.cs
So what might be happening is the fact that you use VS 2017 with Unity 2019. Using a brand new Unity 2019 with an old VS IDE that is no longer supported (apart from security fixes) will cause issues.
Unity’s fixes and new features are only coming to VS 2019.
I suggest you to migrate to VS2019. It comes with a free Community Edition and if you are working for a big company, Unity has a bundle Unity Pro + Visual Studio Pro.