When to delete project obj and bin folders? - visual-studio

Usually I do it when I am about to publish an application with a lot of code changes applied to. The problem is that I do it to feel good not because I am certain that the process really needs it.
I am not asking about cleaning the folders but deleting them. What valid reasons are there to do so?

I do not see a big difference between deleting bin folders and total clearing them. In any way, the entire folder content is removed and new content is copied. ASP.NET Server is automatically restarted (if you didn't shut down it first) when the bin folder content is changed.
I personally usually delete the folder content but do not delete the folder itself. But as I said, there is no big difference at all.

Related

Moving files within codeblocks project

So this might be outright stupid question, but I found no answer looking on the internet or fiddling with different buttons.
Say you have a project with several physical folders which contain different source files. Now you've decided that you'll create a new folder and move parts of three old ones in there.
In order to do so, I had to do the following:
Go into my project folder via explorer and create a new folder
Manually move all the desired files into that folder
Return to code blocks and remove all the moved files from the project
Re-add all the removed files by selecting the whole new folder when adding existing files
Manually going through code and modifying all affected include directives to point to the proper path
It would be much simpler if you could right-click a folder, create a new nested folder and just drag-and-drop files to where you want them while code blocks would move them on disk and correct the includes for me.
It's the way that Eclipse does it for Java. Is there similar functionality for code blocks, maybe a plugin?

Is it safe to move a Visual Source Safe project folder to another location?

I have a Visual Source Safe project in folder VSS with the structure "data", "temp" and "users" under. Is it safe to just move this VSS folder to another location on the hard drive and open the project from there or will thousands of file links become broken?
Having done this several times, I can say that it is safe. However you must copy All the files. As indicated by #Rachel it is better if some tidy up has been undertaken first.
I have used this approach to backup before attempting something which could be destructive, for example archiving some old projects.

I forgot to select option of 'Copy items into destination group’s folder' while adding files from a different project

I copied files from an old Xcode project and used it in my current one. I made a lot of changes in my current project, including in the files copied from the old project. Now I can't run them on another computer without including the old project.
Is there any way I can separate them now ?
I don't want to delete the files and add it again in the project.
Save a copy of the files in their current state. Then remove the references to the files in the new project. Now add the copies you saved off (and choose to copy them). Once done you can delete the copies you made earlier.
But keep in mind that this leaves the files from the original project with all of the changes you have made. Unless you have made proper use of source code control of you have backups, there is no way to revert the files in the old project back to their proper state.

Include in Project slowness with Visual Studio 2010

Our company won a web project from a new client. Their old vendor basically zipped up the code (C#/ASP.NET, including an enormous number of media files) and FTPed it to us and is no longer answering phone calls/supporting it in any way. There's no solution file, no project files, just code.
So I created an empty project locally and moved it to a network path and moved their code inside it because I don't even have enough space to host it locally. Their architecture is suspect, but I need to get it back up and running ASAP so I don't have time to reconsider that at the moment. I opened the project I created, selected "show all files" and attempted to include all of the paths (both media files and code paths) and the application hung. One of the media folders has something like 65,000 files in it. Do I even need to include this?
Regardless, it seems like doing "Include in Project" is taking forever, I've spent hours wrestling with it, trying to do one folder at a time...but often it's just hanging and I have to kill the process. Is there a faster way to deal with this? I tried editing the project file directly but including this media folder made the solution take absolutely forever to load.
Any general suggestions on how to approach this situation?
as long there is no direct reference you don't need to include media files into the project.
I bet those files are just loaded runtime from a procedure. To make sure make a full search for the media folder in the sources.
Imho get just the files to a local store, create a solution, and then add all resources and sources. If needed you can copy the media files later again into the project.
I had the same problem with local files. I probably killed VS2010 three times since it would always seem to lock up. I then recreated the folder structure, but not with the correct name, then save the project, open it with a text editor and change the names to the actual structure. Finally use "Add > Existing Item". It's still slow, but a bit faster.
It's not hanging - if you leave it long enough it will finish. Know what you mean though - it took half a day to include dojo on one of my projects.
You may want to try SharpDevelop to include large folders into your projects - it seems much, much faster than visual studio when given this task. You can then just re-open the project in vs. Hope this helps.

Starteam "Unknown" files

We have a StarTeam view that has two files that are in the "Unknown" state – does anyone understand why they are in this state and/or how we can get them out of the state?
Is deleting them and re-adding them with a different name the only solution?
Note that if you check out these two files (regularly or using “force checkout”), they will always be listed as “Unknown” (annoying).
Thanks.
More info based on Craig's suggestions below:
a) Calculating file status using MD5 checksum: same results ("Unknown" status)
b) These two files in question have only one revision on the server. I'm not sure if this is because our CM group attempted to fix the issue by deleting and recreating the files or if there really was just one revision. The files are text files.
c) I tried deleting the files on my local machine and refreshing the status. When I do this, instead of seeing the two files listed as "Unknown", I see a total of four files listed with a status of "Missing". There are two entries listed for each file - each pair has the same file name, folder path, "modified by", and "file stamp at time of check in". I have no idea why each file is listed twice. If I select each entry in a pair and select "Compare Contents", my diff tool says they are identical.
I have this same weird issue with the four files whether I use the MD5 checksum compare or non MD5.
If I try to checkout all four of the Missing files, I get two alerts prompting me to merge the files. I say no, the files are now on my local file system and the status is back to where I started - two files listed as "Unknown".
Craig's update:
You're definitely on to something. I moved each of the duplicate items to another directory. That immediately solved the issue in that I now could checkout the four items (two in same dir and two in new dir) without any "Unknown" items. I then deleted the two items that I moved to the new directory.
In doing this, I saw some more info. We somehow have a directory structure like this:
Parent_Dir
--SubDir1
--SubDir1
--SubDir1
--SubDir1 <- Two items were here
--SubDir1 <- Two items were here
--SubDir2
--SubDir3
--SubDir4
--SubDir5
Somehow we have five sub directories with the same name and these two files in question existed in two of the sub dirs with the same name.
The issue appears to be resolved. Do you think I should manually delete the extra sub directories?
Thanks to Craig this issue appears resolved. I have no idea how this situation was created (anyone?) but.. we're good now. Thanks Craig!
It would be a huge mistake to delete the files before you determine where the problem lies. Deleting and re-adding the file would kill the history and any links to the file. It also might not fix the problem, due to the way that StarTeam works internally (with a Native-II repository, anyway). Deleting the file and re-adding the identical file will not actually update anything in the repository, except the pointers to that revision. The revision itself would have stayed there when you deleted the file, and re-adding it would just create a new pointer to that revision.
If you haven't done so already, I strongly recommend telling StarTeam to calculate the file status using an MD5 checksum. Do this in the client via Tools->Personal Options->File->Use file checksums to calculate status. Then try update status again. This is not the default setting (in at least some versions of StarTeam), so it's worth checking. If you have not already done this, it may, by itself, fix the problem.
The first thing to do is to determine if the revision is valid on the server. If the files are text, the easiest way to do that is to compare contents between that revision and the previous revision. If it does turn out that the revision is corrupt, then the best solution would be to check out an earlier revision, and then force check in. This way you preserve the history of the file.
If the file appears to be OK on the server, then test it locally, by comparing contents. If the file is corrupt locally, do feel free to delete the file locally and then check it out again. Unlike deleting the file on the server, you don't lose anything by doing this, except local revisions.
If these suggestions do not fix the problem, I still would not recommend deleting the files on the server. Tell me the results of your investigations back here, and we'll see where we can go from there. It is, in my opinion, nearly always mistake to kill history.
Update
Based on the updated information in the post, I'm getting a better sense of what is going on here. It is likely that there are two items which point to the same file, and have the same name. "Item" is a concept in StarTeam related to the fact that a single file, change request, requirement, etc. can live in multiple places at once. For example, you can have a single file in two different views or projects.
Generally, you do not have the items with the same name in the same folder. But it can happen. And that probably explains the "Unknown" status. When you tell StarTeam to compare the file on disk with the item of the same name on the server, perhaps it can't figure out which item it should look at.
The first thing I would try is to try and drag one of the two items somewhere else. If that fixes the problem in the folder in question, you can delete the item elsewhere, without affecting the item in the folder. If, on the other hand, dragging one of the items elsewhere causes them both to move, it's easy to drag the item(s) back to where they came from.
Update 2
Do you think I should manually delete the extra sub directories?
Yes, but just as with the files, move them first, and make sure the subdirectories you'd like to keep are unaffected before deleting them.
A good way to identify this issue if it comes up again is to click on the root folder, add folder path to the shown columns, then click the all descendants button. Sort the files by name, and look for the unknown files and see if multiple files of the same name are checking out to the same path. Usually this is the result of a mistaken share, addition, or a change in folder check-out path.
As it is undetermined what order StarTeam will check files out, having two different files with the same name pointing to the same local location is a mistake. The 2005R2 native Windows client and Cross Platform client would pull files in a slightly different order, causing views with this issue to produce checkouts with different files.
There are a few ways to legitimately end up with this situation - keeping multiple branches of a single file on the tip and designating which to use by view label is a common one. StarTeam is one of the few VCs that can handle multiple references like this.
Separately, if you can help it, never delete and re-add a file. 99% of the time, it isn't what you want to do. Re-adding a file to the server gives it a whole new archive in the database and it will not be tied in any way to existing shares of that file. You will also lose all of your revision history. Instead, look for ways to move files. And if you have multiple files with the same name and content on your server, it is usually a good idea to make an effort to share the file to the various places it should exist rather than re-add it. This will make sure your changes propagate so you don't need to check-in fixes multiple times.
Were those files added twice? You can add the same file multiple times which could result in this error. Also, check the Reference tab - are these linked files to elsewhere in the repository?
Could that be the files or their status got corrupted on the server? In that case, delete and re-add is the only way.

Resources