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
Related
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
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...
I'm trying to add images to my tree nodes (ImageList.Add()), but just can't figure out a nice way of doing it.
I've read from MSDN help I should use System.Drawing.Image.FromFile(path). But cannot just get a file somewhere.
I'm building a DLL, and want it to be a single file, no bitmaps being copied together with it.
So I've read I should add Image files to the project and mark them with Build Action as "Resource".
Ok, but where do I get them??? I saw people using it in XAML files, but I don't have that.
Saw people using Resources.SomeName, but can't find those Resources class.
So....How do I do it?? I've got the files marked as resources, just need to add them to the ImageList.
By the way, I'd love to use the path relative to the Code File that is adding the images to the ImageList. But if not possible, just relative to the assembly root.
If you want to use file paths, for items that are in your project, you must set the "Copy to Output Directory" property to "Copy Always" or "Copy if newer", otherwise it won't be in the bin folder, and then you'll be trying to pass a path to a file that doesn't exist. Build action isn't all that important in this scenario.
If you want to use compiled resources, and reference them via the Resources object, see the rest of my answer. I assume you are using Visual Studio, 2005 or later.
To add an image as a compiled resource to a clean Windows Forms project, so that you can access it via Resources.SomeName do the following:
In Solution Explorer, under the windows forms project (mine is called WinFormsApplication1), expand the "Properties" folder. By default this folder should contain: AssemblyInfo.cs, Resources.resx, Settings.settings.
Double-click on the Resources.resx file. This will open an editor for it. You'll probably see a table of strings, with columns "Name", "Value", "Comment".
Click the drop-down arrow on the "Add Resource" button, and select "Existing File", which will allow you to browse to the image you want to add.
You should now see the image appear in a gallery of sorts. Mine has the name TestImage
Now when you edit the code (mine is Fom1.cs), I can access the image as a System.Drawing.Bitmap as Properties.Resources.TestImage.
To my mind, this is the best way to do images that you want compiled into the application. If you want user-added images, you'll need to use OpenFileDialog, or something like that to get your file path. Then the Image.FormFile() will be what you want.
I have written some code for saving an image to a folder in asp.net. My problem is that the image in the folder is white and is not the same as images added manually to the folder.
I used a simple asp.net fileupload control to save the file to the correct path. But the images dont display on the page and this is how the file icons look in visual studio.
Anybody know why this is?
Try Right-clicking the images and select "include in project"
edit
If you want to do that programmatically you need to modify the project file programmatically; that's all there is to it. It's an XML file with nothing special about it. Note, however, that you have this under source control and you'll probably need to do more than just modifying the project file (ie adding the file to source control too)
Yes, it is. Because it is not included as part of the project files.
Try this:
There isn't anything else that is wrong. Only the files are not tracked by VS, so they won't be published. Your files are still completely accessible from your code.
In my opinion, files like say images added to your web app shouldn't be part of the project.
You need to include them in the project by right clicking them and click Include In Project.
Furthermore, if you want these files to included in the build you need to go to Properties of each file and set Build Action as Content.
I have a resource file named rs.resx. In the Visual Studio designer, I can add an image to my resource file by clicking "Add resource" and specifying the path to my image file.
After adding the image, the image file itself is also copied to a folder in my Visual Studio solution named Resources. I would like all of my image files to be placed in a folder named Images instead. Is this possible?
This is a little tricky, but it is possible.
VS checks if the file added to a resource is already defined somewhere within your project. If it can't find it, it creates the folder Resources, puts a copy to the file there, adds this file to the project and puts a reference into the resource designer to this fresh copy of your file.
To avoid this behaviour you should add the file to your project before you add it into the resource file. If the file isn't somewhere within your project structure you can just create a folder, right click it, select Add file and before you click on the Add button of the OpenFileDialog, push on the little arrow next to the button and select Add as link.
Now the file resides on the place on your hdd wherever you like and the resource designer doesn't create a copy within your project file if you now add the file within the resource designer.
Maybe this little picture helps to find the Add as link button:
(source: modbusdriver.com)
That's just a subdirectory of your project directory. Your program doesn't use it at runtime, it should use the embedded resources. Anything you add to the .resx file gets copied there, not just images. But you can rename the folder if you really want to, right-click it and click Rename.
Instead of adding a .resx file to your project, I'd recommend you use the existing one. Project + Properties, Resources tab. Makes it very easy to retrieve the resource at runtime, just use Properties.Resources.Something in your code.