package publish & ForceCopyBuildProvider (msbuild, 4.5)

(environment: .net, visual studio 2012, tc 7.1.4)

As part of a product build process, I need to insert a .lic file into the web application .bin.

To do this, I have an "afterbuild" step that copies the license file into the outputpath, and also have the following in the application's web.config:
system.web
compilation targetFramework="4.0"
buildProvider
remove extension=".lic"
add extension=".lic" type="System.Web.Compilation.ForceCopyBuildProvider"

buildProviders


compilation

....etc.


When I perform a release build at the command line exactly as I have TeamCity programmed to execute, it works fine, not only is the license file copied into the build tree, it is also published with the rest of the project artifacts.

When Team City performs the same build/publish, this license file is NOT included.

In the VS2010/.net4 environment, this worked fine - it was handled exactly the same way, but was done using a web deployment project rather than a package/publish.

Since deploying vs2012, and being forced to eliminate the WDP in favor of package/publish, I cannot get TeamCity to incorporate the .license file into the build artifacts, while it works perfectly when I run it locally.


Snippet of output from a manual build:

PipelineAspNetCompileMergePhase:
Publish Pipeline AspnetCompileMerge Phase
CopyAllFilesToSingleFolderForPackage:
Creating directory "obj\Release\Package\PackageTmp".
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
Copying obj\Release\AspnetCompileMerge\TempBuildDir\PrecompiledApp.config to obj\Release\Package\PackageTmp\PrecompiledApp.config.
Copying obj\Release\AspnetCompileMerge\TempBuildDir\bin\App_global.asax.compiled to obj\Release\Package\PackageTmp\bin\App_global.asax.compiled.
Copying obj\Release\AspnetCompileMerge\TempBuildDir\bin\App_global.asax.dll to obj\Release\Package\PackageTmp\bin\App_global.asax.dll.
Copying obj\Release\AspnetCompileMerge\TempBuildDir\bin\AscribeWeb.dll to obj\Release\Package\PackageTmp\bin\AscribeWeb.dll.
Copying obj\Release\AspnetCompileMerge\TempBuildDir\bin\Aspose.Total.lic to obj\Release\Package\PackageTmp\bin\Aspose.Total.lic.
Copying obj\Release\AspnetCompileMerge\TempBuildDir\AccessDenied.aspx to obj\Release\Package\PackageTmp\AccessDenied.aspx.


Snippet of output from a TeamCity build log:

[07:34:47]:            [PipelineAspNetCompileMergePhase] GetPublishingLocalizedString
[07:34:47]:             [GetPublishingLocalizedString] Publish Pipeline AspnetCompileMerge Phase
[07:34:47]:           [Ascribe\WebSite\AscribeWeb\AscribeWeb.csproj] CopyAllFilesToSingleFolderForPackage (6s)
[07:34:47]:            [CopyAllFilesToSingleFolderForPackage] MakeDir
[07:34:47]:             [MakeDir] Creating directory "obj\Release\Package\PackageTmp".
[07:34:47]:            [CopyAllFilesToSingleFolderForPackage] GetPublishingLocalizedString
[07:34:47]:             [GetPublishingLocalizedString] Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
[07:34:47]:            [CopyAllFilesToSingleFolderForPackage] CopyPipelineFiles (6s)
[07:34:47]:             [CopyPipelineFiles] Copying obj\Release\AspnetCompileMerge\TempBuildDir\PrecompiledApp.config to obj\Release\Package\PackageTmp\PrecompiledApp.config.
[07:34:47]:             [CopyPipelineFiles] Copying obj\Release\AspnetCompileMerge\TempBuildDir\bin\App_global.asax.compiled to obj\Release\Package\PackageTmp\bin\App_global.asax.compiled.
[07:34:47]:             [CopyPipelineFiles] Copying obj\Release\AspnetCompileMerge\TempBuildDir\bin\App_global.asax.dll to obj\Release\Package\PackageTmp\bin\App_global.asax.dll.
[07:34:47]:             [CopyPipelineFiles] Copying obj\Release\AspnetCompileMerge\TempBuildDir\bin\AscribeWeb.dll to obj\Release\Package\PackageTmp\bin\AscribeWeb.dll.
[07:34:47]:             [CopyPipelineFiles] Copying obj\Release\AspnetCompileMerge\TempBuildDir\AccessDenied.aspx to obj\Release\Package\PackageTmp\AccessDenied.aspx.


Note that the Aspose.Total.lic file is absent from the Team City build.

The msbuild step in TC is configured to use msbuild v4.5, with build tools version 4.0.  The specific project is still targeting .net 4, not 4.5.

Given that I have configured the build and publish to operate as I desire, and have verified this with my own build, and it is only TeamCity builds that are failing to incorporate this file, I am not sure how to proceed to debug it?


Advice Appreciated...

Gregg Siegfried
3 comments
Comment actions Permalink

I have a similar issue. I need to place an unmanaged DLL into the BIN folder as part of publish/package process and so far no luck.
I've only been running through TC, with the next step being testing locally with MSBUILD.
This project does not target .NET4.5

I've been wondering if the TC MSBUILD runner is the issue.
This is my number one item for the day and will post if I find a solution.

0
Comment actions Permalink

Gregg,

I wuld start by following the notes. Most probbaly this is an environment difference issue.

0
Comment actions Permalink
I tried multiple solutions from the MSBuild route and none worked.In the end, I added the dll to the root of the project, set the item to "Content", and set output to "Copy Always" - which places the .dll in the bin folder prior to packaging.Not the solution I wanted and not one that would work if I had a folder full of items to move to the root of the bin folder - but worked well enough here.Note: creating a folder in the project and marking items in the folder as Content and Copy Always caused the items to be placed in a folder within the bin folder - which was not a workable solution in this case.
0

Please sign in to leave a comment.