AspNet Visual Studio - 合并程序集时出错 [英] AspNet Visual Studio - Error while merging assemblies
问题描述
这是在 Windows 10 PC 上的 Visual Studio 2019 社区 v 16.8.1 上发生的.
This is occurring on visual studio 2019 community v 16.8.1 on a windows 10 PC.
我需要帮助试图找出在合并程序集步骤期间发布 asp.net 4.7 Web 项目结束时发生此错误的原因.
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.
"合并程序集时出错:未将对象引用设置到对象的实例."
合并线看起来像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
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
我添加了 -errorstack 来得到这个结果
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.
我已尝试更新到最新的 Visual Studio(2019 社区 v 16.8.1),我已经从/local/microsoft 中删除了 visualstudio 和 vscommon 文件夹.重启电脑.
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.
此问题是在以下 Windows 更新后开始的.
This issue started after the following windows update.
https://support.microsoft.com/en-gb/help/4586781/windows-10-update-kb4586781
不确定更新是否起作用,但我可以在更新之前很好地发布.更新将强制退出 Visual Studio.
Not sure if the update plays a part but I could publish fine prior to it. The update would have force quit visual studio.
谢谢马特
推荐答案
运行 profiler 似乎改变了 web.config
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">
从这里删除 assemblyPostProcessorType=Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter, Microsoft.VisualStudio.Enterprise.AspNetHelper, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"标签
和删除
<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>
允许发布工作
这篇关于AspNet Visual Studio - 合并程序集时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!