I'm writing an add-in for Visual Studio, which must be compatible with VS 2005. This add-in involves marking certain files as "special", and I'd really like to make their specialness visually apparent in the Solution Explorer - currently my users either have to manually keep a note of which files are special, or right-click on each potentially special file and see what menu items are there.
Ideally I'd like to change the icon, but I'd be happy to (for instance) make the file's name bold or something.
Unfortunately, all the appearance-related methods seem to live on Microsoft.VisualStudio.Package.FileNode, and I only have access to UIHierarchyItems and ProjectItems. I've spent several days grovelling through MSDN, and I can't find any way of constructing a FileNode given a ProjectItem or UIHierarchyItem. There's a suggested solution on the MSDN forums, but it assumes you're starting with a FileNode, and as far as I can tell this implies creating a custom project type (and presumably some sort of project-conversion system). I don't think my users would be too happy with this.
Or is there something I'm missing?
Related
I often get blue question marks on files in my VS2012 Solution Explorer when opening a solution bound to Perforce through P4VS.
Looks like something is having trouble to "synchronize" with the depot/workspace/whatnot. Hitting "Refresh View" always solves the issue but I'm growing tired on doing this everyday:
This is my VS version:
Microsoft Visual Studio Professional 2012
Version 11.0.61030.00 Update 4
And P4VS:
2014.1.85.4506
This is persistent across P4VS versions for a few months now, and seems to be affecting sometimes individual files, sometimes entire projects, with no apparent pattern.
How can I diagnose what's going wrong, be it a server issue, a VS issue, a workspace issue?... The Perforce Source Control output shows nothing special.
Actually it's not entire folders, it's entire projects. It appears that even if refreshing a project "fixes" the issue for one run, re-opening the solution brings it back. Whereas I think that for individual files, refreshing them solves the issue once and for all. I'll play with it a bit more to confirm that.
To help diagnose what is going wrong you should probably turn on logging, and check the preferences that will show everything in the output window. For the P4VS log, go to:
Tools- > Options -> Source Control -> Perforce - Logging
(This is not the same thing as the Visual Studio Activity log.)
There could be a possibility that you are getting disconnected and refresh reconnects you. I am not sure if you have your connection set to use solution-specific settings, since you did not mention the connection dialog coming up.
This "solved" the issue for me, at least for the entire projects that went blue-question-marked:
1) Tools > Options
2) Source Control
3) Perforce - General
4) Tick the option "Treat Solution/Project as directory when
selected"
Not sure why but that's one less annoyance for me every day. Thanks to Perforce support for suggesting that.
The file is probably not marked for version control. I noticed this icon in one file and opened Perforce to check. For whatever reason, this file was not marked for add in Perforce. After marking the file for add and submitting, the blue question mark went away.
I have Microsoft Visual C# 2010 Express edition, and every time I open it it makes a new folder in My Documents. Problem is, I want to reserve My Documents for, you know, actual documents. I managed to redirect most of the stuff in the folder into another place by changing the settings, but a folder called StartPages stays, no matter what. After some research I found I have to change something in the registry, which I can't seem to find. I researched into that and apparently I need to create a new Setup Project or something, which I also can't seem to find. I have no idea what I'm doing at the moment, so any advice would be appreciated.
(I have a bit of OCD when it comes to organizing my files the way I want, so if I can't get this to work I might go crazy). Thank you.
Go to Options in the Tools menu, select the Projects and Solutions -> General option group. The top item in that group of options should be the default project location. Change that to wherever you want your projects to go by default.
You might also need to change the other two directories in that option group.
This is based on VS2010 Pro version. If it's not there in Express, let me know and I'll have another look at it.
--
Except you've already done that. Sorry, wasn't paying attention as well as I should be.
If you can't find the registry entry to change, you could try turning off the Start Page completely. Personally I've never found it useful, so I turned it off shortly after installing VS2010.
In Tools->Options->Environment->Startup change the At startup option to Show empty environment. This disables the Start Page functionality, which also stops VS from executing the code that is creating the StartPages folder.
The registry path for Express editions is different to the Pro edition, and I don't have a VS2010 Express installed here at the moment to look at. Try searching for the value VisualStudioLocation in RegEdit, and change any value in that registry key that uses %USERPROFILE%\Documents to point to somewhere else.
I browsed through some questions and this one stood out as the better one:
.Net Classes and their source code which pointed me to this place here: Microsoft Reference Source Server.
I tried everything the site says, downloaded a file that I cannot open from there and at some point ended up with a .pdb file in my source folder for the symbol cache that I could not open with a multitude of tools I looked into.
So this is my last resort to find an answer to my question. Out of pure curiosity (and lack of a better way to understand some stuff) I want to open a particular class from Microsoft (namely I wanna look into RichTextBox and maybe the classes it inherits from) but I simply cannot find a way to make this work for me. I want the original source, not a decompiler product because, well because I mainly need to understand some stuff, not see random variable names. I appreciate any help that may get me around my stupidity and clumsiness, as well as the right tools to do so (if any other than VS).
Note that I am using Visual Studio 2012 and yes, I went over a guide covering this specific version instead of the guide on VS 2008.
The "download" links on this page: http://referencesource.microsoft.com/netframework.aspx should work. However try downloading them via Internet Explorer; my Firefox attempted to download an .aspx file instead of the installer itself for some reason. (EDIT: as #ParagMeshram pointed out, just rename the netframework.aspx to netframework.msi as a quick fix if necessary)
In addition, here's a link to the source hosted by dotnetframework.org: http://www.dotnetframework.org/default.aspx/4#0/4#0/untmp/DEVDIV_TFS/Dev10/Releases/RTMRel/wpf/src/Framework/System/Windows/Controls/RichTextBox#cs/1305600/RichTextBox#cs
I can't say for certain if it's the latest greatest, or what you would be compiling against exactly, but should give you a good idea of how it works.
I would like activity in my Visual C# 2008 Express to not appear in My Recent Documents (I use Windows XP). To clarify, when you open a solution or other file in Visual C#, a link to that solution or other file is added to "My Recent Documents". I would like that not to happen.
How can that be achieved?
I know there's a chance this question is better fit for one of SO's sister sites, but my best judgment was that it fits here...
Thanks
I know there is a away of stopping Windows from updating the list, but I don't believe there is a way to stop it from updating for certain file types.
I way you may be able to do it with is to use batch scripting.
cd "C:\Documents and Settings\PROFILE_NAME\Recent"
del *.<C# file extension or other project extensions>
...
del *.<C# file extension or other project extensions>
Create the file using Notepad and save it as <any name>.bat.
After you work with you C# project you just run this Batch script and it will remove all your evidence from your My Recent Documents folder.
NOTE: If you can't access the Recent folder (because it's hidden) try replacing Recent with My Recent Documents
Thanks
link textI've added this functionality to Visual Studio MRU editor.
The list of extensions is currently fixed, and it needs to be roughened out.
The new prelimenary executable can be downloaded here.
... and the Sources, in case you don't trust me ;)
(I'm not sure if I should keep the separate "save" handling - it was a good idea during testing, but otherwise is rather annoying).
I am currently developing with VisualStudio 2008. I find it increasingly difficult to find files when the number of files and projects increase. The situation become so bad that I literally have to spend 10-20 seconds to find code I want to work on when switch between files. Sounds like not a lot of time, but this can be very annoying because it breaks the "coding flow".
I believe this is a general problem with all IDEs. But I still find it easier to work with Eclipse. One particular example is that in Eclipse, I could apply some key shortcut to find implementations defined in an Interface.(I have forgotten which key shortcut though, after not working with it for about 1 year.) Another example is that in VS 2008, rightclick->Find all references will find all occurrences containing the selected text(Update: This accusation is incorrect. Thanks for pointing it out); while similar operation in Eclipse will find all occurrences where the selected class/variable are referenced. Personally, I find the Eclipse way is better for file navigation.
This could be due to my inexperience with VS IDE. So, I am looking for suggestions to improve the file navigation experience so that I can get some more time for actual coding.
I have used the navigate buttons but they are only useful for small number of files.
Thanks.
I agree wholeheartedly about ReSharper. If you don't want a "paid" solution though, a useful Visual Studio shortcut is
CTRL + ,
it gives a list of recently edited files.
CodeRush is a free alternative to ReSharper which you might find useful too.
Kindness,
Dan
Have a look at Jetbrains Resharper. Ctrl N or Ctrl Shift N. To jump quickly to files by type name or by file name. Also you can control Click Classes to navigate to them instantly.
I can't even work in visual studio without it anymore. It virtually eliminates the need for the solution explorer
SamTools for Visual Studio 2005/2008 (and I have a build for 2010 if someone needs it). The particular feature that's handy here is the Solution File List.
You can right click the tab of any open document and Find In Solution Explorer or Show In Windows Explorer
You can right click in the Solution File List for the same
Unlike other solutions to this problem, this is a properly docking tool pane so it fits in great. Ctrl+Alt+F places you in the Filter box with the current text selected, so it's very easy to work with.
Oh and it's free/GPL. :)
Solution File List http://wiki.pixelminegames.com/images/8/88/SamTools_SlnFileList.png
Dpack is also a free alternative with some nice file navigation shortcuts, but Resharper is the bomb.
BTW, they should have some more of this stuff in vs2010, which is in beta right now (I think)