Deploying files in Windows Store App - visual-studio-2013

Normally when I am writing a desktop application (in Visual Studio) and need to include a certain file in the build directory I just use the 'Copy Always' option in the file properties. However, I am finding that if I use this option in a Windows Store App, the file will appear in the build directory, but is nowhere to be found when the application is deployed. I have tried marking the Build Action for the file as 'content' and a few others, but no luck.
How do I get my files to show up in the deployment directory?

Related

How to enforce Visual Studio to deploy content file?

I have a content file (xml, build action = content, copy always) in a class library (dll).
Many times when the host application (unit test dll, or web app) get recompile due to changes, this content file is not deployed.
it only get to deploy if i explicitly perform a "rebuild" at the host application.
is there a setting a way to ensure the file always get redeploy? already set it to "copy always", but doesn't work as expected.
There are two ways to solve this:
1) If you change non-source code files visual studio doesn`t automatically rebuild - they aren't considered when the compiler check occurs.
You may force a complete rebuild by deleting your output directory.
2) In the file properties in Visual Studio, set:
Build action: None
Copy to output directory: Copy always
Sometimes this helps
Edit: Also consider marking the file as content

How can I copy additional files to drop location with MsBuild 2013

I'm part of a large developmentteam with a big project that is built with TFS 2013. We have gotten the build to work with automatic tests and web transformations as well as deployment to correct folders. The last part we need is a way to copy additional files to the drop location with regards to different environment.
We have a folder in the solution that contains several deployment files for different environments. We build for several environment with each build.
The folder looks like the following:
A folder named contains several powershell scriptfiles
(Deploy.ps1, RunDeploy.ps1, StartService.ps1)
The first file should be copied to the root of the drop folder location for each configuration/environment.
The last two files should be copied to a new folder named Deploy under each configuration in the drop folder.
Additional to this we have several settings files in the same sourcefolder. One file for each environment named settings-.txt
These files should be copied to the Deploy folder for the correct configuration under the drop location.
We are using TFS 2013 so preferable using a custom workflow but we can use a target-file if needed.
Any idea how this can be created?
Where should I start?
I have been unable to locate a variable in a custom task in the build process that contains the location of the dropfolder for each configuration.
I managed to create a custom task in the build template after some searching for the variables I finally could create a custom task that created the correct folders and located the files that needed to be brought along in the build.
To find the variables I used the common task GetEnvironmentVariable with the specified variables. To see what each variable contained I added a print line just afterwards and tried the build and then when I had found the needed sources of information the task to create a custom build task was fairly easy.

Deploy custom files to mobile device during build

I have an sdf file in my solution and I want it to be copied to an arbitrary place on the mobile device when I deploy. In the build events for the project, the only macro seems to point to the build output in the solution files on my computer, not to the end directory on the mobile device (Output file folder under Deployment options). When I set the property on the sdf file Copy to Output Directory - thats talking about the bin/Debug output directory on my computer where the solution files are - so, the question is, how can I deploy basically arbitrary files to arbitrary places on the mobile device?
This doesnt work as a post build event:
copy $(OutDir)*.sdf %CSIDL_PROGRAM_FILES%\My_app
For C++ programs, go to the project properties: Configuration Properties->Deployment->Additional Files and enter the files you want to deploy.
In C#, add the file to your project and open its properties. Under Copy to Output Directory select either Copy if newer or Copy always depending on your taste.

TFS 2010 Build Automation for a Web Site: Delete a file in the publish folder after build

We are trying to adapt a build automation strategy for our ASP.NET web site (not a web project) in vs 2010 ultimate & tfs 2010.
Build definition makes the build and publishes the web site into folders like
<drop_folder>\<defn_name>\<defn_name>_<year><month><day>.<build no>\Release_PublishedWebsites
Now we try to delete particular files and folders from that folder. For instance the "images" or "files" folders, that we need to exclude before packaging. I know that if it were a web project, there exists a straightforward solution. We also tried to modify the build process template (xaml) file. There is a "DeleteDirectory" component but we couldn't figure out what to write to the Directory variable.
Thank you.
If you follow the XAML way, you would just have to feed the Directory argument of DeleteDirectory with the physical UNC path to the folder you 're trying to get rid of.Something along the lines of String.Format("{0}\\{1}\\{2}\\Release_PublishedWebsites", BuildDetail.DropLocation, BuildDetail.BuildNumber, Date.Now.Year)
should get you near to your target. Since the drop location of the build might be on a different machine, also ensure that the account conducting the build (by default = NetworkService) has the rights to delete folders on the target.

Packaging fonts in visual studio deployment package and the zip folder structure

I'm using MSBuild to create a deployment package as part of my build process. I am calling MSBuild with /t:package as part of the command.
This is working great except for two things.
I am using web fonts and it seems that these are not being included as part of the package (they are included in the project). How do I include these fonts?
The folder structure within the zip file is ludicrous - it includes the full path from the drive letter down. I anticipate this could cause problems with the length of path names at some point. Does anyone know how to prevent this? (I know it's a duplicate of this: Visual Studio Deployment Package - change the file structure the .zip creates?)
The reason your fonts (or any other non-standard file) are not being deployed is the "build action" is set to "none". To fix this, select the file in solution explorer and modify the build action to "content". Package your project and it will be included.
I never understood the folder structure either. By using msdeploy to publish the site it uses that folder structure to deploy multiple sites at once. It's annoying when looking at the package itself but it does "work". Also... the max file length is something like 32k characters. See: Maximum filename length in NTFS (Windows XP and Windows Vista)?
There is a way to change the internal path used within the zip:
/p:_PackageTempDir="C:\websites\myNewSite"
The switch can be used on the command line with msbuild to change the path it creates inside the zip. It is also possible to change this within VS but can't remember how off the top of my head.

Resources