Using Visual Studio 2005 with ClearCase Eclipsed Files - visual-studio

I'm trying to use Visual Studio 2005 with ClearCase eclipsed files (view private which "eclipse" a versioned file), but any time I save the file in VS, it becomes uneclipsed, and returns to the versioned file. In Linux, I use VIM instead of Visual Studio, and get around this problem by setting backupcopy=yes, thereby forcing it to save files by writing to a new file and then copying the new file over the existing one, instead of moving the original file out of the way (which undoes the eclipse) and then writing a new file, but in Windows, I'd like to use Visual Studio (since the tree also includes C# code compiled under VS). Is there any way to teach it to save files this way?

I do not think Visual Studio does save file in a particular way that may cause the file to be first removed, then written.
Considering that, with developer's environment as Windows with Visual Studio, eclipsed
files often happen just by writing a file case sensitive and later not case sensitive.
Hence, did you check the case of your file ?
Could you also check the config spec associated with your Windows view ? (and compare it to your Linux view).
I just spend 1/2h with a Visual Studio 2005 / ClearCase / dynamic view and... I do see the same thing!
The only workaround I can fathom is to add a non-selection rule:
element /my/private/file -none
That way, even though VS2005 remove then add the private file when saving it, ClearCase does not try to restore the versionned file, since it is not selected at all.
Si, the answer may not reside within VS2005 (I studied the options without seeing any obvious setting altering the saving process...), but rather within ClearCase.
Let me know if it helps.
As noted in the comment, the downside of this approach is "un-eclipse" can no longer be a matter of moving/removing the private file to let ClearCase dynamically restore the versionned file.
Now, that step must be complemented with another one, which is to comment the non-selection rule in the config spec.

If anyone is still reading this... I just discovered that Visual Studio 2008 appears to work just fine. Go figure...

Related

Should we ignore Solution Output folder while we are using Visual Studio and Version Control?

I'm using Bazaar and Visual Studio 2010 in a C# project. I have prepared an ignore list but still I think all the files in Solution Output directory could be ignored.
I search a lot but nobody had mentioned it. So I'm going to know if I can ignore this directory because output files are changing regularly and seems are not important for repository copy.
What do you suggest about this issue ?
In general, any file that is automatically generated by compiler or build tools should NOT be committed into source control. This includes object files, executables, generated resource files, symbols, etc. Committing those files does not serve any useful purpose. Also, sometimes there are configuration files which look like can be committed, but really should not if they only contain local user specific info - for Visual Studio there are *.user files.
By that logic, solution output folder should be always put into ignore list.

Create a physical copy of a source file in Visual Studio

In Visual Studio, if I try to copy a file from one project to another (by using Copy and Paste or by dragging the file to the new project while holding the Ctrl key) it creates a reference to the source file in the original location. Is there a way to create a physical copy of the source file and place that in the target project source direction without having to resort to using Windows Explorer to copy the file manually?
It's not pretty, but when I want to do what you're suggesting, I double-click on the file in Visual Studio, which opens it. Then I do a File->Save As, choose the right directory and save it. All from within Visual Studio. This is usually followed by adding the new file to the other project.
Was just doing this and realized I should mention a side-effect. Depending on your source control (in my case, TFS 2010), doing this from within Visual Studio may modify the location of the file in the project. For me, this means making sure that neither the file nor its project have any pending changes, doing the save as, then doing an undo of the change this causes in TFS 2010 (project change, file add and delete).
From http://msdn.microsoft.com/en-us/library/0fb6xxhb.aspx:
If you are working with solution items, Visual C++ projects, or other similar projects, you are always working with links in Solution Explorer. If you are working with Visual Basic projects, Visual C# projects, and other projects, you might be working with links or files.
Essentially, the answer to my question is 'No'. In most cases, I must use Windows Explorer.

Workflow for renaming a class when using Visual Studio with Perforce

(I am new to perforce and am trying to avoid getting myself into problems, I have hit problems doing this with other source code control systems)
When I rename I class I need to
Change the class name it’s self
Get Visual Studio to Refactor all the code that uses the class
Rename the file in the Visual Studio project
Rename the file in Perforce
Check the changes into perforce
Then maybe merge the change from my working branch into the main branch
What’s the best way to do the above with perforce? What issues to I need to be aware of?
This is a multi-step process unfortunately. What you need to do move it first using resharper and then move it again using perforce.
This is how I do it (in Perforce 9.2 and above):
First, checkout the files in Perforce. This will clear the readonly flags for those files and let Resharper modify the files as part of the move.
Use Resharper's Move refactoring and move the classes to the new directory.
The previous step also moved the files from the old folder to the new folder. So now we have to fix that so we can do also do the move operation in Perforce. Use Windows Explorer (or whatever is your favorite tool) to move the files from the new location back to the old location.
Go to Perforce and using the Rename/Move context menu to move the files. This will create a pair entries in the changelist for each file; the first entry is for deleting the file from the original folder and the second entry is for adding it to the new one.
If you have a new enough version of Perforce, it now supports the move command, which will maintain file history across different names. If this is available, your steps are straightforward and should work just fine (from the Perforce side; I'm less experienced with VS).
If you don't have the move command available, you might want to look at this question for a further discussion on renaming/editing files in Perforce.
Have you had a look at the Visual Studio integration (P4SCC) that's available on the Perforce products page? I'd assume that it supports a rename rather nicely (disclaimer: I'm not using Visual Studio with Perforce myself, so I might be wrong).
I have written a macro for adding a "p4 move -k" action to Visual Sudio's Rename event.
See answer of "How to keep change history while renaming files in Visual Studio using Perforce".
With that macro you can do at least steps 3 and 4 at once by renaming file in Visual Studio.

How can I support source file subdirectories (with common file names) in Visual Studio?

I have a (C++) project that I originally developed under Linux using make to build it. I would like to also have it run in Windows and am using Visual Studio 2005 to build it. The problem I'm running into is that Visual Studio places all objects into the same output directory. This doesn't work for me because I have source files with the same name in different sub-directories. This means that the last object (with the common name) overwrites all previous ones and thus I get link errors for the "missing" code.
Setting the output directory (even using the Visual Studio variables like $(InputDir)) at the project level doesn't work because Visual Studio passes all of the source files to cl.exe at once (i.e. $(InputDir) is evaluated once rather than for each input file). It appears that this problem can be solved by manually setting the output directory for each file (at a minimum, for the affected files), but this is less than optimal and error-prone.
Is there a better way to solve this problem? I would even appreciate it even if someone is able to suggest a way to get Visual Studio to compile files one-at-a-time so that setting the output directory at the project level would have the desired effect.
You might consider using different project for each directory or so. Otherwise, using the exactly same filename within a certain project might seem a bit strange. (Sort of a hierarchy within the project structure; something I've never seen before anyway.)

Integrate Visual Source Safe with Visual Studio without using source control binding

Is there a way to integrate Visual Studio with VSS without doing source control binding?
The problem I have is that my team is opposing to add source control binding to the solution and project files, since they claim it adds more problems (restrictions) for them.
On the other hand, I really like to perform most of the source control operations from Visual Studio.
Is there any way to have the solution file and all the project files the way they are (without added binding to VSS) and still have VSS and VS integration without forcing other team members to use that integration.
I don't see a way to do it per project.
You can however you do it for IDE (all projects loaded).
It is under Tools\Options\Source Control
and then set Binding to None.
I see it in VS 2005 and 2008. I gave it a try in a project I wanted to convert from VS2005 to 2008 and appeared to work (I did not want to check in/out files for conversion).
The answer to your question is "no." Bindings and VS integration are one & the same with SourceSafe. I'm not even sure what it would mean for a solution to be integrated but not bound, or vice versa. What exactly are your teammates looking for?
You can adjust bindings per-project in the File -> Source Control -> Change Source Control dialog. You can also adjust them per-user (effectively; not a supported configuration) by excluding the *scc files from source control. However, you are likely to encounter problems down the road if you try to manage these files yourself instead of using the Add Solution To SCC wizard. More info:
http://alinconstantin.dtdns.net/WebDocs/Scc/_Bindings.htm
http://alinconstantin.dtdns.net/WebDocs/Scc/_WebEnlist.htm
The binding is stored in the .vssscc, .vspscc and MSSCCPRJ.SCC files.
If you don't add these files to Visual Source Safe every developer can configure his bindings like he wants.
Since we use Perforce, I'm not 100% sure if this works with VSS.

Resources