Home
%3CLINGO-SUB%20id%3D%22lingo-sub-303771%22%20slang%3D%22en-US%22%3EBot%20Template%20Project%20fails%20at%20publishing%20after%20several%20times%20publish%20from%20VS.Net%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-303771%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20you%20create%20a%20Microsoft%20Bot%20project%20using%20Bot%20template%20projects%2C%20you%20may%20run%20into%20publish%20failure%20after%20several%20times%20publish%20-%20could%20be%203%20times%2C%20could%20be%208%20times%2C%20it%20eventually%20will%20fail.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20publish%20error%20looks%20like%20below%3A%3C%2FP%3E%0A%3CP%3E__________________________________________________________________________________________________________%3C%2FP%3E%0A%3CP%3E1%26gt%3B------%20Build%20started%3A%20Project%3A%20Microsoft.Bot.Sample.SimpleEchoBot%2C%20Configuration%3A%20Release%20Any%20CPU%20------%3C%2FP%3E%0A%3CP%3E1%26gt%3B%26nbsp%3B%20Microsoft.Bot.Sample.SimpleEchoBot%20-%26gt%3B%20C%3A%5CUsers%5Cdejue%5CDesktop%5CCustomerFiles%5CCx0241%5CNYIT-MS-SR-1-src%5Cbin%5CSimpleEchoBot.dll%3C%2FP%3E%0A%3CP%3E2%26gt%3B------%20Publish%20started%3A%20Project%3A%20Microsoft.Bot.Sample.SimpleEchoBot%2C%20Configuration%3A%20Release%20Any%20CPU%20------%3C%2FP%3E%0A%3CP%3E2%26gt%3BC%3A%5CProgram%20Files%20(x86)%5CMicrosoft%20Visual%20Studio%5C2017%5CEnterprise%5CMSBuild%5CMicrosoft%5CVisualStudio%5Cv15.0%5CWeb%5CMicrosoft.Web.Publishing.targets(3725%2C5)%3A%20Warning%20MSB3231%3A%20Unable%20to%20remove%20directory%20%22obj%5CRelease%5CPackage%5CPackageTmp%22.%20Could%20not%20find%20a%20part%20of%20the%20path%20'C%3A%5CUsers%5Cdejue%5CDesktop%5CCustomerFiles%5CCx0241%5CNYIT-MS-SR-1-src%5Cobj%5CRelease%5CPackage%5CPackageTmp%5Cobj%5CRelease%5CPackage%5CPackageTmp%5Cobj%5CRelease%5CPackage%5CPackageTmp%5Cobj%5CRelease%5CPackage%5CPackageTmp%5Cpackages%5CMicrosoft.Bot.Builder.3.16.1.38846%5Csrc%5CMicrosoft.Bot.Builder%5CBase'.%3C%2FP%3E%0A%3CP%3E2%26gt%3BTransformed%20Web.config%20using%20C%3A%5CUsers%5Cdejue%5CDesktop%5CCustomerFiles%5CCx0241%5CNYIT-MS-SR-1-src%5CWeb.Release.config%20into%20obj%5CRelease%5CTransformWebConfig%5Ctransformed%5CWeb.config.%3C%2FP%3E%0A%3CP%3E2%26gt%3BAuto%20ConnectionString%20Transformed%20obj%5CRelease%5CTransformWebConfig%5Ctransformed%5CWeb.config%20into%20obj%5CRelease%5CCSAutoParameterize%5Ctransformed%5CWeb.config.%3C%2FP%3E%0A%3CP%3E2%26gt%3BCopying%20all%20files%20to%20temporary%20location%20below%20for%20package%2Fpublish%3A%3C%2FP%3E%0A%3CP%3E2%26gt%3Bobj%5CRelease%5CPackage%5CPackageTmp.%3C%2FP%3E%0A%3CP%3E___________________________________________________________________________________________________________%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20address%20the%20issue%2C%20we%20needs%20to%20do%20the%20following%3A%3C%2FP%3E%0A%3CP%3E1.%20Delete%20the%20obj%20folder%20under%20the%20project%20(back%20it%20up%20before%20delete%20just%20to%20be%20safe).%3C%2FP%3E%0A%3CP%3E2.%20Modified%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3EPostDeployScripts%5CIncludeSources.targets%20file%20to%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CPROJECT%20xmlns%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22http%3A%2F%2Fschemas.microsoft.com%2Fdeveloper%2Fmsbuild%2F2003%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CA%20href%3D%22http%3A%2F%2Fschemas.microsoft.com%2Fdeveloper%2Fmsbuild%2F2003%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttp%3A%2F%2Fschemas.microsoft.com%2Fdeveloper%2Fmsbuild%2F2003%3C%2FA%3E%22%26gt%3B%3C%2FPROJECT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCORECOMPILEDEPENDSON%3E%24(CoreCompileDependsOn)%3BIncludeSource%3C%2FCORECOMPILEDEPENDSON%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%3C%2FP%3E%3C%2FLINGO-BODY%3E%26nbsp%3B%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3CTARGET%20name%3D%22%26quot%3BIncludeSource%26quot%3B%22%3E%3C%2FTARGET%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCONTENT%20include%3D%22%26quot%3B**%2F*.cs%26quot%3B%22%20exclude%3D%22%26quot%3Bobj%2F**%26quot%3B%22%3E%3C%2FCONTENT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCONTENT%20include%3D%22%26quot%3B**%2F*.csproj%26quot%3B%22%20exclude%3D%22%26quot%3Bobj%2F**%26quot%3B%22%3E%3C%2FCONTENT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCONTENT%20include%3D%22%26quot%3BPostDeployScripts%5C*.*%26quot%3B%22%3E%3C%2FCONTENT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-303771%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20you%20create%20a%20Microsoft%20Bot%20project%20using%20Bot%20template%20projects%2C%20you%20may%20run%20into%20publish%20failure%20after%20several%20times%20publish%20-%20could%20be%203%20times%2C%20could%20be%208%20times%2C%20it%20eventually%20will%20fail.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20publish%20error%20looks%20like%20below%3A%3C%2FP%3E%0A%3CP%3E__________________________________________________________________________________________________________%3C%2FP%3E%0A%3CP%3E1%26gt%3B------%20Build%20started%3A%20Project%3A%20Microsoft.Bot.Sample.SimpleEchoBot%2C%20Configuration%3A%20Release%20Any%20CPU%20------%3C%2FP%3E%0A%3CP%3E1%26gt%3B%26nbsp%3B%20Microsoft.Bot.Sample.SimpleEchoBot%20-%26gt%3B%20C%3A%5CUsers%5Cdejue%5CDesktop%5CCustomerFiles%5CCx0241%5CNYIT-MS-SR-1-src%5Cbin%5CSimpleEchoBot.dll%3C%2FP%3E%0A%3CP%3E2%26gt%3B------%20Publish%20started%3A%20Project%3A%20Microsoft.Bot.Sample.SimpleEchoBot%2C%20Configuration%3A%20Release%20Any%20CPU%20------%3C%2FP%3E%0A%3CP%3E2%26gt%3BC%3A%5CProgram%20Files%20(x86)%5CMicrosoft%20Visual%20Studio%5C2017%5CEnterprise%5CMSBuild%5CMicrosoft%5CVisualStudio%5Cv15.0%5CWeb%5CMicrosoft.Web.Publishing.targets(3725%2C5)%3A%20Warning%20MSB3231%3A%20Unable%20to%20remove%20directory%20%22obj%5CRelease%5CPackage%5CPackageTmp%22.%20Could%20not%20find%20a%20part%20of%20the%20path%20'C%3A%5CUsers%5Cdejue%5CDesktop%5CCustomerFiles%5CCx0241%5CNYIT-MS-SR-1-src%5Cobj%5CRelease%5CPackage%5CPackageTmp%5Cobj%5CRelease%5CPackage%5CPackageTmp%5Cobj%5CRelease%5CPackage%5CPackageTmp%5Cobj%5CRelease%5CPackage%5CPackageTmp%5Cpackages%5CMicrosoft.Bot.Builder.3.16.1.38846%5Csrc%5CMicrosoft.Bot.Builder%5CBase'.%3C%2FP%3E%0A%3CP%3E2%26gt%3BTransformed%20Web.config%20using%20C%3A%5CUsers%5Cdejue%5CDesktop%5CCustomerFiles%5CCx0241%5CNYIT-MS-SR-1-src%5CWeb.Release.config%20into%20obj%5CRelease%5CTransformWebConfig%5Ctransformed%5CWeb.config.%3C%2FP%3E%0A%3CP%3E2%26gt%3BAuto%20ConnectionString%20Transformed%20obj%5CRelease%5CTransformWebConfig%5Ctransformed%5CWeb.config%20into%20obj%5CRelease%5CCSAutoParameterize%5Ctransformed%5CWeb.config.%3C%2FP%3E%0A%3CP%3E2%26gt%3BCopying%20all%20files%20to%20temporary%20location%20below%20for%20package%2Fpublish%3A%3C%2FP%3E%0A%3CP%3E2%26gt%3Bobj%5CRelease%5CPackage%5CPackageTmp.%3C%2FP%3E%0A%3CP%3E___________________________________________________________________________________________________________%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20address%20the%20issue%2C%20we%20needs%20to%20do%20the%20following%3A%3C%2FP%3E%0A%3CP%3E1.%20Delete%20the%20obj%20folder%20under%20the%20project%20(back%20it%20up%20before%20delete%20just%20to%20be%20safe).%3C%2FP%3E%0A%3CP%3E2.%20Modified%20the%20PostDeployScripts%5CIncludeSources.targets%20file%20to%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CPROJECT%20xmlns%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22http%3A%2F%2Fschemas.microsoft.com%2Fdeveloper%2Fmsbuild%2F2003%22%20rel%3D%22noopener%20noreferrer%22%3E%3CA%20href%3D%22http%3A%2F%2Fschemas.microsoft.com%2Fdeveloper%2Fmsbuild%2F2003%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttp%3A%2F%2Fschemas.microsoft.com%2Fdeveloper%2Fmsbuild%2F2003%3C%2FA%3E%22%26gt%3B%3C%2FPROJECT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCORECOMPILEDEPENDSON%3E%24(CoreCompileDependsOn)%3BIncludeSource%3C%2FCORECOMPILEDEPENDSON%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%3C%2FP%3E%3C%2FLINGO-TEASER%3E%26nbsp%3B%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3CTARGET%20name%3D%22%26quot%3BIncludeSource%26quot%3B%22%3E%3C%2FTARGET%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCONTENT%20include%3D%22%26quot%3B**%2F*.cs%26quot%3B%22%20exclude%3D%22%26quot%3Bobj%2F**%26quot%3B%22%3E%3C%2FCONTENT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCONTENT%20include%3D%22%26quot%3B**%2F*.csproj%26quot%3B%22%20exclude%3D%22%26quot%3Bobj%2F**%26quot%3B%22%3E%3C%2FCONTENT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCONTENT%20include%3D%22%26quot%3BPostDeployScripts%5C*.*%26quot%3B%22%3E%3C%2FCONTENT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3CLINGO-LABS%20id%3D%22lingo-labs-303771%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Ehuanchix%40microsoft.com%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

If you create a Microsoft Bot project using Bot template projects, you may run into publish failure after several times publish - could be 3 times, could be 8 times, it eventually will fail.

 

The publish error looks like below:

__________________________________________________________________________________________________________

1>------ Build started: Project: Microsoft.Bot.Sample.SimpleEchoBot, Configuration: Release Any CPU ------

1>  Microsoft.Bot.Sample.SimpleEchoBot -> C:\Users\dejue\Desktop\CustomerFiles\Cx0241\NYIT-MS-SR-1-src\bin\SimpleEchoBot.dll

2>------ Publish started: Project: Microsoft.Bot.Sample.SimpleEchoBot, Configuration: Release Any CPU ------

2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.targets(3725,5): Warning MSB3231: Unable to remove directory "obj\Release\Package\PackageTmp". Could not find a part of the path 'C:\Users\dejue\Desktop\CustomerFiles\Cx0241\NYIT-MS-SR-1-src\obj\Release\Package\PackageTmp\obj\Release\Package\PackageTmp\obj\Release\Package\PackageTmp\obj\Release\Package\PackageTmp\packages\Microsoft.Bot.Builder.3.16.1.38846\src\Microsoft.Bot.Builder\Base'.

2>Transformed Web.config using C:\Users\dejue\Desktop\CustomerFiles\Cx0241\NYIT-MS-SR-1-src\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config.

2>Auto ConnectionString Transformed obj\Release\TransformWebConfig\transformed\Web.config into obj\Release\CSAutoParameterize\transformed\Web.config.

2>Copying all files to temporary location below for package/publish:

2>obj\Release\Package\PackageTmp.

___________________________________________________________________________________________________________

 

To address the issue, we needs to do the following:

1. Delete the obj folder under the project (back it up before delete just to be safe).

2. Modified the PostDeployScripts\IncludeSources.targets file to the following:

 

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>

    <CoreCompileDependsOn>$(CoreCompileDependsOn);IncludeSource</CoreCompileDependsOn>

  </PropertyGroup> 

  <Target Name="IncludeSource">

    <ItemGroup>

                <Content Include="**/*.cs" Exclude="obj/**" />

        <Content Include="**/*.csproj" Exclude="obj/**" />

      <Content Include="PostDeployScripts\*.*" />

    </ItemGroup>

  </Target>

</Project>