visual-studiowebmsbuildweb-deploymentweb-publishing

Hundreds of MSBuild instances on web publish, then hangs


I am using Visual Studio 2015 Update 3, with several web project solutions that use a file system publish process. This has been working well for a long time until last week, when any time I try a publish of any sort - be it a Release build of the solution, or a manual selection of a project's publish option, MSBuild.exe will start running and then hundreds of them take over the system along with conhost.exe and cmd.exe (similar number of each of these). See screenshot below. The folder never gets published to and the longest I let it run was about an hr, after which I could not cancel the build and had to reboot. I even tried a Visual Studio repair, but then I discovered it happens on 2 other machines but not on a 4th. We are on different OS' versions (Windows 7 & Windows 10), but all using the same version of Visual Studio. We have all rebooted a number of times. This was working well as recently as Oct 11 (last Thurs), started seeing it on Oct 12, and have been battling it ever since. The publish process itself has not changed, nor have the project properties for any of these web projects.

enter image description here

Here is what one of the pubxml looks like:

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>$(MSBuildThisFileDirectory)..\..\PublishWebServiceToFileSystem</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
  </PropertyGroup>
</Project>

I did see a similar post, but it was related to timezone changes, and as far as I know, none of us have made any such changes. Can anyone provide advice as to how to troubleshoot something like this?

TIA


Solution

  • I believe this is resolved now and had to do with using SignTool in a PostBuildEvent. Because our automated build process requires a publish, we also had the msbuild publish call in the same PostBuildEvent, after the dll signing. We think what was happening was that during publish, it would see the post build event and try to sign a dll that was already signed. I am not 100% sure that was the issue, but removing the signing stopped the behavior, putting it back in resumed the behavior, so evidence points in that direction.

    What I did to fix the issue was to change the publish command to do this, where /p:PostBuildEvent= was added to the existing statement:

    if $(ConfigurationName) == Release ("$(MSBuildBinPath)\msbuild.exe" 
    "$(ProjectPath)" /p:Configuration=Release /p:DeployOnBuild=true 
    /p:PublishProfile=PublishWebSiteToFileSystem /p:VisualStudioVersion=14.0 
    /p:PostBuildEvent=)
    

    Again, thanks for all who took a look at this. Hopefully this will help someone else in the future.