1

I have an asp.net web api project whose output needs to be packaged in a setup project using wix.

I would like to precompile the site. The problem is that the precompilation process generates variable file names (ie. *.compiled files in particular).

I also would like to build the setup in a TFS build.

It seems that my only option is to generate a .wxs file wihtin the prebuild step of the wix project.

The .wxs files source paths are using $(var._My_Web_Project_.TargetDir). This seems to be translated to a Sources based directory.

I'm using paraffin to do that already and it works perfectly fine when building the solution with visual studio.

When building the solution through a TFS build, the .compiled files are copied to a Binaries folder, whereas all the other related web site files are copied to a Sources based directory.

The build errors are like the following :

The system cannot find the file 'd:\BuildAgents\___basedir___\Binaries\___web_project_dir\_PublishedWebSites\___site___\bin\textsample.cshtml.c6fb271c.compiled'.

The file is indeed in the Sources directory.

'd:\BuildAgents\___basedir___\Sources\___web_project_dir\_PublishedWebSites\___site___\bin\textsample.cshtml.c6fb271c.compiled'

I think I somehow need to redefine the aspnet_compiler output or something like this, but can't figure out how to do that.

The msbuild command line arguments are the follwing:

/p:GenerateProjectSpecificOutputFolder=true /p:VisualStudioVersion=14.0 /p:DeployOnBuild=true /p:PublishProfile=local /p:CleanWebProjectOutputDir=False /verbosity:d

EDIT 1: I'm using XAML build.

enter image description here

Any help appreciated.

EDIT 2: With the new task based build, it works as is (no need to use an additional Copy Files task).

The aspnet_compiler output the .compiled files in the correct folder :

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p D:\BuildAgents\vNext\_work\1\s\Softs\__Solution__\__Web_Project\obj\Release\AspnetCompileMerge\Source -c D:\BuildAgents\vNext\_work\1\s\Softs\__Solution__\__Web_Project__\obj\Release\AspnetCompileMerge\TempBuildDir

1 Answers1

0

In the new tasks based build system, it's easy to copy files from a source folder to a target folder with Copy Files task.

enter image description here

Source Folder: Folder that contains the files you want to copy.

Contents: Specify minimatch pattern filters (one on each line) that you want to apply to the list of files to be copied.

Target Folder: Folder where the files will be copied. In most cases you specify this folder using a variable.

Community
  • 1
  • 1
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • Since you are using XAML build, you can write and check in a script, and specify a post-build script path in your XAML build definition. You can refer to this script (https://tfsbuildextensions.codeplex.com/SourceControl/latest#Scripts/GatherItemsForDrop.ps1) which gathers some of the typical binary types from the typical locations and copies them to the folder from which TFBuild copies and drops to your staging location. Check more information about Run a script in your XAML build process at website: https://msdn.microsoft.com/library/dn376353%28v=vs.120%29.aspx – Cece Dong - MSFT Dec 20 '16 at 08:56
  • By the way, since you are using TFS 2015, it's recommended to use tasks based build system, which is more easy and flexible to use. – Cece Dong - MSFT Dec 20 '16 at 08:58
  • Thanks I'l have a look –  Dec 20 '16 at 09:58
  • The solution is indeed to use the new task based build system. The aspnet_compiler outputs the files in the correct folder. There is no need to use an additional Copy files task. –  Dec 20 '16 at 15:32