I was trying to create a Template that takes in a Type
to substitute it's name in a template.
The template looks like this
using System;
using System.Collections.Generic;
using System.Text;
namespace $rootnamespace$
{
public class $safeitemrootname$<$TView$>
{
}
}
I substitute the $TView$
parameter with the selected Type
in my custom IWizard
.
public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
{
DTE dte = (DTE)automationObject;
Project project = dte.SelectedItems.Item(1) as Project;
VSProject vsProj = (VSProject)project.Object;
foreach (Reference reference in vsProj.References)
{
if (reference.SourceProject == null)
{
// Assembly reference
}
else
{
// Project reference
}
}
}
The real problem comes in here: how can I show a grid with all the Types
in all of the referenced assemblies of a project?
I tried to do load the Assembly with Assembly.Load
, Assembly.LoadFrom
, Assembly.ReflectionOnlyLoad
, Assembly.ReflectionOnlyLoadFrom
and many others (also with AppDomain
), but I alwais get an error asking to load the dependencies first.
Is there any way to get the defined types in all assemblies of a project with envDTE
or Reflection
?