.NET Core 2.0 Web App发布至Azure失败(VS2017环境)
First, let's recap what you've observed so far:
- Both Release and Debug configurations compile without explicit errors
- Setting build verbosity to Diagnostic didn't turn up clear code-related issues
.tmpdump files hint at underlying problems, leading you to suspect an internal Visual Studio error- The truncated error message you encountered:
2018年5月4日 21:34:44 System.AggregateException: 发生一个或多个错误。---> System.Exception: 因编译错误导致发布失败。查看错误列表获取更多详细信息。--- 内部异常堆栈跟踪结束 --- 在System.Th...
Since your builds succeed but publish fails, this is likely tied to cached data, corrupted settings, or internal VS installation issues. Here are actionable steps to fix it:
Clean and Rebuild Your Solution
Right-click your solution in Solution Explorer → SelectClean, thenRebuild. This clears partial build artifacts that might be interfering with the publish process.Delete Cached Folders
Close Visual Studio completely, then delete the hidden.vsfolder (in your solution root), plus thebinandobjfolders for all projects. Reopen VS, rebuild, and try publishing again—these folders often store corrupted cached data that causes unexpected errors.Reset Visual Studio Settings
Go toTools→Import and Export Settings→Reset all settings. Save your current settings if you want, then reset to defaults. Corrupted settings can sometimes break publish workflows.Repair Visual Studio Installation
Open Control Panel → Programs → FindVisual Studio 2017→ ClickChange→ SelectRepair. This fixes any corrupted or missing system files that might be triggering internal exceptions.Get the Full Error Stack Trace
The truncated error (System.Th...) hides critical details. Go to the Output window, set "Show output from" toPublish, and look for the complete stack trace. You can also check the Windows Event Viewer (under Application logs) for more context about the exception.Publish via Command Line
Bypass the VS UI by using MSBuild directly. Open a Developer Command Prompt for VS 2017, navigate to your solution folder, and run:msbuild YourSolutionName.sln /p:Configuration=Release /p:PublishProfile=YourPublishProfile.pubxmlReplace the placeholders with your actual solution and publish profile names. This helps confirm if the issue is specific to the VS UI.
Update Visual Studio 2017
Make sure you're running the latest update. Go toHelp→Check for Updatesand install any available patches—Microsoft frequently fixes internal bugs in these updates.
内容的提问来源于stack exchange,提问作者Abhijeet

