Is it possible to add a New Project Wizard with a VSPackage? - c#

I have a VSPackage for Visual Studio 2008 that I created for adding some editor and custom language functionality. I also have a need to add a new project/solution wizard to create a new Solution and a complex series of C++ projects to the solution. I know I can do this using a "Custom Wizard", but I would be much happier if I can implement this within my VSPackage using C# instead.
So I guess the main question is, is it possible to add an entry to the Project Types dialogs in Visual Studio from a VSPackage? Or is the "Custom Wizard" and JScript my only option here?
And if it's possible, where can I find information and/or samples on how to accomplish this?

To add an entry to the Project Types dialog, you need to install a project template (a zip file containing a .vstemplate file) as part of your installation. You will want to do this from your setup routine rather than from the VSPackage itself.
However, your .vstemplate can invoke a wizard written in C#. Although this is indeed a "custom wizard," you can provide a reference to a .NET assembly. There is no need to use a scripting language.
For an example, see IronPython > C# Example.IronPythonProject in the VS2008 SDK browser. Unfortunately this demonstrates only limited wizard functionality and only for project items rather than projects, but I hope it will be useful all the same.

Related

User controls in Visual Studio 2013 Express?

I cant find Windows Forms Control Library in my projecttemplates or in the "online"-option? Is it renamed or simply not included in Express version?
Edit:
Maybe Class library is what Im searching for? I want to create a user control for winforms, but that class library dont recognize winforms components and I cant use
using System.Windows.Forms
Can I do a work around in class library? Or do I need the full version of VS?
Class Library actually is what you need but it is better in your case to chose Winforms Program because that way all references are set up.
When you have created it change it's project type to class library in the properties tab.
Note: The using clauses just make it simpler to reference the classes in the assemblies they refer to. But to get access to these they first must be added to your project's references. Look at the project expolorer - references.
The Windows Forms Template has all necessary assemblies already there while the Class Library Template doesn't and only has the bare minimum you need to write non-visual classes.
You can always add more references as needed with a right-click on the project explorer. Then you can navigate to the assemblies you need, like in your case System.Windows.Forms
And no, you don't need the full version for most things.
From MSDN, you should be a able to find this option in Extensibility -> Installed templates.
In the New Project dialog box, under Installed Templates, expand the
node for your preferred programming language and then select
Extensibility. In the list of project types, select Windows Forms
Toolbox Control.

Create Solution/Project programmatically without Visual Studio

I would like to create a Visual Studio Solution and a C# Project programmatically, but without a instance of Visual Studio installed on the machine.
Scenario
I am trying to build a "engine" that will read some metadata in a SQL database and transform them into a UI. The database will be maintained by another people with a Web or WCF interface and I want the Server Application frequently (by schedule or pressing a button) use this informations to create autommaticaly a new version of the software (create solution -> project -> build -> create deployment).
So, I searched about programmatically create Solution and I found only the Automation Model in VS, it's about use an Add-In Project and this don't serves for my propose.
Perhaps I was a little confused in my explanation, so ask me more especific details, so I can be more accurate :)
Thanks for help
I think generating the solution is a little extreme.
The solution file structure hasn't changed much since 2005 http://msdn.microsoft.com/en-us/library/bb165951(v=VS.80).aspx, and there are a few projects trying to automate their generation, like Premake https://bitbucket.org/premake.
However, the kind of scenario you describe, might be I believe (better?) adressed with t4 templates http://msdn.microsoft.com/en-us/library/vstudio/bb126445.aspx, or only project file generation.
What you are describing is possible to do in C# Windows app but tedious and difficult. I remember seeing VB6.0 app like that but here i would suggest you look into WPF. Still it's C# programming but WPF can load dynamically a "window" from a string or a file if you want.

Add language to default .net environment settings

The VS is set to default VisualBasic, but I need to import existing C# projects into my solution, where I already have the VB project.
But when I try to add an existing project to the solution and navigate to the C# project - I can't see the project file. From the drop-down settings menu I have the possibility to import only .vbproj and other .vb...
I tried to create new C# project, but I can only make VB and some office tools and Web. I don't have C# possibility, so I suppose it's because the Visual Studio has been set to VB only.
How can I add/change settings so I can create/import C# projects, as well?
EDIT: I tried going to Tools->Import and Export Settings... but I didn't have the possibility to import C# development settings or whatsoever. I could only add Project dev. set. and VB dev. set.
P.S. It's not my computer, so I was not the one to install the Visual Studio and I don't know what settings were set/installed.
If you are using the Visual Studio Express Edition for VB.NET; then that's not possible.
Visual Basic will most likely be selected as your default programming language. When creating a new project you can select a different language by collapsing the 'Other Languages' folder. If this does not contain C# you will have to install C# support for VS.
You can do this at 'Add and Remove Programs' or 'Programs and Features' and then changing the Visual Studio installation. Select the C# feature and after the installation completes you should now be able to open, add and create projects with C#.

Generate c# solution template

I want to create a VS2010 c# solution template generator and I'm looking for free/open tools to achieve this.
An example of what I'm trying to do is a winform application takes project name, namespace and database connectionstring and produce a c# customized solution with my custom classes, namespace and references.
I found those:
EnvDTE
Code Generation and T4 Text Templates
Is this the right way to do this? Do you know better tools?
You need to look at project templates. Normally you only get prompted for a project name (used as the solution name as well if creating a solution at the same time).
However the project template system can run code (as seen with C++ and ASP.NET MVC Projects).
There is a lot of information in the VS SDK, but you might find examining project templates that launch wizards useful to isolate the useful bits of documentation.

Creating a 'Custom Designer' Visual Studio 2010 Add-in

A major part of our work is creating and manipulating certain XML files, for which have a custom editor. The editor is starting to get creaky and we are looking at building a replacement. Since VS2010 has recently arrived, ostensibly with an improved add-in architecture (MEF?), I am interested in the possibility of building the editor as a custom editor within Visual Studio.
It would have to appear in the same way as the code editor or the Designer - a tab item, of which there can be many open at once, containing the GUI we use to edit the files. It would integrate with VS's Edit menu. It could use the output window to display messages. It would appear the same as any other editor within Visual Studio.
Right now, I am looking for examples of add-ins that work in a similar way - ideally with source code - to see whether this model would suit our requirements. I am also looking for any documentation or tutorials relevant to creating a VS2010 add-in, or information about VS2008 add-ins if this is still relevant.
Any input is welcome. Thanks!
You want to look at the Managed Extensibility Framework for VS 2010. Since 2010 is written in .net you can create add on components using it.
Code editor extension for VS 2010.
Working with MEF
Custom Editor Extensions
Update:
Since someone asked in a comment, I thought I would post this link on creating add ons for vs 2008: http://msdn.microsoft.com/en-us/vstudio/bb968855.aspx

Categories