This question is NOT answered at the link above...
I had some problems with TFS where visual studio builds on the local machine no problem, but when I try to build on the server I get build errors. The errors are not relevant to this question.
The issue I have is that in order to fix the errors I had to manually edit some of the files on my local machine, and since they were manually edited, TFS doesn't detect the change so it wont let me upload my change set to the server which would have fixed the problems there.
My first, and main question is:
How can I force TFS to copy all my local files to the server. Sort of like the reverse of the whole:
Goto View / Other Windows / Source Control Explorer / Right click on the relevant project / Advanced / Get specific version / Check "Overwrite all files..." / Press ok.
Which (arguably, cause it doesn't always get everything in my experience) gets a full file set from the server to the local machine.
I am so tired of TFS uploading partial file sets and then when the solution is removed locally, and then re downloaded from the server, I have to pull in the missing files and references from some backup. If it was uploaded fully, and correctly at the start, I would probably have less of these problems. So this is my main question. How do I force TFS to upload all my files regardless if they have changed or not according to it.
To explain further a problem I am having in particular with nuget package manager. I disabled the option "Allow NuGet to download missing packages during build". So locally I got actual build errors. Yes that's right, Build errors. like this...
Project XXX: Package restore is disabled by default. To give consent,
open the Visual Studio Options dialog, click on Package Manager node
and check 'Allow NuGet to download missing packages during build.' You
can also give consent by setting the environment variable
'EnableNuGetPackageRestore' to 'true'.
Which now forces me to re-enable this option to get rid of the errors. I am annoyed at this because such errors should be presented as warnings so as not to prevent a build. This is seriously disappointing and as a result I have a very poor opinion of NuGet.
Anyways enough ranting, I re-enabled this, not like I had a choice. But the version where this was disabled went up to the server. Now I get this error on the server. I tried re-enabling it and doing a check in, but TFS wont let me. (Warning...No pending changes). Of course not, its just a silly check box. What could possibly have changed. But now I get an error on the server that I cannot fix all because someone at NuGet didn't put some taught into properly designing their warnings (as opposed to preventing a build by causing errors).
So, once again, how can I force TFS to take all my files, changed or unchanged, verbatim, to the server. This way, when I fix a problem locally, it "should" fix it also on the server. Or at least, when I next download it, I am assured to have the whole file set.
Apologies if this sounds like I am being negative, but I am at this for 5 solid days and it has completely stopped development costing me and the company a lot of money. Any help would be very much appreciated.
There is no way to tell TFS to take everything in my file system. What you need to do is a multistep process. First Check Out the entire directory, this will not overwrite your manual changes but will allow you to check back in and have it detect those changes. Second, if any new files were created you need to add at the root directory and get all new adds. Lastly check in all of your changes. It really should be that simple.
If you are using TFS 2012, then Local Workspaces would be a good solution for you.
Just to be clear - Local Workspaces does not mean that your developers are working locally. All code is still under Source Control in exactly the same way with Server Workspaces.
Local Workspaces are new to TFS 2012 and would resolve your issue. The main advantage for you is that files are no longer marked read-only. This allows you to be able to edit them from anywhere (notepad, any other IDE, Visual Studio) without first doing a checkout. Visual Studio will then automatically detect that the file has changed and list it in the Pending Changes window.
Good article comparing the different types of workspaces: http://blogs.msdn.com/b/willy-peter_schaub/archive/2011/11/30/team-foundation-server-trying-to-understand-server-versus-local-workspaces.aspx
I like to use the Source Control Explorer window, then right click on a folder and choose Compare. You can choose to see what is different in the target folder, or what is a new file. The files that are different appear in red. You can then right click on them and check out and check in files, or use control-click to select more than one file at time.
Yes i know before the flames start to arise, this is not conventional....but working in unity I encounter this problem quite often. Literally dealing with it now as i updated to unity 5.5 and it fubared a lot of stuff in my current project. After the resolutions from unity, my project is completely out of sync... and for whatever reason vis stu refuses to monitor these changes... It is rather annoying to be sure, but not to worry as I have resolved it successfully every time over the iterations by doing the following:
create a backup folder in a separate location and copy the entire thing over.
It doesn't matter where you back up to as long as its in a unique separate folder. Be sure to copy FOLDERS not individual FILES as some files may be hidden.
do a full get of the latest version (according to TFS).
This can take some time and is why you back it up in a separate location. Be sure to KEEP VS OPEN AT THIS POINT!!!
overwrite ALL the files you "got" with the backup that you made in step 1.
The local work-space will monitor the changes to the files as you overwrite them with the backed up copy into your local space, and mark them as having pending changes accordingly if the new one has any difference.
update your pending changes to the TFS server in source control explorer. Any change detected during the overwrite will be added to the included changes section.
Voila you have forced your files, work, and will onto the TFS server!
Related
I am having issues with check in my code files because of some changes I have made to the project and solution. I have renamed project files, added different project files in the solution and added many files in the existing project.
Now I am getting an error while checking in the code.
The error details are:
Check In: Operation not performed Could not find file
'....Console.csproj.vspscc'.
How do I create a vspscc file if it does not get created on its own?
Any help would be great and thanks in advance.
This looks pretty stupid on my part. I restarted my Visual Studio and I could perform the check in because Visual Studio created the vspscc file when it opened the projects and solution.
Answering my own question as fast as possible so nobody else prints my own negligence before me.
And for anybody who needs an answer as how to create a vspscc file, restart the visual studio IDE
I have also seen this in another situation (VS2012) where a simple restart didn't do the trick.
I had a number of new projects which I had added to an existing solution but in the wrong place. Undoing and re-adding seemed to be fine until check-in, where it complained that the newly added projects and related .vspscc files could not be found. It was looking for them in the original location rather than where they are now.
Resolution was to go to the Source Control Explorer, which still had check-in items against these files in their original (but non-existing) locations, as well as the files in their correct locations. Selecting these errant references and "Undo pending Changes" for these files did resolve the issue.
I'd try using File/SourceControl/ChangeSourceControl dialog and unbind (if necessary) then rebind the project to TFS to recreate the .csproj.vspscc.
I removed projects and have same issue, so my solution was to re-create the same projects with same name, then remove them cleanly :-) I hope this helps
I had a similar problem, but in my case I Visual Studio/TFS couldn't fine the .csproj file. Anyway, with the help of a colleague I was able to determine that the issue was within TFS itself. TFS may have a different view of your source code than Visual Studio does. I had created the wrong type of project (I'll call it Proj1) and deleted it from within VS. Then created the correct project type, which I'll call Proj2. When I when to check it into TFS it complained about Prog1.csproj, which confused me because I couldn't see it within VS. What I learned was that you have to go into TFS's Source Control Explorer. From there you'll see how TFS sees things. Sure enough, there was Proj1.csproj (and some other related files to Proj1). What I had to do within Source Control Explorer was undo the pending check-in's of those files and folders which I didn't want to check in and no longer existed anyway. Then TFS was happy and I could perform the check-in.
I'll give you 2 versions of my problem to describe it, first the short version.
When I try to build my application it does that perfectly and my app works but when I try to rebuild it, that fails and gives an error message saying that 2 files are missing (bin/debug/MusicPlayer.exe and bin/debug/MusicPlayer.pdb). When I then try to build normally, it fails to with the same error.
Now the longer version:
The way this happened was quite out of nowhere, I program on 2 different locations (both in Visual Studio 2010 sp1) but to always have the recent version in the right place I copy the entire solution folder to a usb stick, this folder I copy over again on the other PC and use it to continue were I left off, I've done this many times without problem. Yesterday however, I got an exception while testing the app. But instead of showing this in my code, it was complaining that it could not find the program.cs file (it was there, but apparently it had a different checksum (md5) and it asked me to use this one. After a while I found what part of my code caused the exception and fixed it. Since then I haven't got that error anymore. But when I later tried to rebuild instead of build, it gave me the error described in the short version. I have tried to fix it, but apparently I was not very successful.
Basically, what I think it does is delete the files in the debug folder that need rebuilding and then gives me the error of missing files (the files that it deleted) and thus failing to rebuild succesfully because these deleted files the normal build option won't work to.
(What I then do is re-copy them from my usb to make the normal build work).
Don't know if it's important, but I program in C# and I'm still learning.
Also when I copied it to my usb I believe I had no errors and the app was working fine (except the part I fixed later, which I could not test at that location). And when I build the entire solution it gives some warning ==> "Assembly 'bun/debug/MusicPlayer.exe' is incorrectly specified as file" and this for 5 files.
Does anyone know how to fix this rebuild problem and if necessary the warnings?
Thanks in advance
(and sorry for my bad English)
OK it seems like you might be confusing yourself with your directory structure here. If you want to add Content or Resources (Images, Text Files, etc.) you should place them in a folder within your project (not called bin or obj). All your build files will go here. Instead place the Content in another folder and Right Click -> Properties and Set the build action to "Content" or "Resource" and set the Copy to Output Directory (bin folder) to "Do not Copy" or "Copy if newer."
The project is failing because you have the built executable "MusicPlayer.exe" in your project. So Visual Studio is trying to build an executable file in adding to the project. Restructure your directories or remove "MusicPlayer.exe" ever time your build your project.
Do you have any anti-virus software running? They can go way too aggressive on removable drives. You are actually continuously deleting and creating a runnable program on usb stick by recompiling.
Just a guess tho...
Sounds to me like you have a pre- or post-build event with a hardcoded path in it. Fix that using variables and it should be ok.
I recently converted from Vault to TFS for C# coding (language probably doesn't matter) in VS2010. My workflow used to be as follows:
If I don't want to check a file out or the file is already checked out by someone else, I simply remove the read-only attribute and start editing. At that point, Vault would stay out of my way. Later on, I would just merge my changes.
With TFS, by default, it wouldn't let me edit the file at all (because it checked out by someone else), even though I removed its read-only attribute. So I went into Tools/Options/Source Control/Environment and checked the Allow checked-in items to be edited.
This setting does allow me to edit the file, however, every time I press Ctrl-S to save it, it complains that the file is locked for check-out.
How can I get TFS to edit my files in peace?
You should have no issues unless the other person who is working on the file is locking it when they check it out.
My settings are as follows and work well for your situation:
Options -> Source Control -> Environment
Team Foundation
[] Get everything when a solution or project is opened
[] Check in everything when closing a solution or project
[] Display silent checkout command in menus
[] Keep items checked out when checking in
Checked-in items
Saving: Check out automatically
Editing: Check out automatically
[] Allow checked-in items to be edited
In the "Team Explorer" window right-click on your {Team Project} -> Team Project Settings -> Source Control
Make sure that "Check-out Settings" has [x] Enable multiple check-out
Also when checking out files make sure "unchanged" is selected such as in this screen shot:
from
http://social.msdn.microsoft.com/Forums/pl-PL/tfsversioncontrol/thread/4353d676-1794-4db0-9d9d-f2a231315980
There is nothing wrong with multiple people checking out the same file at the same time. That is a large part of why source control was created in the first place, so that this could be done. By checking out the file, and not just editing it locally outside of TFS's knowledge, you are also telling others that you are working on the file (useful information to have).
As stated earlier, unless the file(s) are checked out and locked nobody will be prevented from accessing or modifying the file.
There is a setting available for each project that will explicitly disable multiple check-outs if it is not selected.
If you have appropriate permission, in the Team Explorer... right-click on your project and choose "Team Project Settings -> Source Control...". On the "Check-out Settings" tab, there is a checkbox for "Enable multiple check-out". Verify that the option is checked.
If you're used to git (or are willing to give it a try) then I highly recommend git tfs. It gets rid of the whole annoying paradigm of having to clear readonly flags on files, as every file is effectively cloned from the TFS source tree into a git repository. Then when you push your changes back into TFS it marshals the changes back into a format TFS approves of.
For example
git tfs quick-clone http:tfs-server/tfs/yourCollection $/YourCode/YourBranch YourDirectory
checks out all your files from TFS into YourDirectory, you can then modify these files as you would any other files on your computer, then to send them back to tfs you can issue the commands
git commit -a
To check the files into git, then
git tfs ct
To push the files into the TFS repository. More details can be found here: https://github.com/git-tfs/git-tfs
I am creating a C# application using Visual Studio that uses an SQLExpress database. When I hit f5 to debug the application and make changes to the database I believe what is happening is there is a copy of the database in the bin/debug folder that changes are being made to.
However, when I stop the debugging and then hit f5 the next time a new copy of the database is being put in the bin/debug folder so that all the changes made the last time are gone.
My question is:
Is there a way that when I am debugging the application I can have it make changes to the actual database and those changes are actually saved or will it only make changes to the copy in the bin/debug folder (if that is what is actually happening)?
I've seen similar questions, but I couldn't find an answer that said if it's possible to make those changes persistent in the actual .mdf file.
The reason I ask is because as I build this application I am continuously adding pieces and testing to make sure they all work together. When I put in test data I am using actual data that I would like to stay in the database. This would just help me not have to reenter the data later.
Thanks in advance for any help or information that could help me better understand the process.
Select the databases in Solution Explorer and change the "Copy to Output Directory" to "Copy if newer". Later, when you finally get the final version, copy paste the databases in debug folder to your source folders
The problem with 'Copy if newer' is that when you make changes to any part of the structure of the database, that change is to the version in your Project directory and not to the version you are building on in the Debug directory.
Also, when you try a non-debug run you are not using the copy you have been chaging in the debug location.
I normally use a Postgresql, but as this is a new computer and I discovered MS do this Lite version, decided to give it a try. I have a lot of data which is historic that I want in the table, then some manual manipulation with a bit of SQL, Then I can carry on creating the actual functionality of the database.
You can not just copy the altered version into the project directory, because there is a log file and no one seems to know what is in there but Microsoft desperately need that to match your database file in some way. (I am guessing you already tried that too).
I didn't want to have to start from scratch every time I ran it, and just like you I found no solutions. So in a desperate move I copied the version in Debug to a tmp directory. Then deleted the version in the project solution explorer.
Then I dragged and dropped the version in tmp into solution explorer. (Everything in it is structurally the same as the original, except as stated below)
That did it, it recreated that Log file. Now my debug sessions start with a ready loaded data.
Words of warning.
1) Changing the database structure.
In your solution explorer, the the Linq to SQL DBML file, if you have changed some structural part of the database in code (which is where I tend to do it), right click on the DBML file and go into design view. Then drag into the design any new tables or views that you have added.
2) Because having to delete and drag in the database feels a bit dodgy, write yourself a function that runs on Form_Open when in debug mode that copies your database file such as
\MyDatabaseBackup\myDatabase_date_time.mdb
Remembering that if you do go back to a previous version at any time you need to rename it myDatabase.mdb
Copy database to some proper location and change the connection string in config file to point to that only, it is only a suggestion as not sure what type of app. it is.
At seemingly random times, whenever I load up VC# Express for the day and start working, any changes I make to my code don't get reflected in my debug runs. It's as if VC just refuses to compile the code and just runs the old already-compiled version. Deleting the "bin" folder in the project directory doesn't help, as then VC just complains that it can't find the *.exe instead of recompiling. Doing a rebuild helps, but only for that one rebuild, so I'm continuously having to rebuild the solution to see any changes, which is really slow.
The only way I've found to get rid of this problem (for maybe a week or two) is to create a new project and manually copy over my code. Needless to say, this is really frustrating and tedious. Is this a documented issue? What can be done to fix it? Searching online doesn't really turn up any answers, as the search terms most applicable to the problem bring up a lot of noise results.
You might see if the project you are working on is set to Build when the solution builds. To check this, right-click your Solution and go to Properties. Click the Configuration Properties node on the left and make sure all of the projects you want to build are checked on the ride side for your given build type.
UPDATE: Also, what is the timestamp on your build files? Is the timestamp getting updated on your build?
I had this problem when working on a network drive, and the time on the server was out of sync. Linux+Samba accessed by Win7 Pro and VB 2010 Express.
Correcting the time-difference solved the issue.
click on BUILD-->REBUILD SOLUTION and you are now good to go