Adding a TestSettings file to SolutionItems in VisualStudio - c#

((EnvDTE80.Solution2)dte.Solution).GetProjectItemTemplate("Test Settings", "Test");
I need to add a new TestSettings object programmatically to a C# project in Visual Studio. To do this I need to get the path of the template file. The call to GetProjectItemTemplate should do this, but fails for this type of template. Other template types, for example, a CSharp class, work fine. Even custom types that I have registered work fine. But not the TestSettings type.
You can see the template in this zip file:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\Test\1033\TestSettings.zip
Any idea why this template type doesn't work?

You are not the only person to have issues with "test settings", a chap on the forum
below resorted to unloading, editing the project xml and reloading it in order to update
the settings...
Its a bit of a faff but it could be some solution..
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/a1160459-23e3-4bd4-a672-d204eb9ffa4c/

In VS 2017 it is there under the solution.
Right click on Solution|Add Item...|Test Settings

Related

Visual Studio 2015 project fails adding to source control

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.

How to add a Setup project through Visual Studio DTE?

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.

Cannot compile TypeScript files in Visual Studio 2012

I downloaded and installed TypeScript extension for VS 2012, I got my first sample compiles by manually dragging the ts file onto the tsc.exe file! because no other way to compile the file will work.
I don't want to manually do this everytime I want to debug a page! I have read about 5 articles on the web and none of the solutions work. I've tried adding TypeScript compiler to PATH in Windows, I've tried downloading and installing via Nuget Package Manager the Sholo thing, I've tried these pages:
Using TypeScript in cshtml files
Visual Studio TypeScript Options
Debugging TypeScript code with Visual Studio
Cannot compile typescript using tsc node module
TypeScript - Visual Studio - d3
Visual Studio 2012 TypeScript project ignoring two files during compile
TypeScript / Visual Studio 2012 / Compilation parameters
Using TypeScript in an existing Visual Studio Web Site project
Visual Studio TypeScript Options
Compile generated files in Visual Studio
And not a single solution has worked.
I have even downloaded and installed the Web Essentials plugin for Visual Studio and gone to Options menu, then selected "Compile all TypeScript files on Build = True" and "Compile TypeScript on Save = True" - but nothing works.
I've read the entire TypeScript website, the specification, and even their discussion tab on the codeplex site.
How can I get TypeScript to compile when I save changes to the .ts file or when I press F5/Debug/Build?
*I don't really want any third-party scripts/plugins, etc unless it's absolutely necessary. I've seen a couple of them and it's just ... there's no point. I might as well just write pure JavaScript.
You have to ensure that the BuildAction must be TypeScriptCompile for your .ts files.
I've added these lines to end of the (.csproj) project file. (Before closing Project tag)
And It seems working.
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptTarget>ES3</TypeScriptTarget>
<TypeScriptIncludeComments>true</TypeScriptIncludeComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptTarget>ES3</TypeScriptTarget>
<TypeScriptIncludeComments>false</TypeScriptIncludeComments>
<TypeScriptSourceMap>false</TypeScriptSourceMap>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
</PropertyGroup>
<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" />
I had a similar problem when I renamed my .js files to .ts. You have to right click and add a new TypeScript File to your project in order for your .csproj to recognize that the TypeScript compiler should be used on this .ts file.
You will know it is correct when you see the arrow to expand the .ts file.
If you change a .js file into a .ts file, you can go to the properties panel in Visual Studio and change the Build Action to TypeScriptCompile. This is what is missing when you change a file. This can save you from deleting and re-adding files.
I had the same problem. I couldn't add new .ts file to the project. After renaming from .js to .ts file was not compiled. It even was not compiled using tsc in command line.
BUT! After recreating the file in windows explorer it was compiled successfully. And after manually creating file in windows explorer (not Visual Studio) in Scripts folder and including it to the project - all WORKS. I couldn't detect changes between these two files. But if you create text file in explorer, rename it to .ts and after that include in project and set file's Build Action to TypeScriptCompile - it works.
plug
I create a NuGet package that adds a afterbuild target to your project so all the included ts files are compiled to js.
Install-Package TypeScript.Compile
I had the same problem. I updated web essentials extention and problem is solved. If you have web essentials extention, you can try that.
Please check if you have invalid TypeScript. There are some TypeScript errors that don't show up in the Error List, but they prevent TypeScript Compile-On-Save and show a Output generation failed message in the Visual Studio status bar.
These are the TypeScript errors that can cause this:
exporting a class which is not inside of a module (v 0.9.5).
Please let me know if there are more such errors, I'll add them here.

Multiple icons in executable in VS2010

I have Googled and found multiple ways of adding multiple icons into the executable, but they all seem to work for VS 2003-2005-2008, nothing for VS2010. I have not tried the Win32 resource with /win32res because I do not know how to use it (can't figure to get a good Google result for that either).
Any simple suggestion?
I've just created a simple tool to do exactly this without having to mess with .res files. It's a tiny utility which you can use as part of your Post-Build event and lets you add all icons files in a particular folder to your assembly. If we assume that you have a icons folder under your main project folder you can add the following post-build event:
C:\path\to\InsertIcons.exe $(TargetPath) $(ProjectDir)icons
A further description and a download can be found at http://einaregilsson.com/add-multiple-icons-to-a-dotnet-application/
This works for me:
http://www.codeproject.com/Tips/160885/How-to-Embed-Multiple-Icons-and-Color-Animated-Cur.aspx
If you're using visual studio 2012:
For C#.NET Here I found a good solution for this problem for c# projects as an example. But it only works in my C# projects
Create a new "Native Resource Template" from the File | New dialog box.
In project properties(project->application->resources) there is option to choose resource file (.res) rather than "Icon and manifest" which is selected by default (This option is visible only to C# projects!).
For VB.Net projects this link (Also mentioned here by Waldo) can be more helpful because in my visual 2012 there is no option to select/browse Native Resource Template(.res) files but you could manually change project definition file for vb.net project as described to compile project win a native win32 resource file:
Open your project file in notepad (*.vbProj) and add the following block:
<PropertyGroup>
<Win32Resource>assemblyWin32.res</Win32Resource>
</PropertyGroup>
The Code Project article explains how to create a "assemblyWin32.res" file.
https://www.codeproject.com/Tips/160885/%2fTips%2f160885%2fHow-to-Embed-Multiple-Icons-and-Color-Animated-Cur

Any way to modify existing files in a Visual Studio Template?

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.)

Categories