I have a number of projects that include certain files that I use for creating block diagrams, etc. (*.graphml, *.doc, *.docx to be exact). While I have setup the files to 'open with' the appropriate editor, I have to manually check them out in TFS to make them 'writeable' It seems that there should be a way to have TFS check the files out automatically like it does for code, xml, etc. How can I go about achieving this??
NOTE:
My TFS options are set to 'automatically check out' files, to no avail.
Programs are required to have their own integration with TFS to be able to perform a Check-out of the files when needed. Opening Files in applications that are not "TFS Aware" requires you to check them out in Visual Studio or Explorer + TF Power Tools before you start wok on them. Even opening SQL files with SSMS, if they are not in a database project, requires you to perform a Check-out.
Some applications can work with TFS via MSSCCI (Misky), but these are mostly programming tools (IDE's etc) as far as I know.
This will all be fixed in TFS 2012 with the introduction of Local Workspaces.
Go to Tools>Options>
Select Source Control under options.
Select Environment under Source Control
There is a section called 'Checked-in items'
for the Editing dropdown select ' Check out automatically'
Related
We have a scenario like this:
We have ~100 solutions containing 10 projects each.
Each solution copies its artefacts (i.e. its 10 dlls) to a shared single folder like C:\code/assemblies.
If I develop something for feature X, I'll open up SolutionX.
The source for all solutions/projects is local in a single Monorepo C:\code.
During debugging, when the method/class/whatever is implemented in project Y, it opens the corresponding file (which is nice). So there must be information available how to get to the source.
But when developing, I cannot navigate to the implementation e.g. by using F12 ("go to definition") but just get the signatures gathered from meta data. I'd like to have the same experience like during debugging.
So right now I open up a Visual Studio Code, open the folder containing the sources and do a "search in files".
Any better ideas?
N.b. Resharper is not an allowed option. Also doesn't play nice with Postsharp.
N.b. I don't know if it is important but all except one solution start an external program (the shell), since all except one solution contain only dlls.
I have done similar in Old project.
You can use Symbol with Visual Studio 2019. Simple steps can be:
A. Generate Symbols for projects :
In Solution Explorer, select the project.
Select the Properties icon (or press Alt+Enter).
In the side pane, choose Build.
In the Configuration list, choose Debug or Release.
Select the Advanced button.
In the Debugging information list, choose Full, Pdb-only, or Portable.
Refer for more information:
Set debug and release configurations in Visual Studio
Publish symbols for debugging
B. Use Symbol in Visual Studio:
In Visual Studio, open Tools > Options > Debugging > Symbols (or Debug > Options > Symbols).
Under Symbol file (.pdb) locations,
To use the Microsoft Symbol Servers or NuGet.org Symbol Server, select the checkbox.
To add a new symbol server location,
Select the + symbol in the toolbar.
Type the URL (http), network share, or local path of the symbol server or symbol location in the text field. Statement completion helps you find the correct format.
Tools - Options - Debugging - Symbols page
For more Details refer:
Configure symbol locations and loading options
I think you should analyze project dependencies (for example with https://www.ndepend.com/docs/visual-studio-dependency-graph ) and cluster your projects in less Solutions
Edit : I am editing this answer based on your comment. I think you are looking for two use cases
Peek into the source code of referenced binaries
Navigate to the source and then edit them in place
To achieve option (1)
In Visual Studio 2019, use the built in decompiler to help you with navigating to code outside of the solution. This is an experimental feature as of May 2020. By default this is disabled and you should enable it. Once enabled the F12 navigation will decompile and allow you to peek into the source code.
On the other side, the more you relax the compilation the better the decompilation. Meaning, you can turn off optimisations (if any). This doesn't have to do anything with symbol generation options.
If you are using visual studio 2017 (or) less, the same can be achieved by Telerik Just Decompile plugin (free). Check the feature View decompiled code in tabs
To Achieve option (2) :
You should reference source files rather than binaries, because you won't get the natural in-place edit with referencing binaries. There are always going to be caveats irrespective of the solution you choose. Referencing source can be done using the "Add as link" feature in Visual studio, where the source code belong to one solution and can be referenced as link (something like windows shortcuts) in all the other solutions. (https://andrewlock.net/including-linked-files-from-outside-the-project-directory-in-asp-net-core/). If you are referencing source, you need to remove the binary references.
And you also have to decide from an architectural standpoint on how this changes the way people develop and commit code. The point of referencing binaries is to make sure they are not edited for convenience, but that depends on the nature of the development team purely.
Conclusion
From a best practices standpoint, you either have to reference binaries and don't allow them to be edited (or) you allow source references and edit in place. But that depends purely on what you want to achieve.
We just implemented TFS in our company and I accidentaly included the bin and obj folders. I would like to exclude them. I searched on Google and found basically 2 ways to accomplish this:
1) https://msdn.microsoft.com/en-us/library/66tw9ezk(v=vs.90).aspx
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.
In my File>Source Control, I don't see exclude from source control there or under advanced.
2) How do I permanently exclude the bin and obj folders from TFS 2012 checkin?
I tried adding a .tfignore and I couldn't find the 'ignore by extension', 'ignore file', etc. in teh Promote Candidate Changes dialog box. As far as I understand this is only applies to a local workspace and not a server workspace.
We set up the solution to checkout a file whenever it's altered, so when someone builds the project he acquires an exclusive lock on the dlls and then nobody else is able to compile.
After the steps Mike describes, you can go further and define an ignore rule. Undo the pending changes to the file you want to exclude and then click the "detected: 123" link that shows under "Excluded changes".
This open up a new window in which you can ignore these changes indefinitely. It does this by creating a .tfignore file and adding that to source control. The alternative to the UI is t create this file manually and checking it in. This should prevent Team Explorer from showing files that match the patterns in the ignore file.
Make sure that these files are deleted from source control, if they were checked in accidentally, you can destroy them to make sure they are truly gone. You'll need to do this from the commandline using tf destroy
The call to Destroy won't delete your local files when you use the remote itemspec to destroy them:
C:\>tf destroy /collection:http:
//jessehouwing:8080/tfs/DefaultCollection $/Scrum/test.txt.txt /noprompt
Destroyed: $/Scrum/test.txt.txt
C:\Program Files (x86)\Microsoft Visual Studio 14.0>dir "c:\Workspaces\Local\Scrum"
Volume in drive C has no label.
Volume Serial Number is 008A-AC5B
Directory of c:\users\jhouw\Source\Workspaces\Local\Scrum
12-08-2015 20:12 <DIR> .
12-08-2015 20:12 <DIR> ..
12-08-2015 20:12 0 test.txt.txt
1 File(s) 0 bytes
2 Dir(s) 297.229.512.704 bytes free
After performing a tf get /collection:http:
//jessehouwing:8080/tfs/DefaultCollection $/Scrum /recursive it will indeed be deleted. This should not be an issue if the files in question are regenerated during the next build.
See also:
https://stackoverflow.com/a/21260759/736079
If you're using a server workspace, the only way I can think of is to set a Forbidden Path checkin policy for your source control repo. It's a part of the Team Foundation Server Power Tools; you'd need to install the version of the power tools that matches your Visual Studio version on all developers' machines.
Note: these use Regular Expressions, so you'll need to adjust your pattern to match ;).
From my personal experience, the easiest way to achieve this is the following:
View -> Team Explorer (Ctrl+\, Ctrl+M)
Click on Pending Changes
In your Included Changes list, right click on the desired folder.
Click Exclude.
The excluded change should now appear in the Excluded Changes list below.
I am working on a conversion from Accurev to TFS and am being blocked by Accurev's usage of symbolic links, which TFS does not work with. I have tried several methods, but they all seem to fail to work.
What I would like to do is have a file in the project/branch that lists all the linked files and folders that is stored in source control. On every get operation, I would like to read this file and link the folders and files specified in the central file. However, I cannot find a way to extend the get operation. Does anyone have any experience in extending it in VS?
TFS does not provide a way to extend what happens on a Get action. You could easily create a custom powershell or batch file that you use in place of calling tf.exe, but since Team Build and Visual Studio call into TFS directly using the Client Object Model you're not going to make this easy on yourself.
In the end everything is possible of course. You could write a custom build action for Team Build to replace the standard get operation, or create one that triggers after the standard get operation has completed. You can write a vsix visual studio extension that replaces the standard Get operation everywhere in the menu's of Visual Studio and get to a something that could be considered workable. But I would not recommend this. It is far from standard and it is far from sustainable. You'll have to unwire so much default behavior in Visual Studio (that checks out files that are changed, adds files to source control when they're added to the project file etc etc etc).
SourceSafe used to have this feature as well (it was called pinning) and Microsoft removed it when they created TFVC. They now recommend you use branching and merging to synchronize these files across multiple projects, making sure that the source structure in Source control is the same as the ones on disk during build.
You can also make use of the Add-as-Link option in your project files. This allows you to keep the original files in their original location, but MsBuild will understand that in the project structure this file actually lives somewhere else. Or package the linked files up in a NuGet package and use the Dependency Management using NuGet guide to help you place the files in the right location during build.
And finally, you can get very creative using Workspace Mappings, many people never get further than mapping $/project -> $(SourceDir), but in essence the workspace mapping is like the file you describe. A way to layout your sources from Source control to disk. You could do:
$/Project/DEV/MyProject -> $(SourceDir)\MyProject
$/Project/Shared/FilesToCopy -> $(SourceDir)\Shared
And you can even add files from other projects in the same collection:
$/AnotherProject/Shared -> $(SourceDir)\MoreShared
And something not many people know, you can layout individual files:
$/AnotherProject/CompanyAssemblyInfoItems.cs -> $(SourceDir)\CompanyAssemblyInfoItems.cs
The only thing you cannot do, is map files to be children of an already mapped folder. In that case you might need to have the workspace mapping do the fetching of the sources and then a .targets file that you include in your .csproj file to do the copying of files.
I am new to Team Foundation server and someone committed changes that they weren't supposed to the night previous. I need to revert this changeset so that when people get latest version they will not get these changes.
I see no easy way to do this, does anyone have experience with this?
You can't really rollback a changeset. What you have to do is:
Find the changeset number you want to get back to.
Perform a check-out of all the files that is in need of a rollback.
Perform a get specific version (different from get version) and specify the changeset number and select the options to overwrite your local copy with what's in the changeset.
Perform a check-in which would overwrite what is on the server.
You have to do this separately for every file. There you can look at the TFS Power tools which has a rollback that kinda automates the manual steps listed above.
Good luck!
I think you are looking for the rollback command:
Rollback docs
You can do this easily in VS2010 via a nice interface, in a similar way you'd do it with Tortoise SVN, as long as you are also using TFS 2010 on the back-end (make sure this is the case before you try the following, otherwise it won't work):
Get the Team Foundation Server Power Tools December 2011
(You may need to restart your computer after the install)
Then in VS2010 go to View > Other Windows > Source Control Explorer
right-click the project from the Source Control Explorer window and select 'Rollback' - this gives you the rollback dialogue shown in this article (read this from the section titled 'Rollback Available in the UI Now', it gives you all the remaining detail to get you in the right direction).
The interface is a little clumsy, but should do the job.
Right click on your code in Team Explorer and click on view history then select your files one by one and right click on files choose get specific version and then a model window would open. Change type combobox value latest version to changeset number and revert the latest code to previous changeset.
Hope this helps....
You can accomplish this from the Visual Studio Command Prompt and you don't even need to have a local copy of the code:
# create a temporary folder
mkdir some-workspace && cd some-workspace
# create a temporary workspace
tf workspace /new /collection:http://tfs-host:8080/tfs/some-collection some-workspace
# negate a specific changeset
tf rollback /changeset:some-changeset
# check in the rollback
tf checkin
# delete the temporary workspace
tf workspace /delete some-workspace
# delete the temporary folder
cd .. && rd some-workspace
I have tried creating an install file but it never includes the database in the output, I have run into this problem a few times and most of the answers I find online are too cryptic for me to wrap my head around.
In the Project menu, select Add existing item, change the file type to Data Files and select your database. Then go to your project properties, in the publish tab, click the Application Files button and make sure your access file is include.
If you include your MDB as a resource (Properties -> Build Action -> Embedded Resource) you can extract it using: Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
See here for a complete sample (that also decompresses):
http://code.google.com/p/videobrowser/source/browse/trunk/MtnFrameGrabProvider/Plugin.cs