Visual Studio 2017 (v15.9.9).
I can't seem to figure out how to create a .tfignore file. If I do it manually, windows tells me I need to add a file name. And I am not seeing anywhere via the IDE to create one.
I'm used to GIT, where I can right click on a pending check-in file (that has changed) and just select "Ignore". But I don't seem to have that option, despite the fact that all the results I find via Google tell me that I should.
You can create your file as .tfignore.. The last dot will be removed automatically.
This can be solved using the same steps as How to create .gitignore file (just replace .gitignore with .tfignore):
Create the text file tfignore.txt
Open it in a text editor and add your rules, then save and close
Hold SHIFT, right click the folder you're in, then select Open command window here
Then rename the file in the command line, with ren tfignore.txt .tfignore
However, an easier/quicker way to get around this Windows Explorer error is by appending a dot to the filename without extension: .tfignore. will be automatically changed to .tfignore
the easiest way is to open command prompt and navigate to your project folder. Then
notepad .tfignore
after that just save file and you are good to go.
Or you can also use
echo "" > .tfignore
Note that you may need to manually include this file to TFS
Related
i am using visualstudio.com as TFS online and have created my code repo there.
In my project there is folder that comprises several subfolders and eachsub folder has several images (the total of all images is like 6000).
When i check-in my code I do not want the root folder (i.e. the parent folder of image subfolders) and its content to be checkedin?
I tried online for some answers but cannot find anything accurate.
Thanks in advance for your help.
You can configure which kinds of files are ignored by placing text file called .tfignore in the folder where you want rules to apply. The effects of the .tfignore file are recursive. However, you can create .tfignore files in sub-folders to override the effects of a .tfignore file in a parent folder.
To create the file, the easiest way is using the auto automatically generated .tfignore file, follow below steps:
In the Pending Changes page, in the Excluded Changes section, choose
the Detected changes link.
The Promote Candidate Changes dialog box appears.
Select a file, open its context menu, and choose Ignore this local
item, Ignore by extension, Ignore by file name, or Ignore by folder.
Choose OK or Cancel to close the Promote Candidate Changes dialog
box.
A .tfignore file appears in the Included Changes section of the
Pending Changes page. You can open this file and modify it to meet
your needs.
More info please check the Customize which files are ignored by version control from MSDN Link:Add files to the server
Method 1:
There's an easy way to do it, i.e. via the .tfignore file. Go to the root folder of your and tfs checkin and put following content in the .tfignore file. If the file is not there create it.
.tfignore
<rootfoldername>
Method 2:
To exclude a file from source control
In Visual Studio, open Solution Explorer and select the file to
exclude.
On the File menu, click Source Control, then click Exclude
from Source Control.
When you are ready to place the file under
source control, you can access the File menu and click Source
Control, then uncheck Exclude from Source Control.
Edit:
This question is a possible duplicate of
How to ignore files/directories in TFS for avoiding them to go to central source repository?
Edit:
Changed the file name to .tfignore
A small but very annoying issue I have:
In our current working way, all .config files are excluded from source control. Also a .tmpl file with the .config content is included in the source. So when I check out a project from source control I end up with:
[Triangle]Log4Net.config
Log4Net.Config.templ
In my solution explorer. Clicking on the Log4Net.config file (predictably) gives the error, "The item 'Log4Net.config' does not exist in the project directory. It may have been moved, renamed or deleted." Fair enough.
I am looking for a way to "make" that file, like for eg. right click force open, that will open a new empty editor window where I can paste in the content. (I can easily just copy it from the .tmpl file).
Anything like a plugin, or a keyboard shortcut or similar would be what I'm looking for.
Update: To clarify, the .sln/.csproj file(s) are checked in referencing the files. I check this out and open in visual studio. I see the yellow triangle moaning about missing files. Now I need to recreate these files, and I would like to use VS to do so...
What I want is make my setup project install same file in two different locations. When I try to do that, it adds that file again into my project which doubles the size of the .msi in the end. What can I do about this? Thanks !
When adding a file:
Go to add Existing Item
In the bottom left corner where it says Open drop the drop down box and select Link file
click ok
This will then add the file as a link instead of copying the file to your project directory
More info here
What you could do is to install the file at one place. Create a Custom Action that creates a copy of the file on the second place. Please take care that you remove that file as well at uninstall time.
I am creating an installer for my C# application, and I want to put a link to the configuration file into the start menu, so that users can open it for editing in notepad from the program folder in the start menu.
I seem not to be able to put a link to it however - does anyone know how to do this? (Really, I would just love to put "[targetdir]\myapp.exe.config but VS doesn't let me edit the field, only select from a file browser).
Many thanks,
Rob
I found the solution and it's pretty easy:
Add Project Output for your project in the setup project
Select Project Output from File System in left pane and go to the properties of the project output. Then add a filter *.config to remove the .config file from your project output.
Rename the app.config from your actual project to the output name that your App exe ([ProductName]) will have along with the config extension ofcourse.
Add the [ProductName].config to your setup project as a File.
Create a Shortcut to that file and add it in any setup folder desktop or program folder.
Voila.
You're all set.
Isn't the config file added in your installer? You should be able to select it when prompted for the shortcut target (the "Select Item in Project" dialog). Please note that in this prompt dialog you first need to browse to the folder which contains it (for example double-click "Application Folder").
If the config file is not added, you need to manually add it in "Application Folder". Only then you can create a shortcut to it.
Please note that Visual Studio doesn't support shortcuts to a specific file from a project output which generates multiple files. In this case you can try using a custom action which creates the shortcut through custom code.
I remember doing it in Vs2005 using as below:
File System Editor > Users Programs Menu
Add> Folder
Add file (Say Config file) point it to the its location
I have a main project directory with the following contents:
SubDirectory (Directory)
Project.sln (Solution File)
When I try manually changing SubDirectory's name in my Windows explorer, I get errors when I open the solution file. How can I rename this directory without affecting my solution?
Thanks!
Rename it in Visual studio, or edit the .csproj/.sln file with a text editor and fix the refrences.
Open the solution file in a text editor and rename all references to the old folder.
Open up the .sln file in notepad. You'll see a line like this:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "myproject", "myproject\myproject.csproj", "{DF81752F-37EE-4F4E-BC22-B09C8D05ED78}"
EndProject
If you want to rename the folder from myproject to newproject, you can change myproject\myproject.csproj to newproject\myproject.csproj (or whatever).
Change the name in SolutionExplorer.. it will work fine..
However it doesn't gurantee problem with Source Control or TFS you will need to resolve them manually
Your solution has the paths to your project files embedded in it, which includes the folder name. If you want to rename the folder, you have three options:
Close the solution. Rename the folder, then reopen the solution. The projects will show up as gray, and you'll need to click each one and locate the project file in the Properties window. Note that this may remove project references, but it may not. This is what I would suggest.
Open the solution and remove the project(s) within that directory. Note that this will remove any project references from any other projects that reference the project(s) that you're removing. Rename the folder, then add the project (and any project references) back.
Close the solution. Rename the folder, then open the .sln file in Notepad (or some other text editor) and fix the paths manually. This will preserve any project references.
When I have done it, I manually change it, then open the solution. You will get an error about not being able to find the project file, just choose to locate it, and it will re-map it. If you are using VSS, make sure everything is checked in first.
There are probably paths in project/solution related files that contain the old directory name. You'll either have to update those manually or find a way to rename the project from within Visual Studio.
This might help you rename the project:
http://msdn.microsoft.com/en-us/library/3e92t91t%28v=VS.90%29.aspx
In Visual Studio solution explorer,
edit the project properties to change
the assembly name, namespaces etc.
etc. to what you want.
Rename the top
Project nodes in VS solution explorer.
Shut Visual Studio down.
Open Windows explorer and rename your
folders and .csproj files to what you
want.
With a text editor and NOT Visual
Studio, open up the
sln file,
the .csproj files and
anything else you've renamed.
do a
Find & Replace looking for the old project strings, filenames,
namespaces (if required - I suggest
you leave that bit for when all has
been transitioned) and replacing them
as required.
I'm suggesting you'll
need to be selective because I don't
know how you've named your projects
and .csproj files ;-)
Once you've done all that, quit your
text editor and try opening up your
.sln file again.
Do a Rebuild the first time to remove any artifacts from the old configuration/naming.
HTH