Creating custom designer over XML file as VSIX 2010 package - visual-studio-2010

We have a set of VS 2008 packages which leverages custom Project/Item templates, designers around XML files for our in house product development using VS. We are planning to move to VS 2010 and looking for migrating our VS 2008 packages to 2010. I see that there has been a rewrite of VS from ground up using WPF/MEF, but still could not figure out how we can leverage it for our packages. I am seeing some guidelines, samples and community material on how we should be extending the VS 2010 WPF based text editor, but could not find any reference implementations on how one should implement a custom designer on top of XML using the WPF/MEF APIs of VS SDK.
Only sample I have come across regards to any custom designer implementation so far was Example.XmlWpfDesigner - http://code.msdn.microsoft.com/Designer-View-Over-XML-20a81f17 which does not talk anything about WPF/MEF way of doing custom designers.
Has anybody come across any reference implementations along these lines? Any help regarding this would be much appreciated.
Thanks,
Siva

The sample you linked to is the right one to be looking at for a designer over an XML file. It is a WPF-design surface that edits VSTemplate XML files.
The only part of the VS API's that moved to MEF in VS 2010 was the core text editor. While you are welcome to use MEF for the implementation details of your designer, you'll still need to talk to the VS COM API's to do things like buffer management, interfacing with Source Control interfaces, etc...

Related

Nesting Projects

I see that MS has documentation on how to implement nesting projects when implementing new project types. While this looks do-able, I'd rather not write and maintain my own VS extension if I can avoid doing so. Is there any "generic" project type already implemented by some extension that will allow project nesting? The idea would be that the parent project does nothing but include its children and allow building, adding references, etc.
Managed Package Framework for Projects is for Visual Studio 2013 and includes "a project system that supports nesting" (see the NestedProject sample). I have not tried it myself, though I did look through it a while back (the VS 2010 version) and it has thorough documentation.
It may or may not be as extensive as what you are looking for. From the overview in the documentation:
Creating a new project type in Visual Studio is complex task. Using MPF_Proj is a good starting point for creating custom project types in Visual Studio written in managed code but there are limitations that would have to be considered before using the framework.
MPF_Proj is not a .NET library. It is rather a framework of source files (classes, utilities etc.) that can be included in a VSPackage project.

How to integrate a custom antlr4-based language into Visual Studio

I'd like to integrate my own custom language in Visual Studio.
I'd like to have:
Syntax highlighting
invoke a custom compiler, producing source files in another compilable language. These shall be compiled in a second phase.
some simple tools like rename (not text based, so that a local variable is only renamed within scope), find code lines that reference this function/variable etc.
Intellisense (code completion, suggest members, types etc.)
Is there a way to achieve this without too much effort?
I already discovered Xtext (limited to a subset of antlr3) for eclipse, but need a similar tool based on antlr4 for visual studio?
Check out the Extending Visual Studio chapters in MSDN, especially
Language Services
Projects and Solutions
Editors
There are a few other blogs and tutorials on these topics as well:
CodeProject
ANTLR and MyC
And a few language services are open source and provide a great example:
IronPython
IronRuby
ASP.NET Web Stack

Visual Studio quickstart for *nix / OS X / Xcode developers

I've been writing C/C++ for years using Xcode and am very comfortable with *nix systems. Now I'm working with people who only understand Windows; I've decided to try to learn that environment too.
I was thinking that google would be my best friend, but even the terminology for VS is sufficiently orthogonal to that of Xcode that I can't make any headway. (E.g., what's the equivalent of "Add new Target to project" for VS?)
Can anyone point me to a guide to VS for Xcode practitioners? I've seen lots of translators going the other direction.
Thanks!
I do not know of any XCode to VS Guide, but according to XCode Documentation:
A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace.
The analogous concept in Visual Studio would be a project. In Visual Studio, a project contains code files, assets and settings which compile into an output of some sort. (Could be an executable, a DLL, a website, or a few other options...) Projects can reference other projects or other external libraries (System or user libraries) which are all delivered together at compile time.
A solution contains multiple projects which can be related (referenced) and compiled and linked together.
When you first start VS, it will ask you to Open or Create a project. It usually will automatically create a solution and automatically add the project to it. To add additional projects, you can right click the solution in the "Solution Explorer" and add another project.
Hope this helps
I believe what you're looking for is the Build Configuration Manager in Visual Studio. (It's been a while since I've used XCode). As I recall a "Target" in Xcode is how you want the project built. In VS you get a Debug and Release configuration by default but you can use the Build menu and choose "Configuration..." to create more.
I don't know of a tutorial for XCode users but Kate Gregory has some nice beginner screencasts on pluralsight for using Visual Studio 2010. Those may get you over some learning curve hurdles. I think they have a 30 day free trial. If you move on to .NET development they have a lot more that can really help you get up to speed quickly.
Quick Terminology
In Visual Studio you typically create a Solution. A solution can consist of any number of Projects. You can add projects for .DLLs (libraries), services, applications (gui and console based). You can have multiple applications but can only designate one as the Startup Project.
In my typical project I start with the GUI and Add a project of the type I want. Then I often add a library project for new code that I think I can use across multiple applications. Existing code in both supplied libraries and ones you've built are added as References. You can right-click on References in the Solution Explorer and select Add References.
In XCode (when I used it) your IDE consisted of two pieces, XCode and Interface Builder. In Visual Studio you can build interface elements directly in Visual Studio ( but there is also a tool called Blend that allows for UI creation and modification). There are THREE major types of interfaces web (usually an ASP.NET application), WinForms and WPF. I think of WinForms as the equivalent of what you build in IB. WPF is the most recent addition and has lots of advantages but a somewhat steep learning curve.
This is probably oversimplified because VS does so much and I'm mostly familiar with the C# and C++/CLI capabilties. However it also supports Visual F#, Iron Python, Iron Ruby, Visual Basic, Sharepoint, Office Integration,Silverlight, XNA, etc.
Visual Studio is very extensible. There are lots of extensions to make it integrate with other tools. There are also a couple of extremely useful extensions that make refactoring and writing code easier, my personal favorite is ReSharper from JetBrains.

Visual Studio 2010 localization resource files, how to add in strings automatically?

I have a certain project that has a resource directory with a .resx for each language supported in the product.
Right now I am adding these strings by hand using the visual studio 2010 IDE, but because there are a large number of strings, this manual management of these resources can get tricky, and something can easily get omitted in perhaps just 1 .resx file.
Do you get a good resource addon for visual studio 2010, that will allow you to sync and validate a group of resx files? The built in functionality for handling resx seems the same as it was in 2008, and requires a lot of manual effort.
I guess what would be nice would be to have the ability to define all resources in the main language, then have these strings carried across to the remaining languages automatically.
Does such functionality exist? Even a good codeplex project perhaps?
For those of you guys with the same problem I found this - http://zetaresourceeditor.codeplex.com/, seems very good.
Visual Localizer is free, supports snychronization of resource files (among other things) and works in Visual Studio 2010 (also in 2008 and 2012).

Designing a Visual Studio 2010 Integration Package

I'd like to get started with the Visual Studio 2010 SDK and creating integration packages. All I would like to do for now is provide a new project type and language service. However, I don't know how I should design it...
The package will provide an editor for a programming language that compiles for x86 or ARM processors. The problem is that there are a few language differences depending on which processor you're developing for. I'd rather not have a separate project type for each architecture, however. Preferably, the programmer chooses the architecture when they create the project and the package automatically loads up the specific parts such as the correct language service, configuration settings, and whatever custom tools and dialogs are associated with that architecture.
How would I go about doing this? I've read about "flavored projects", but I don't really understand how to implement them. Is that what I need?
A couple of points to note to get you headed in the right direction:
The interfaces for a language service to hook into the editor have completely changed for VS 2010. I would recommended asking questions on the VS Editor Forum where all the devs for the core VS editor hang out for the speediest answers since the documentation and samples are still incomplete at this point. (There is a compatibility layer to support "old" language services, but you'd be better off just using the new interfaces since you're starting from scratch.)
A "flavored project" (referred to in the docs as a Project Subtype) is a way to add/remove functionality from an existing project system. For example, there is are project flavors for Web Projects, WPF, Devices, Database, etc.... on top of CSProj and VBProj. In these cases C# and VB are the "base" project systems and WPF, Web, Database are flavors that extend the base C#/VB project systems. Since you have a custom language, you should implement your own base project system. Your best bet for starting from scratch would be to build something based off the MPFProj source library.
I'm working on something very similar -- here is my starting point:
http://blogs.msdn.com/noahric/archive/2010/02/15/markdown-part-4-outlining.aspx
It's a very nice example of how to implement an editor extension.

Resources