Exclude folder and all sub folders and files in Visual Studio Web Deployment Project - visual-studio-2013

In Visual Studio 2013, I am trying to exclude an entire folder from the MSI that is created. I tried to adding entries to the ExcludeFilter property of the "Content File from XXX (Active)" item but it doesn't appear to do anything.
I tried the following:
Exclude specific file: \Test\TimerWorker\1\Index.js
Exclude by wildcard: \Test\TimerWorker\1\*.*
Exclude by sub folder: \Test**\*.*
I also tried Googling for a solution and all I could find was about adding tags to the .csproj file but nothing has worked for me yet.
Edit 1:
I tried following the steps outlined in the following article but they made no difference. It looks like all I am able to do from the IDE is exclude files which are located directly under the root folder. Does anyone know how I can exclude an entire folder and all of its subfolders and files?
https://blogs.msdn.microsoft.com/webdev/2010/04/22/web-deployment-excluding-files-and-folders-via-the-web-applications-project-file/

First of all when adding files to installer project, you should add only primary output which will ensure to add only required dependencies.
:
Secondly, if any unwanted file show up in the installer project then you can simply right click and exclude, It will not be copied to destination.

Related

How can share code/files/folders between projects in same solution using Visual Studio?

How can copy all files and folders in 'Folder' from 'ProjectB' to 'ProjectA'
Solution
*ProjectA*
*ProjectB*
**Folder**
SubFolder
Files.extension
SubFolder
SubFolder
Files.extension
In visual studio i have created two different project in same solution.
I use AngularJS in both of projects, i have create some mine components for management data. Also i use AngularUI routing and i include all components as dependencies.
How can create a copy link for folder 'Folder' from 'ProjectB' that can include in 'ProjectA' ?
For now, i have duplicated all files, so if any change has been place in one project that include 'Folder', i must copy/paste folder 'Folder' to other project, so both projects have same files and code.
SOLUTION
In windows you can create linked folder from command prompt with this command 'mklink /D target source'. So any change to one file will bind to other always

How to have msbuild copy files to output directory across references?

Suppose we have a project A with output directory bin/ and a project B with output directory test/bin/. Project A needs to have a certain configuration file copied to its output directory. Currently, this is being done by adding a pre-build event that looks like
COPY /Y "$(ProjectDir)..\config.ini" "$(TargetDir)"
Project B has A as dependency. When project B builds, the binary resulting from A is correctly copied to the output directory of B, but the config file isn't!
How can we achieve that all files that A needs to have are also copied to the output directory of B?
What you want is a Link File. I've used these before to ensure that connection.config files are copied to multiple projects.
I created a sample solution that mimics your described scenario as seen below. The ConsoleApplication1 references the ClassLibrary1 project. In the solution, I created a solution folder config and added the shared config that needs to be copied.
In order to have a single file that is copied across multiple projects, you must create a single file, and then add it as a link to the projects that need it. This can be done by right clicking on the project, and choosing Add -> Existing Item.... You will see a dialog as show below and you want to choose the Add as Link option from the dropdown instead of just Add.
Finally, edit the properties for the linked file to copy it to the output directory.

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.

Visual Studio Test Project - Does not copy folder on deployment

Here is the problem:
1. Create a TestProject in your Visual Studio solution.
2. Open the .testrunconfig file and under the 'deployment' menu item, select the 'Enable Deployment' checkbox.
3. Now click on 'Add Directory...' button and add a folder which has some files in it.
4. Run the test project (use a dummy test).
Ok, now go check the TestResults folder: You will see that all the files got directly copied (to the top level)- the folder itself is not copied (with the files under them). This messes up my paths during testing. Can anybody tell how to get the folder copied instead of just the files underneath ?
Thanks.
Use the [DeploymentItem] attribute on the test classes that use it. You can specify a directory:
[TestClass]
[DeploymentItem("blahblah\\myDirectory", "myDirectory")]
public class MyTest
{
}
Note:
DeploymentItem is very slow when starting the tests. It seems to copy 2 files per second.
You can specify the attribute on a test base class. But it does not always work if you have more than one test project.
You can probably specify it on a TestClass that has a method marked with [AssemblyInitialize]. Then you have only to provide it once. Not sure, you have to try.
The source directory is relative to the solution location. This is hardly documented.
Open the .testsettings file in notepad. Now, you should see that for every folder to copy
<DeploymentItem filename="FolderName\" />
Change this to
<DeploymentItem filename="FolderName\" outputDirectory="FolderName\" />
The other option you have is to create another folder beneath the original folder, and then that folder will be deployed to the out directory. For example you can have this structure:
TestFolder/
TestFolder/TestDeployment/
And then in the testrunconfig you still select the TestFolder folder and the TestDeployment folder will be deployed to the out directory.
I just had this problem too today. I solved it by adding a folder called "deployment_files" in the project that contained the required folder. Then I put the required folder into the "deployment_files" folder. THEN, I opened the LocalTestRun.testrunconfig file under the "Solution Items" folder in the Solution Explorer. Went to the "Deployment" panel in the testrunconfig property window. Added the "deployment_files" directory to the deployment and voila. The folder within that was copied to the test results Out folder.

What's the easiest way to install 100s of files in a Visual Studio setup project

I have a standard c# application that acts as a GUI front end for a an "R" statistics engine. "R" consists of approx 600 files in approx 50 different folders and can be "installed" on a machine through xcopy deployment.
I would like to package up both the R engine and my c# gui into one setup.exe so that the user doesn't need to go and install R first and then my c# application seperately.
I know that I can produce a setup project and then add in the R files one by one but adding all 600 files will be very tedious!
Is there an easier way of doing what I want? Can I add the single R folder and automatically add the subfolders and files to save me adding them in one by one? Or maybe do an unzip procedure in my setup project which will unzip the R engine in one go?
You can simply drag/drop the folder in Windows Explorer into the File System view of your Installer vdproj. All the files and folders in the hierarchy will be added to your setup project.
Tip: If the folders are in SVN or similar source control, delete all the hidden folders before you do this! If you have PowerShell, check out
get-childitem . -include _svn -force -recurse | foreach ($_) {remove-item -recurse -force $_.fullname}
Or you can always use Windows Search to find all hidden directories in the hierarchy and delete them from the Results Window.
I couldn't work out the project file so what I did in the end was to zip up all the files I wanted to deploy, add the zip file to the application and create a custom Installer class to unzip them (using CSharp ziplib)
I think Badjer is most of the way there.
If your 600 files are part of a project and the "Build action" for each of these is set as content you can add all of these by simply:
Going to the setup project
Selecting Add > Project Output
Selecting the project the files belong to from the drop down
Selecting the "Content Files" option from the list below
Clicking OK.
You can check the files will be added to the appropriate place by going to View > File System on the setup project and checking that the content files output is being added to the correct folder.
The files will be added to the install directory in the same hierarchy as they are specified in the project they belong to.
Have a look at the project file. I believe is text based. You might be able to insert the file paths directly there with some copy-paste-replace.
One thing you could try is adding the R files as content in the C# project - then the setup project can just copy them over for you (make sure you configure the setup file to copy content files from your project, not just the primary output).
You can either add the R folders into the project manually, or set up a script to modify the .csproj file (it's just an XML file) - content items are represented by these nodes:
<Content Include="myfile" />

Resources