I am trying to create an Visual Studio 2010 Add-In that when run adds a class to the opened solution's first project using EnvDTE.
I've managed to create the add-in, get the reference to the opened solution and get the reference to the first project.
Then I want to create the class, and I've found the following code:
String templatePath = sol.ProjectItemsTemplatePath(PrjKind.prjKindCSharpProject);
templatePath += #"\CSharpAddClassWiz.vsz";
The path points to a template file that does not exist. Everywhere I try to get this file, it’s stated that “you could find it in Microsoft Visual Studio 10.0\VC#\CSharpProjectItems”
Here’s the entire content of this folder in my installation of Visual Studio 2010:
http://i.stack.imgur.com/YFsMw.png
In fact I’ve searched for the file, and even for *.vsz in my entire hard drive, and nothing was found.
I have two questions:
1) Did I install Visual Studio incorrectly, so that this file is not available in the Visual Studio folders?
2) How can I get this file, even if it is a copy of it?
I do realize that having a copy of it and shipping it in with my Add-In would mean that in the future, people could generate classes with an old template, rather than the updated ones found in their Visual Studio folders, but I just want to proceed with my tests,
generate this class, and move on until I have the first question solved.
There are two things that intrigue me on this matter:
Doesn't Visual Studio use these files while I'm creating classes through it's wizards?
I have Visual Studio 2008 installed too, and it also lacks these files.
You may have to run a repair on Visual Studio, it is likely that there was an error during the install.
Related
I'm new to Visual studio extension creation. I'm creating an extension for Visual Studio by which user can create a new folder within the project opened in solution explorer by the extension.
I can able to create a Directory by using the following command in C#.
System.IO.Directory.CreateDirectory("myDirectory");
//Folder creation can be verified by going to project path
I know we have to add newly created folder/file into .csproj of project then only it will reflect in solution explorer.
But I don't know how to achieve the same.
Can any one help me to create a folder/file programmatically in C# so that it will be reflected in project opened in solution explorer of visual studio as well.
Visual studio is designed to behave like that only, if you want means you have to add/include. but you can see the newly created file/folder as excluded when you click the show all button. But you can access the path even if it is excluded.
I have found the FTPFactory Code Project, and I want to test drive it. However, so far I only installed new packages via Nuget. How do I add FTPFactory to my Solution in Visual Studio 2015?
You have 2 options.
Since this is such a simple single class library, you could just manually copy the ftp.cs file from the source and add it to your project.
Alternately, you can download and build the project which will produce a FTPTest.dll file. You can add a reference (browse) to this file in your project and use the class form there.
I am trying to modify a VS add-in, this addin has multiple projects. The addin project itself, some class librarys that it uses an an user interface project.
When I try to debug I get the error "A project with the output type of class library cannot be started directly." Since all projects essentially have the same output type, I am not sure what to do. I tried making sure the startup project is the actual vs addin project, and I still get the same errors. I have never worked with an add-in before so I figure I am probably missing an important step here. I am using vs 2010, and the addin targets that aswell.
Any help would be appreciated.
Did you try to specify Start external program property of Debug section of the project properties? Try to set a full path to Visual Studio exe (something like "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe")
My team is using the unit test wizard, but has found the amount of cruft generated annoying. Is there anyway to modify this template?
Thanks
Yes, you can, on several levels:
Project Template
You can get rid of the "About Test Projects" and other files using the Options menu in Visual Studio.
Go to Test Tools -> Test Project and unselect the options you don't want.
If that is not enough, you can find the project template in a folder similar to this:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\CSharp\Test\1033
Your path may differ slightly if you run on 32-bit Windows or have a different culture, but you should be able to find it.
Unit Test File Template
In vanilla Visual Studio, the templates for the unit test can be found in a folder similar to this (from my machine):
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\1033
In this folder there is a file called SimpleUnitTest.zip that contains two files:
SimpleUnitTest.cs
SimpleUnitTest.vstemplate
You can edit the SimpleUnitTest.cs file to remove all the code you don't want to have, but you must remember to re-zip the file so that it contains your changes.
However, if you only do that, VS may not pick up your changes anytime soon, since it maintains an unzipped cache of templates in
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\CSharp\1033
So you will need to edit the file there as well (or simply copy your changed file there).
As far as I have been able to tell, VS normally uses the templates in ItemTemplateCache, but occasionally reinstates them from ItemTemplates. This seems to happen when updates are applied, but I have yet to identify a consistent pattern, so simply updating in both places is the best way to modify the templates that I have been able to come up with.
We're a team of students doing a software project. As some of us don't use Windows, but the product needs to run on Windows and .NET, we want to develop on MonoDevelop and Visual Studio which both use Visual Studio files; language of choice is C#.
My question is: Can we check in the solution and project files into our repository without the possibility of severe conflicting problems? Example: Two guys add a new file to the same project, save and commit their changes. Will the project file get a conflict?
SVN works great with Visual Studio and the related Project/Solutions files. The Project files are just XML and the Solution files are a structured text file. If changes are made to the same project/solution file from two different people the second person will get a conflict notice. Warning, it can be tricky to merge project and solution files. Sometimes it's easier to just toss the changes and add the files back manually then check in again.
You could try Agent SVN plugin. It integrates with VS 2005, VS 2008 and VS 2010 and it also has a import wizard feature that makes it easy to import the solution and all project files into the SVN repository.
I use this free Visual Studio plugin http://ankhsvn.open.collab.net/ for working with SVN repo ...
VisualSVN integrates well into VS.