I've had this issue over VS 2015, 2017 and 2019, so I believe this is not specific to my setup.
aspnet_merge(0,0): Error occurred: An error occurred when merging assemblies: Object reference not set to an instance of an object
This happens after the following runs:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\aspnet_merge.exe (project location)\TempPackageBuildDir\obj\Debug\AspnetCompileMerge\TempBuildDir -o (name of assembly) -copyattrs (repository location)\..\..\TempPackageBuildDir\obj\Debug\AssemblyInfo\AssemblyInfo.dll -a -debug
I can run this exact same command on a different machine and it runs without an issue. I've been able to solve this ONCE before by explicitly setting my output directory in website.publishproj to
<PropertyGroup>
<OutputPath>$(MSBuildProjectDirectory)\..\..\TempPackageBuildDir\</OutputPath>
</PropertyGroup>
But a couple days later the issue came back. There is somethinng bad cached on my machine specifically and I don't have enough knowledge to know what it is.
Any insight would be appreciated,