0

This is occurring on visual studio 2019 community v 16.8.1 on a windows 10 PC.

I need help trying to find the cause for this error that happens at the end of publishing an asp.net 4.7 web project during the merge assemblies step.

"An error occurred when merging assemblies: Object reference not set to an instance of an object. "

The merge line looks like "D:\Repo\project\packages\Microsoft.AspNet.Merge.5.0.0-beta2\tools\net40\aspnet_merge.exe" "D:\Repo\project\obj\Release\AspnetCompileMerge\TempBuildDir" -o WebBuild -copyattrs obj\Release\AssemblyInfo\AssemblyInfo.dll -a

I added -errorstack to get this result

[NullReferenceException]: Object reference not set to an instance of an object.
   at System.Web.Compilation.WebCompilationVisitor.VisitMethodCall(MethodCall call)
   at System.Compiler.StandardVisitor.VisitExpression(Expression expression)
   at System.Compiler.StandardVisitor.VisitExpressionStatement(ExpressionStatement statement)
   at System.Compiler.StandardVisitor.VisitStatementList(StatementList statements)
   at System.Compiler.StandardVisitor.VisitBlock(Block block)
   at System.Compiler.StandardVisitor.VisitStatementList(StatementList statements)
   at System.Compiler.StandardVisitor.VisitBlock(Block block)
   at System.Compiler.StandardVisitor.VisitMethod(Method method)
   at System.Compiler.StandardVisitor.VisitMemberList(MemberList members)
   at System.Compiler.StandardVisitor.VisitTypeNode(TypeNode typeNode)
   at System.Web.Compilation.WebCompilationVisitor.VisitClass(Class Class)
   at System.Compiler.StandardVisitor.VisitTypeNodeList(TypeNodeList types)
   at System.Web.Compilation.WebCompilationVisitor.VisitTypeNodeList(TypeNodeList types)
   at System.Compiler.StandardVisitor.VisitModule(Module module)
   at System.Compiler.StandardVisitor.VisitAssembly(AssemblyNode assembly)
   at System.Web.Compilation.WebCompilationVisitor.VisitAssembly(AssemblyNode assembly)
   at ILMerging.ILMerge.Merge()
   at System.Web.Compilation.Merge.DoMerge(ILMerge merge)
   at System.Web.Compilation.Merge.MergeToSingleAssembly(String outputFile, String[] inputAssemblies, Hashtable assemblyMapping, DirectoryInfo inputDirectory, DirectoryInfo outputDirectory)
   at System.Web.Compilation.Merge.Main(String[] args)

But none of the above is telling me what the issue is.

I've tried updating to latest visual studio (2019 community v 16.8.1), I've removed visualstudio and vscommon folders from /local/microsoft. Restarted PC.

This issue started after the following windows update.

https://support.microsoft.com/en-gb/help/4586781/windows-10-update-kb4586781

Not sure if the update plays a part but I could publish fine prior to it. The update would have force quit visual studio.

Thanks Matt

MrMadMatty
  • 11
  • 1

1 Answers1

1

It seems that running the profiler had changed the web.config

<compilation debug="true" targetFramework="4.7.1" assemblyPostProcessorType="Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter, Microsoft.VisualStudio.Enterprise.AspNetHelper, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

Cutting out assemblyPostProcessorType="Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter, Microsoft.VisualStudio.Enterprise.AspNetHelper, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from this tag

and removing

<dependentAssembly>
    <assemblyIdentity name="Microsoft.VisualStudio.Enterprise.AspNetHelper" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <codeBase version="16.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio/Shared/Common/VSPerfCollectionTools/vs2019/Microsoft.VisualStudio.Enterprise.AspNetHelper.DLL" />
</dependentAssembly>
<dependentAssembly>
    <assemblyIdentity name="VsWebSite.Interop" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <codeBase version="8.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio/Shared/Common/VSPerfCollectionTools/vs2019/VsWebSite.Interop.DLL" />
</dependentAssembly>

Allow the publish to work

MrMadMatty
  • 11
  • 1