How can I filter which files are included in a workspace using MSBuild? - msbuild

It seems that MsBuild creates a folder called, "BuildType" on the build server and this folder is where the .proj file is copied. In source control I have several files that are in the same folder as the build project file. I have a workspace mapped to this location.
I would like to be able to specify explicitly which files from this workspace location should be copied to the build machine. Is this possible?
Thanks!

You cannot do this on file level but if you organize your build type folder with subfolders you can cloak the folders that you want to exclude.

Related

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

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.
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
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.
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.

Where can I find the rootfolder for my VB.net project

I am making a project that will be put on a disc to use. This means that all of the files that I call upon have to be on that disc. How and where do I put my files to ensure that they will stay with the project? Does it go in the bin folder? And when I am calling on that file what file path do I use?
In general, the bin folder is not a place you should be storing anything that you want to persist with the project.
When you build, Visual Studio will copy the files needed to run the program into the bin folder, such as libraries and web.config or app.config files.
For other files you want included, add them to your project and set their build action property to Content:
Content - The file is not compiled, but is included in the Content output group.
For example, this setting is the default value for an .htm or other
kind of Web file.

How to build resource files in to dll while maintaining their folder structure?

Is there a way to build a folder containing various resource files into a dll? The folder may contain sub-folders, and I want to keep the folder structure of these files so that I can access the files from the dll with relative path.
I'm using visual studio but it seems I can only add a resource file without sub-folders. Can you give me some suggestion on this problem?
Thanks.

Overriding the bin directory

I am writing a MSBuild script for creating a one click deployment. Everything works great but the files are created in the app.publish under the bin directory. Is there a way to set the output directory to another directory instead of the default bin directory?
I used PublishDir but that just creates the setup.exe in the specified directory. The other files are still created under the bin directory.
Can route all the one click deployments to a specific directory or do I have to copy later?
Thanks,
Richard.
Have you tried OutputPath instead?
msbuild my_solution.sln /p:OutputPath=c:\my_dir

Move files to a specific folder when run the setup file for VB.Net Application

I have created deployment package for VB.Net appolication and it runs fine. When setup is rnning, I want deployment package to move a file from bin folder to other specific folder.
Please suggest, how can I move this file to specific folder.
Any help would be appreciated.
Thanks, Yogi
In Visual Studio 2008 setup project,
Select File System on Target Machine and then from Action menu select Add Special folder and then Custom folder. A new folder will apear on left hand side under the "File System on Traget Machine". Add files, into this custom folder, which you want to copy into into specified location,
Now go into the property of this custom folder and set the DefaultLocation where you want to copy files under this custom folder.
Now when you run the setup this file under the custom folder will copy into the specified location which you set in DefaultLocation.
Yogi..