I am trying to develop a template Visual Studio 2008 solution making use of the IWizard interface. So far I have been able to successfully add multiple projects to the solution. I am now looking to put in a Web Setup project into the solution which will already have the Project Output from a particular project specified.
I read that a .vdproj file cannot be part of a template, so looking at any other alternate options available.
One option that I tried but did not work was to save the contents of the .vdproj file within the wizard and write it out after the solution gets generated. I am wondering if I can use the Visual Studio ExecuteCommand to add a Project and add the Output Group in the setup project without displaying the UI.
Anyone tried this before?
I found the answer.
The method of saving the contents of the .vdproj file within the wizard works. However, before writing out the content to a file and adding it as a project, the GUID of the project which would be used in the Setup project (Project Output or Content Files) has to be replaced in the saved text.
Visual Studio adds a unique project GUID once the project gets added to the solution, and this GUID has to be read using the Visual Studio SDK and replaced in the actual .vdproj file text.
Related
i'm trying to use the functionality of the visual studio 2015 to create a project template.
I have a simple wcf-project with my special web.config. To use classes from another project i referenced it.
Those two projects are in the same solution and inherited in source control.
when i create the template and try to add a new project to the same solution, choose my custom template, the solution gets checked out but the files doens't get added to source control.
The source control says, that the binding is invalid. I dont know why.
Does anyone have any suggestions?
Thanks in advance!
Visual studio 2015 - Solution Explorer, Click Show all files,Check new file show in project tree. Right click on file select add to Project. New file need to add .sln (Project solution file) to show in project.
The project template gets added to project tree, but there no "+" sign in front of the file icons. and the solution file is checked out but no changes are made.
I have an C# source code of some software my company is using. This source code contains .xaml, .cs files, and one: App.config, packages.config. However there is no main project file that I can open in Visual Studio.
The original source code can not be found, and the programmer who made it has left the company long ago.
My question is - can I open such a project in C# somehow, without the main project file, so that I could make some changes and compile this application?
Just create a new WPF application project and add the existing files.
You can compile the code using the c# compiler csc (which you can find in the .NET Framework installation folder), or just create a new project in Visual studio and add the WPF files to it. The last option is the easiest one.
I wrote an application in Visual Studio C# 2010, that I would like to import into another existing Visual Studio C# 2010 Application. How would I go about doing this?
For instance, I'd like to import the project into another, and basically copy/paste the interface from the application into a tabpage on a tab control I have.
Any assistance or advice on how to do this is greatly appreciated!
You should be able to copy the physical files using windows from the existing solution location to the new solution location.
Then once the copy is complete open Visual studio and tell it you want to add an existing project. Navigate to the folder where the files are on the filesystem and open the project file.
Once you save the solution it should from that point forward have the new projects in the new solution.
There are several ways to achieve this - Copy & Paste being one of them (but the least beautiful of course). A more promising one is the following:
Wrap the user interface you want to share in a User Control in the existing project. Also include the code behind logic in this user control. Include the user control in the project and make sure that everything works before continuing.
Add the existing project to the new solution. It is advised that you create a hierarchical structure in the file system for the solution so that all projects in the solution are located under a directory.
Reference the project from the project that wants to access the user interface. As the projects are in the same solution, you can add a project reference. This asserts that the projects are built together.
Place the user control on the tab page.
As an alternative, you can also pass on adding the project to the solution but only create a user control and add a binary reference from the other project.
So I am trying to create a multiple file template to using in visual studio 2010 C#.
I created an initial template using the visual studio export template wizard.
The problem I am having is when I extract the template and re-zip it visual studio no longer sees the template (note that I change nothing, I only unzip and zip)
Am I missing out a step or something?
Any help would be really appreciated.
Here is what you need to do:
Trick is, instead of selecting the folder which is unzipped, open the folder and then select all the files inside and then zip it. This should work well.
I'm currently using a "New Item" template of mine to create several classes in my project based on the Name entered. What I'd like to be able to do, is to also add some lines to an existing file in the project. Is there any way to do this? Is there any way to run some sort of script from within the .vstemplate file?
For a vanilla item template in Visual Studio there is no way to achieve this. Item and Project templates just allow you to add new files to a project and allow for customizations of those files. But it's not possible to use them to change existing files.
You may be able to achieve what you're looking for though with a template wizard. This allows for the execution of arbitrary code during the processing of a template. You should be able to modify the existing files to your delight with this.
Tutorial Link: https://web.archive.org/web/20090625145715/http://blogs.msdn.com/vsxfaq/archive/2008/06/12/how-to-create-a-custom-template-wizard-using-visual-studio-2005.aspx
EDIT: Sorry, I misunderstood the question.
Original answer:
Well, the default templates are in 2 places:
\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplatesCache\CSharp\1033
\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\CSharp\1033
You can change the template contents for new classes and new forms in there at your leisure... Not sure where user created templates are saved, but there's no reason you couldn't do the same thing to those (to my knowledge.)