Visual Studio and T4
-
VS2017 Failed To Install – Setup Failed To Detect Shared Configuration
Visual Studio 2017 setup failed with setup failed to detect shared configuration. The log pointed at Web Deploy, and reinstalling the IIS Windows feature fixed it.
-
TFS: Get And Modify Included And Excluded Pending Changes in Visual Studio
Read and change which pending changes are included or excluded in the Team Explorer Pending Changes view from a Visual Studio package.
-
Adding Solution Folders Via Visual Studio Automation
Create the virtual solution folders shown in Solution Explorer from code through EnvDTE, rather than adding them by hand.
-
Add A Namespace Import Via Visual Studio Automation
Read and add namespace imports, using in C# or Imports in VB, in a code document through Visual Studio automation with FileCodeModel and CodeImport.
-
Automatically Loading VSIX Packages
Make a VSIX package load even though it contributes no menu item, command or tool window, by applying ProvideAutoLoadAttribute with a suitable UI context.
-
Use T4 Templates For XSLT Transformation
Run XSLT style sheets from a T4 template so Visual Studio's normal template integration triggers the transformation, and the one obstacle that gets in the way.
-
Resolve Visual Studio Macros In VSIX Packages Or T4 Templates
Resolve Visual Studio macros such as ProjectDir, ConfigurationName and OutDir from your own VSIX package or T4 template using IVsBuildMacroInfo.
-
Inheriting a T4 Template and Calling EnvDTE.DTE: The System Cannot Find The File Specified
Moving T4 logic into a base class that loads the automation object fails with the system cannot find the file specified. What breaks assembly resolution, and how to avoid it.
-
Get The ProjectItem of a T4 Template From Inside the T4 Template
Reach the ProjectItem of a running T4 template, or its parent project, by making the template host-specific and going through Visual Studio automation.
-
Write To Visual Studio’s Output Window
Write messages into a pane of the Visual Studio Output window from an extension, using IVsOutputWindow and making sure the pane is visible.
-
Modal WPF Windows And The Visual Studio Window
Show a modal WPF dialog from a Visual Studio extension by taking the IDE's main window handle and passing it to WindowInteropHelper.
-
Tell if an EnvDTE.Project is a Web Application
Deciding whether an EnvDTE project is a web application is awkward because of a Visual Studio bug. Code that answers it reliably enough to know which config file to expect.
-
Write To Visual Studio’s Error List
Add errors, warnings and messages to the Visual Studio Error List from an extension with ErrorListProvider, including navigation back to the offending file.
-
Get Project References From EnvDTE.Project
Enumerate the assembly and project references of a Visual Studio project from an extension by casting Project.Object to VSLangProj.VSProject.
-
Manually Applying XML Document Transform (XDT)
Apply an XDT transform to a web.config or app.config in your own code, using the transformation classes from Microsoft.Web.Publishing.Tasks.
-
Convert IVsHierarchy to ProjectItem or Project
Convert an IVsHierarchy into an EnvDTE Project or ProjectItem by reading the VSHPROPID_ExtObject property for the item you are interested in.
-
Code Generation And Manipulation Using T4 Templates And Visual Studio Automation By Sample
A worked example that generates a DbContext with T4 while inspecting and modifying existing project items through Visual Studio automation.