Visual Studio ASP.NET Web API Precompiled files placed in a different folder with TFS 2015

625 views Asked by At

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 (i.e. *.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 within 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 following:

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

I'm using XAML build.

enter image description here

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

There are 1 answers

3
Cece Dong - MSFT On BEST ANSWER

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.