Visual studio 2015 tfs add files to source control - visual-studio

I have the following issue-
On Team Explorer - Pending Changes there is an option that automatically detects added files to folders that are under source control. The problem is that more than 50,000 files are detected.
Is there any way to edit this list? to remove items I don't care about so it will be relevant when I do have files I want to add?
(I know I can add items in the Source Control but I want to make this option usable)

You can click the 'Detected' link to pop up the "Promote Candidate Changes" dialog, then select the files you want to check in to promote.
If you're using local workspaces, you can add a .tfignore file to ignore the files which you don't want to be detected in source control. eg: ignore by file extension .txt, then all the .txt files will be ignored in source control. They will not be detected.
Please see Customize which files are ignored by version control for details.
Please note that with TFVC you need to put .tfignore in every solution root.
.tfignore file rules The following rules apply to a .tfignore file:
# begins a comment line
The * and ? wildcards are supported.
A filespec is recursive unless prefixed by the \ character.
! negates a filespec (files that match the pattern are not ignored)
.tfignore file example
######################################
# Ignore .cpp files in the ProjA sub-folder and all its subfolders
ProjA\*.cpp
#
# Ignore .txt files in this folder
\*.txt
#
# Ignore .xml files in this folder and all its sub-folders
*.xml
#
# Ignore all files in the Temp sub-folder
\Temp
#
# Do not ignore .dll files in this folder nor in any of its sub-folders
!*.dll

Related

SonarQube: Ignore files in current (root) directory

The documentation of the project, instructs on how to e.g. exclude (or include) in an analysis process, say all files under a directory:
mydir/**/*
or all files with a specific extension (say .js) under a directory:
mydir/**/*.js
But what is the way to exclude all *.js files in the current (the root) directory.
I have tried the following patterns. do not seem to work:
sonar.coverage.exclusions=./*.js
sonar.coverage.exclusions=*.js
The multi-directory pattern, **, can be used at any point in the regex.
To exclude all .js files, you would use: **/*.js
To exclude .js files only in the current directory: *.js
However
You should not try to set these values in your analysis properties. Doing so correctly is tricky. Use the UI to set these values instead.

How to ignore _vti_cnf and _vti_pvt folders in the nominated folder and all sub-folders of nominated folder?

I have this in my .gitignore file located in the root of my repository:
# Expression Web tracking files
/Help/_vti_cnf
/Help/_vti_pvt
But it turns out I need to ignore these two folders in any sub folder of Help or below. See:
How do I modify it to do that?
There is no path which starts with /Help/_vti_cnf, thus no files are ignored. Change to /Help/PublisherDatabase/_vti_cnf, /Help/*/_vti_cnf (all direct subfolders contining _vti_cnf), /Help/**/_vti_cnf (all subfolders containing _vti_cnf) or _vti_cnf (ignore _vti_cnf everywhere).
For more information see https://git-scm.com/docs/gitignore

Merge PDF files from multiple folders with same filename

I am looking to merge PDF files from two separate folders into a third folder, based on file name.
Directory structure:
FOLDER_1 = File set #1.
FOLDER_2 = File set #2.
MERGED_PDFS = Output of merged files.
FOLDER_1 contains a set of PDF files which could be named with any combination of letters, numbers and allowed symbols.
FOLDER_2 contains a set of PDFs with the exact same names as FOLDER_1. The data on these sheets is different. The files from FOLDER_2 need to be inserted into the files from FOLDER_1, at the end of the file.
The output of this merged file will be placed in the MERGED_PDFs folder, retaining the name used to match the files in FOLDER_1 and FOLDER_2.
Example:
FOLDER_1: R000135322.PDF
FOLDER_2: R000135322.PDF
MERGED_PDFS: R000135322.PDF
(MERGED_PDFS contains a merged PDF from FOLDER_1 & FOLDER_2, with the PDF from FOLDER_2 being placed at the end of the PDF in FOLDER_1.
I saw some similar examples of this being done with PDFtk, but unsure how to edit to get my expected output.
Thanks
Here's what you need to do:
Install FolderMill
Specify the Incoming folder and the Output folder for FolderMill on your PC
Since you mention that files in FOLDER_1 and files in FOLDER_2 have the same filenames, just add "Convert to PDF" action and select Multipage: "Append pages to existing document" in the options.
Click Apply changes
Start FolderMill by pressing the Play button.
Grab the files from FOLDER_1 and put them into the Incoming folder
Grab the files from FOLDER_2 and do the same.
Receive the merged PDFs from the Output folder
If the you are not sure if all the corresponding files have the same filenames, you may also need to use the "Rename" action.
FYI, we have a detailed step-by-step guide how to do it (with screenshots).
You are welcome :)

ProjectItems.AddFromFile Adds File to Pending Changes

As part of my nuget package, I have an install.ps1 powershell script that I am using to add a reference file to the project (a couple text documents) from the package's tools folder.
Everything is working great, except that when the files are referenced in a TFS solution, they are added to the Team Explorer Pending Changes. How can I remove them from pending changes (or keep them from ever showing up)? I don't want these checked into TFS, since the packages folder shouldn't be there in the first place.
Here's my install.ps1 script:
param($installPath, $toolsPath, $package, $project)
#Add reference text files to the project and opens them
Get-ChildItem $toolsPath -Filter *.txt |
ForEach-Object {
$projItem = $project.ProjectItems.AddFromFile($_.FullName)
If ($projItem -ne $null) {
$projItem.Properties.Item("BuildAction").Value = 0 # Set BuildAction to None
}
}
If you're using local workspaces (TFS 2012+) you can use the .tfignore file to exclude local folders and files from appearing in the Pending Changes page in Team Explorer.
You can configure which kinds of files are ignored by placing text file called .tfignore in the folder where you want rules to apply.
.tfignore file rules
The following rules apply to a .tfignore file:
- \# begins a comment line
- The \* and ? wildcards are supported.
- A filespec is recursive unless prefixed by the \\ character.
- ! negates a filespec (files that match the pattern are not ignored)
.tfignore file example
######################################
# Ignore .cpp files in the ProjA sub-folder and all its subfolders
ProjA\*.cpp
#
# Ignore .txt files in this folder
\*.txt
#
# Ignore .xml files in this folder and all its sub-folders
*.xml
#
# Ignore all files in the Temp sub-folder
\Temp
#
# Do not ignore .dll files in this folder nor in any of its sub-folders
!*.dll
Details: https://www.visualstudio.com/docs/tfvc/add-files-server#customize-which-files-are-ignored-by-version-control
I finally figured out how to do it using tf.exe. Calling tf vc undo with the full filename will undo pending changes for those files. And if the folder isn't tied to TFS, no harm done. It just continues on.
This implementation does require VS 2015 to be installed (due to the hardcodes path to the IDE folder), so I'm looking for a better way to obtain the IDE path of the currently loaded IDE. For now though, this solves my current issue.
param($installPath, $toolsPath, $package, $project)
$idePath = "$env:VS140COMNTOOLS..\IDE"
$tfPath = "$idePath\tf.exe"
Get-ChildItem $toolsPath -Filter *.txt |
ForEach-Object {
$projItem = $project.ProjectItems.AddFromFile($_.FullName)
If ($projItem -ne $null) {
$projItem.Properties.Item("BuildAction").Value = 0 # Set BuildAction to None
$filename = $_.FullName
& $tfPath vc undo `"$filename`" # Remove File from TFS Pending Changes, as AddFromFile can automatically add it
}
}

VISUAL STUDIO, MFC PROJECT

I am running a third party sample MFC project:
In the "Output" tab of a successful build, this is shown:
1> MDIBars.vcxproj -> C:\Program Files (x86)\BCGSoft\BCGControlBarPro\Samples\MDIBars - Copy'\'.'\'..\Bin\MDIBarsD.exe
(I had to add two pairs of ' to get it to post correctly)
What does this mean? Specifically, the ".\" & "..\"
I know that .\ is the directory the .sln is in...
I know that ..\ means one up from where the directory the .sln is in...
The directory just before the .\ is the location of the .sln. So it appears there are identical consecutive directories in the file path? It looks recursive.
What am I missing?
The MDIBars Property Pages/Config Properties/Debugging/working directory is C:\Program Files (x86)\BCGSoft\BCGControlBarPro\Bin <\n new line>
The MSVS2013 solution file is here: C:\Program Files (x86)\BCGSoft\BCGControlBarPro\Samples\MDIBars - Copy<\n to make this post clear>
The solution file is called MDIBars.sln
ProjectDir: C:\Program Files (x86)\BCGSoft\BCGControlBarPro\Samples\MDIBars - Copy
Notice they do not have the MDIBars Property Pages/Config Properties/Debugging/working directory where the project .sln file is located.
Any help is appreciated...Thanks,
that is just an artefact of concatenating paths automatically.
. means "current directory", .., as you noted, means "one level up".
c:\xyz\.\abc is the same as c:\xyz\abc and c:\xyz\..\abc reduces to c:\abc (think of it as going to xyz, then one level up and to abc)

Resources