I am learning how to write VS2019 addin/extensions and searching for some good resource on specific questions like...
I am looking for some answers like,
How to i enable my menu item, only when a specific type of project is open or selected in a solution. ?
How do i iterate through files in a solution, How do i add files in a solution?
Is there any dom object available through which i can access items i need from XAML files.
Any good easy article answering above would be helpful.
Regards
To enable/disable your menu items/commands, take a look at the BeforeQuesryStatus event. See my answer from here for more details https://stackoverflow.com/a/52059488/6775515
To iterate through the file, you need to use the DTE interface. From there, you can access the solution from where you can get all the projects, all the projects file, or the selected files if this is what you want.
I didn't work with XAML files in a VSIX yet, but if anybody did it, please feel free to edit this answer in order to provide better response for the community. I would be curious too :)
Here is also a playlist of new videos from Microsoft: https://www.youtube.com/watch?v=EniQmgmMb6o&list=PLReL099Y5nRdG2n1PrY_tbCsUznoYvqkS
I think you will get better responses to your questions in the future if you will post a single question/issue in one post and not a series of questions.
Related
I've created an entity modeling DSL (https://github.com/msawczyn/EFDesigner) and would like to give the users the ability to search the model while viewing it (for class names, attribute names, association endpoint names, etc.).
I'd like to hook into Visual Studio's Find feature and display the search results in the Find Results window, then put focus on the element when they select it in Find Results, in the same way that selecting a Find Results code entry navigates you to that line of code. I'm currently doing that kind of navigation with Errors and Warnings in the Error List window.
I can't seem to find documentation anywhere on the API for hooking into Find functionality. Based on Visual Studio's architecture, I'm assuming this is a service.
Is this an extension point? Is it not doable? If it can be done, would someone please point me to the documentation?
Thanks in advance.
I am looking for free extension that has one simple functionality which is sidebar file navigation like is in SuperCharger or Resharper (see attached screenshots). Sadly both of them are paid :-( Does anyone have a good alternative?
Visual studio has Class View window for a quite a while.
You can try Productivity Power Tools, with it, you can:
Expand code files to navigate to its classes, expand classes to navigate to their members, and so on (C# and VB only)
Search your solution, all the way down to class members
Filter your solution or projects to see just opened files, unsaved files, and so on
View related information about classes and members (such as references or callers/callees for C#)
Preview images by hovering over them, or preview rich information by hovering over code items
We've also added support for multiple selection and drag & drop.
https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.ProductivityPowerTools
I know its an old question, but as i was looking for an alternative to supercharger // Resharper (for the navigation only) few days ago, and had looked on stack before doing my search (and as I found the answers not exactly what i was looking for) ...
After testing a few extensions I finally found a good alternative to those two paid solutions :
https://github.com/sboulema/CodeNav/blob/master/README.md
You can also just download it from the extensions menu , search for CodeNav .
Best.
does anyone know what are the various parameters for VSCommands's Solution Badges feature? On the official site http://vscommands.squaredinfinity.com/Features-SolutionBadges they tell you everything BUT the most important thing and that is the list of available parameters (ie. {solutionFileName}, {sln:activeConfig}, {branchDirectoryName} and so on). Can't seem to be able to google them either. Am I missing something obvious here?
So it seems that pretty much all available parameters are already displayed with the default configuration (had to decompile and deobfuscate the extension to find out this information). What I was after was full solution path in the window's title bar. I solved the problem with this handy extension
Visual Studio Window Title Changer.
As you know, in Windows Phone SDK there are several styles that you can apply to textblocks.
For reference: MSDN
Since you can't always remember the full name of the style, is there an easy way to apply them? Do I really have to go to that link everytime I need to apply a new style?
IntelliSense is not helpful enough? I usually, write StaticResource text and then the list gets filtered with all the styles containing the "text" string. Kind of depends according to your needs. If you want to apply for font style, write "font" and see the list of suggestions.
Now, I'm not sure if my IntelliSense is as yours or is already enhanced by Resharper. If you haven't heard of it, take a look at it. You gotta hit CTRL+SPACE if the suggestion list isn't there, and it will get filled with possible matches. It's a nice productivity tool that does MUCH more and actually is not free but, I guess you could also get it crac... ahem :)
Other than this, I guess a quick bookmark to that web address, does that job pretty well. :)
The easiest way is to ensure you have the visual designer open while creating the view. You can right click on your TextBlock select Edit Style -> Apply Resource ->. From here you will see a long list of available styles to pick from.
I just found out that what I was looking for will be implemented in Visual Studio 2013!
Here you go: http://blogs.msdn.com/b/visualstudio/archive/2013/08/09/xaml-editor-improvements-in-visual-studio-2013.aspx
Question ONE:
I'm still pretty new to .net, but have used Visual Studio for a few recent projects. I'm now working a new project and I was wondering if visual studio had anything built in that would allow you to browse all of the details about a control, etc..
Is MSDN the best place to go for this?
For instance if I wanted to see of all the methods, properties, etc.. Is there anything inside VS?
Question TWO:
Can anyone recommend, books, resources, that deal specificially with Visual Studio? What each window does, etc.. I have used it enough to complete a few projects, but I haven't seen much in the way of exactly what everything does and why.
Thanks for any suggestions.
Use reflector (it's free!) to get in-depth information about classes etc. Visual studio also has a built-in Object Browser.
P.S. Reflector allows you to reverse engineer assemblies as well, allowing you to view the actual code of a class / method.
P.P.S. Google is still a developer's best friend. Need information on a control, search for it on the web. (Which will lead you to MSDN a lot of the times, but will also get you examples and loads of blog entries).
Question ONE:
You can use the Object Browser (menu View\Object Browser) to see a hierarchical list of all known assemblies, classes, interfaces, enums, etc...
This only gives the signature of each item and not the code.
If you want to see the code, use .Net reflector.
You can also use the Object Browser in Visual Studio. There is usually an icon for it at the top (by the Toolbox, Solution Explorer, etc. icons) or you can navigate to it (View -> Object Browser). When it opens, you will see all of the libraries currently referenced (system and third party) on the left hand side. It's hierarchical, so you can start drilling down. There is a search box at the top, if you want to look for a particular class, method or library. That looks at all the system libraries, not just the ones referenced in your current project.
For more help with the object browser, look here.
Q1:
In Visual Studio:
Above the editor there are 2 dropdown lists:
Left: Shows Classes
Right: Shows Class Members
or Click View > Class View: to see all the classes in the whole solution
I had a similar rub when I started using VS after I had done a lot of Java coding. I was used to the Java API documentation to research properties and such.
I found the VS equivalent IMO, here:
http://msdn.microsoft.com/en-us/library/ms229335.aspx
You can browse every class method, property, constructor, etc. right there. Their examples are decent.
In response to question 1, what I usually do is highlight the bit of framework code I'm interested in and hit F1 to bring up the documentation. For example:
Button myButton = new Button();
If you highlight the first Button and hit F1, you'll get an overview on Buttons in Windows Forms. If you highlight Button() and hit F1 you'll get the documentation on the Button class constructor.
In response to question 2, I'm not sure a book is the answer. I think reading a book on all the components of Visual Studio might be overkill. I'd say to keep on hacking away at your projects and page-fault information in via MSDN, Google, and StackOverflow as you need it. As with any IDE and framework, the more you use it the better you'll get at navigating and learning the ins and outs.