Install not adding all Content files - visual-studio

I have some xml files I want to distribute with the project. The Build Action is set to Content and the Copy to Output Directory is set to Copy always. When I publish, I see all the xml files in my content folder; however, when I install using ClickOnce, these files are missing. What am I missing?

The problem was in the project settings->Publish->Application Files... the xml files under Publish Status must be changed from Data File(Auto) to Include.

Related

Hosted macOS Preview deploy ipa to App Center

I have set up a hosted mac os preview build for a Xamarin app. All the steps complete except for 'deploy ipa' The publish artifact says nothing will be added. Here is are the settings from the copy files to as well as the output
Seems you set the incorrect Source Folder or Contents pattern in Copy Files step. That caused no files were copied to target folder for publishing.
Please check the logs of Copy Files step to see if the *.ipa files are really copied to $(build.artifactstagingdirectory).
If no files copied, then just check the build logs to get the real working directory (Source Folder in copy step) and make sure the *.ipa files are generated in the directory. (By default it's $(system.defaultworkingdirectory) on my side.)
If the real working directory is just the Source Folder $(Build.SourcesDirectory) you specified in Copy step, then the problem should be the contents pattern.
Contents specify minimatch pattern filters (one on each line) that you
want to apply to the list of files to be copied. For example:
** copies all files in the root folder.
**\ * copies all files in the root folder and all files in all sub-folders.
**\ bin copies files in any sub-folder named bin.

Copy app.publish folder in VSTS Build/Release

Similar to the question here: Copy one file in target directory on deploy from visual studio team services, I am trying to copy the contents of the app.publish directory of a ClickOnce application via VSTS build/release.
This is the Copy Publish Artifact step of the Build
This obviously outputs everything in the bin folder to the drop folder on the server share.
This is the Copy Files step of the Release
This copies only the files in the app.publish folder but it builds out the entire hierarchy to the folder app.publish folder; however, it builds out the full folder structure. i.e. bin\Release\app.publish or bin\Debug\app.publish.
I like the idea of being able to publish and store different configurations (debug/release) but I don't like that I'm having to specify the InstallUrl in the msbuild arguments in order to pick up debug/release in the folder path. Even if I didn't try to maintain multiple configurations, the configuration would still be in the path.
So my question is: Is there a way to use the copy files task to just copy the app.publish folder and/or the contents to another location, without it creating the full hierarchy?
You need to specify the copy root in Source Folder of Copy Files, in your example, the copy root should be like:
Source Folder: $(System.DefaultWorkingDirectory)\$(Build.DefinitionName)\bin\$(BuildConfiguration)\
Contents: **\app.publish\**
In this way, you should only have app.publish in your Target Folder.
Configure the "Copy Root" of "Copy Publish Artifacts" step in your build definition to the path of build configuration folder and "Content" to "**".
For example, if the path of your build output is:
C:\a\1\s\SolutionFolder\ProjectFolder\bin\Relase\app.publish...
You can set the Copy Root to:
$(build.sourcesdirectory)\SolutionFolder\ProjectFolder\bin\$(BuildConfiguration)
And Content set to:
**

How to automatically copy files in building project with Visual Studio

I have some custom made XML files and a read me file that I've included in my project.
How do I make it so that these files are copied to my debug/release folders automatically when I build my project? I've tried setting the Copy to Output Directory property to "Copy Always" but this doesn't seem to do the trick.
I'm using VS2010
I've found the answer. The build action needs to be set to Content if you want to just directly copy the file to the output folder.

Deploying a Content File *Link* for a VS2008 Website project

I have added an Xml configuration file to a web project in VS2008 using the “Add as Link” option on the “Add Existing Item” dialog. The Xml file is common to a number of other web projects within the solution so it exists in the Solution level directory. I have used the file link functionality to avoid a unique copy being added to each web project.
SolutionFolder
SharedConfigSettings.config
WebProject1Folder
WebProject2Folder
Problem
The problem is that the linked file is not deployed. I need the file to be copied to the root of the web application so that it is in the same location as the web.config file.
I have tried
1) Setting the file properties on the link as...
Build Action: Content
Copy to Output Directory: Do not copy
...results in the file not being copied at all
2) Setting the file properties on the link as...
Build Action: Content
Copy to Output Directory: Copy always
...results in the file being copied to the Bin directory below the web application root.
3) Post build event to copy the file. This works but is messy to implement because it requires additional steps to get this to work on the build server.
Is there a way that this can be done using the standard options available in the project file?

VS2010 "Copy to output directory" not working?

I'm trying to publish my web solution to the file system, using the "Only files needed to run this appllication" option.
I have the following problems:
a) I have a connectionStrings.config file that should be included; I've marked this file as Content and Copy Always.
b) For testing purposes, I've added a textfile.txt that should not be included; I've marked this as Content and Do Not Copy.
Both of these settings fail...
It seems that the setting "Copy to output directory" is simply disregarded.
Any ideas why this happens, and what to do about it?
The "Copy to output directory" is for when you are building your application, not publishing it.
This property specifies the conditions under which the selected source file will be copied to the output directory. Select Do not copy if the file is never to be copied to the output directory. Select Copy always if the file is always to be copied to the output directory. Select Copy if newer if the file is to be copied only when it is newer than an existing file of the same name in the output directory.
Source
There's more information on publishing web sites and applications here
I had the same problem, that files marked as content, with "copy always" set, were not appearing in the output dir.
At the time i noticed this, i was tracking down why certain of my dlls were not getting deployed.
Sorting my project dependencies fixed both issues.
I just had this problem and for some reason choosing "Create application without a manifest" under the project's properties finally copied the linked content file to the build directory.
I re-started my visual studio and select the "copy always" option again. Rebuild and worked.
Good Luck.

Resources