how i can check in assembly info in tfs?
i am using tfs CI and i have one work space, when i try to check in pending :
2017-09-10T17:37:40.3410618Z No files checked in.
2017-09-10T17:37:40.8732772Z There are no pending changes matching the
specified items.
changes, tfs log show no pending change, but my dll version is right.
i can see assemblyinfo files in visual studio pending changes.
i am using assemblyinfo plugin in CI and i am check in with powershell command:
Tf.exe checkin $/[path]/assemblyinfo.cs
When you build in VS locally, the file assemblyinfo.cs generated within the workspace (the project in source control mapped) and will be detected automatically in Pending Changes page.
But according to your description, you build with TFS, that means the file assemblyinfo.cs is not in source control yet. Unless you publish/add the output to the active workspace just like build locally with VS, then you can check in directly. Otherwise you have to add the file to source control first, then check in.
So, just try to run "tf status" command first, it will show you list of pending changes.
tf stat /collection:http://server:8080/tfs/Collection
If that file not been listed, just run tf add first, then tf checkin (You need to change directory to your mapped folder first)
Related
This relates to question,
TFS checkin error - could not find file
"When checking in my project I get the error:
Could not find file 'C\blah blah blah'.
I have a feeling this might be a file from an old project I deleted.
I have tried deleting my TFS connection and workspaces.
The Solution was:
This will happen when TFS has some changes staged that no longer exist on the file system. For instance, if you add some files in Visual Studio (which adds them to the changes list), delete them directly from the file system, then attempt to check in the changes, it will complain that it could not find the file(s).
To remove these changes from the list, you can open Source Control Explorer (View > Other Windows > Source Control Explorer) and either Delete the nonexistent files or right-click on the offending files and Undo Pending Changes.
You can also undo these specific changes from the Pending Changes panel in Team Explorer.
Follow up Question:
So my question is,
how do I conduct the equivalent of this in the TFS Server? It continuously happens multiple times on our team.
This works on a person's desktop, but whats the equivalent commandline in the TFS server, and can I incorporate this in my build steps?
You delete files from TFS in the wrong way. the TFS server doesn't know your local file system, if you deleted a file from your local folder the file still exists on TFS.
This is the reason for the issues and errors. if a developer wants to delete a file and he deleted the file from the local folder and then got the error Could not find file and to solve it he does "Undo pending changes" so the file still exists on TFS and when another developer see the file in his system he also deleted it locally and he also will get the error in the check-in.
So, if a developer wants to delete a file from TFS he needs to right-click on the file and "Delete" and "check-in". if he already deleted it locally he can do the "delete nonexistent files" and "check-in". now each developer when he does "Get latest" not will get the file.
You can also delete files with a tf.exe command line in the delete command:
tf delete [/lock:(none|checkin|checkout)] [/recursive] [/login:username,[password]] itemspec
During the build, you can add a command line/Power Shell task and run the tf.exe.
You can undo another person's changes from the commandline using:
tf vc undo /workspace:workspacename;owner $/project/path/to/file
You can get this information by calling:
tf vc status $/project/path/to/file /user:*
This allows you to remove pending changes from the server, though it won't cause the files to be reverted on the workstation of the developer in question.
Both commands offer a /recursive option to undo multiple files under a specific path at once.
If you're using Visual Studio 2015 or earlier, then you can use the TFS Power Tools to add a "Find by status" option to the Visual Studio Source Control Explorer. This has unfortunately not made it into Visual Studio 2017 and there are no TFS Power Tools for Visual Studio 2017.
The TFS Sidekicks offer a Status Sidekick screen, which allows you to query all files currently checked out for edit in server workspaces and allow you to undo them centrally.
Preventing the issue altogether
To prevent the issue altogether you have a few options. You can switch to Local workspaces, instead of server workspaces. Those auto-detect local changes and don't register changes on the TFS server itself. Read more about local workspaces.
You can perform the deletes from the tf vc command line instead of using other tools to delete files and folders, for example:
tf vc delete $/project/path/to/file
The delete command also has a /recursive option. Using this command will not only update your local folder, but will also update the server workspace.
In tfs, how do I get a list of files in my working directory that are being managed by tfs? I don't care if I've checked them out or not (if I did, tf status would be the obvious choice). I just care whether or not tfs is tracking changes for them or not.
I want to use this like I use hg locate for Mercurial. I want to search through all the files that are not temporary files or build products of some kind, things that are part of the base source code, for something that shows up in the build products, but I don't know where it comes from.
Try to use LocalVersions command. (The newly be added file won’t be list)
You could use tf workflod command. Which could displays information about the mappings between your workspace folders and the folders on the server for Team Foundation version control.
The following command displays the working folder mappings for the workspace in the current directory:
C:\projects>tf workfold
If you want to list the working folder mappings for a different workspace, you can specify the /workspace:workspacename parameter.
C:\>tf workfold /workspace:My_Other_Workspace
Required Permissions
To use the workfold command, you must be the owner of the specified or implied workspace or have the global Administer workspaces permission set to Allow.
I would like to set the option File Time = Checkin on workspaces that are created with the tf.exe workspace command. In the Visual Studio 2013 Workspaces editor there is a field for this setting in the Advanced section and it defaults to Current Time.
The build server is creating workspaces with tf.exe and getting the code which then timestamps all the files to current time but I would like them to be time stamped with the last checkin time.
Is it possible to set this option on the command line so I that can include it in my build process?
BTW: If I get the timestamps to match last checkin I can speed up the copy process when deploying my websites by only copying the newer files. Currently it just copies everything even it is has not changed because the timestamps change on every build.
You can configure the file time setting with the filetime option. For example:
tf workspace MYWORKSPACE /filetime:checkin
I've been running into problems queuing a build to a TFS Build Server with a specified shelveset. I'm running TFS 2012. I have a visual studio solution with many projects. I'll open the solution, make a change to a few .h header files in a few of the projects, and then make a shelveset for that changeset.
Next, I queue a build to the TFS server. In the build definition, I select the shelveset that I just created. However, when the TFS Build server processes that queued build, it behaves as if it ignored the shelveset. When the compiler processes those projects that have the modified files, the header files in the sources folder do not include the change in the specified shelveset.
Here's the interesting bit. I've watched the files created on the build server as the build is processed. When the sources folders are first created and populated, the changes in the specified shelveset are present. But by the time the build process gets to the relevant project files, the source files have been changed back to the version without the shelveset change.
As far as I can tell, the latest version of the source plus the selected changeset was copied to the build server, but when a build error occurred, the sources were replaced with the latest version only.
Not sure why that happens. When it first occurred it looked as if the sources were changing from 'latest+shelveset' to 'latest' before the build error. Now that I know that's not the case, I'm not going to worry about this any longer.
I need help resolving the following issue:
I am attempting to unshelve code from the source branch onto a target branch.
I am using the following:
VS2012 RC
TFS 2012
VS2012 x64 Cross Tools Command Prompt
When I use the command prompt to perform the unshelve operation, the following occurs:
Shelveset details dialog gets displayed with list of change files.
Click Unshelve button.
Observe command prompt output: "An item with the same key has already been added."
I have downloaded ServicePack1 for power tools.
However, I have failed to resolve this issue.
I had the same issue and fixed it when I re-shelved the changeset from the source branch but chose not to preserve pending changes locally. After this the migration of the new shelveset ran smoothly.
(I also made sure I'd followed the below steps collected from other answers on this site)
Use a workspace that encompasses both source and target branches
Run the command from the folder mapped to the source branch
Check for quotes around any paths containing spaces
Deleting the cache in C:\Users[USERNAME]\AppData\Local\Microsoft\Team Foundation\4.0\Cache and restarting Visual Studio
I had the same error when using Visual Studio 2013 and the following command:
> tfpt unshelve /migrate /source:"$/Root/Solution" /target:"$/Root/Branches/Solution" "The name of my shelveset"
> An item with the same key has already been added
Research
Here's what I tried to fix the issue:
Clearing the Cache as per Andrey's answer
Try running the command from the Source -> Branch and Branch -> Source
My workspace already encompassed both source and target branches
Solution
Open up your equivalent of the VS2013 x86 Native Tools Command Prompt.
Check you have Team Foundation Power Tools installed:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\tfpt
Ensure you have 0 Pending and Excluded changes.
I had some Excluded changes which were detected but not added and this is what caught me out. Excluded changes should look like this:
Note: No "Detected: XX (adds)" - should not be visible
When you run tf status, you should see something like the following.
Either 1 change(s) for the .tfignore file or 0 change(s). Anything else will upset the merge.
C:\tfs\Root\Solution>tf status
File name Change Local path
$/Root .tfignore edit C:\tfs\Root\Solution.tfignore
1 change(s)
Ensure you are running the tfpt command from the source Solution directory
You should be now be able to successfully merge a shelveset from one branch to another.
Note on .tfsignore:
If you have a lot of pending changes that you don't want to undo for whatever reason, then
a modification to the .tfignore file is ok.
If this is the only file that you have left with changes, it won't brake the merge.
.tfignore reference => stackoverflow - How to ignore files/directories in tfs?
Try to undo all changes on Source and Target branch and then try again...
Try to delete all the files in the following folder and restart VS2012 (Source):
C:\Users[USERNAME]\AppData\Local\Microsoft\Team Foundation\4.0\Cache