Including a reference to a COM object causes the first build to fail while the subsequent build succeeds.
Error The assembly path obj\Debug\netcoreapp3.1\Interop.{0}.dll is invalid. Assembly paths must be rooted. {1} C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Microsoft.NET.Sdk.Razor.CodeGeneration.targets 99
Include a COM library reference to a ASP.NET Core project.
This issue has been referenced multiple times and has not been resolved.
There is a workaround described in this issue but it's far from ideal. This referenced issue also includes a sample project with the bug.
https://github.com/dotnet/aspnetcore/issues/5086
Second reference to the bug.
https://developercommunity.visualstudio.com/content/problem/899081/error-assembly-paths-must-be-rooted-when-referenci.html
This repo demonstrates the problem.
https://github.com/tenacioustechie/ATEM-TallyLights
The COM library I'm referecing is the blackmagic ATEM switcher software & sdk
https://www.blackmagicdesign.com/au/support/family/atem-live-production-switchers
I've left a branch that has the issue.
https://github.com/tenacioustechie/ATEM-TallyLights/tree/COMIssue
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
I think I am posting this too in my website blog but I have only found an ugly workaround:
Most helpful comment
This repo demonstrates the problem.
https://github.com/tenacioustechie/ATEM-TallyLights
The COM library I'm referecing is the blackmagic ATEM switcher software & sdk
https://www.blackmagicdesign.com/au/support/family/atem-live-production-switchers