Troubleshooting MSBuild Publish Issues on Servers with Visual Studio Build Tools
Introduction
When deploying .NET Framework web applications (such as those using Sitecore Helix) on a production or build server, you might encounter a frustrating issue: MSBuild runs successfully with 0 errors, but no files are output to the specified publish directory. This problem often arises when using the minimal Visual Studio Build Tools installation, as opposed to a full Visual Studio IDE setup on a development machine. In this blog post, I'll walk through the symptoms, root cause, and step-by-step resolution based on a real-world scenario. This guide assumes you're working with a .NET Framework 4.8 web project and MSBuild commands for publishing to a file system.
The goal is to make your build server "publish-ready" without installing the full Visual Studio IDE, which is unnecessary (and resource-heavy) on servers.
Symptoms of the Issue
- MSBuild Command Execution: You run a command like this:
MSBuild.exe "C:\path\to\YourProject.csproj" /restore /p:Configuration=debug /p:DeployOnBuild=True /p:PublishProfile=Local /p:WebPublishMethod=FileSystem /p:PublishUrl="C:\path\to\publish\folder" /p:TransformConfigFiles=true /p:IncludeSetAclProviderOnDestination=False /v:detailed
- It completes with 0 errors (possibly many warnings, e.g., 429 in some cases).
- Logs show property reassignments, framework path searches, and successful builds of dependencies, but no mention of actual publishing (e.g., no execution of
WebPublishtargets).