To download sources see DxCore plugins for Xaf are moving
Updates
(10/6/09) (see Xaf Exception Stack Explorer)
(17/6/09) (see Coderush plugins for Xaf update1)
(19/6/09) (see Coderush plugins for Xaf update2)
ProjectConverter
Browsing and downloading from Devexpress support center often I find old projects with broken references
Old days when i see broken references at my solution due to version changes I had to go to my C:\Program files\pathToYourProjectConverter executable. Open it, browse to find my solution folder and convert it
Nowadays I am using a small CodeRush addin I wrote and I can convert any solution from with in Visual Studio By pressing a shortcut. You have to configure it by setting its path as shown in the image bellow
if you use a recompile version of the assemblies you can also set at the PublicToken field
Then you go to shortcuts and assign a shortcut key for the convertProject command
now every time i need to convert a solution i just hit Ctrl+Shift+Alt+C and voila
ModelEditor
Tired of seeing Visual studio errors like
Bug Report Details: XAF Model Designer issue: Possible reason: the assembly 'abc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d70b2af257f40453' has been loaded twice.
me and my friend John were tired also so one day in a half of our 5 hours long skype meeting we decide to write an CodeRush addin that will use the ModelEditor executable provided by Devexpress. So any time i want to use model editor at design time I use that addin
What it does ? It searches your solution for all projects that have a model.xafml file and shows them in a list where by pressing enter or double click will open the modified Model Editor (source included for this one also)
You should configure it using the same approach as project converter .
To install the addin download from here XafAddins(source,binary) copy the assemblies to your community plugins folder or build the sources
the first time you will run it you have to configure it with an approach same to ProjectConverters
see video bellow
Enjoy!!!
Update 5/6/2009
After try to use it with a more complex solution like this one
i noticed that the plugin enumerates only root project
Lets fix that. First i though that this is too basic and maybe i am missing something so lets ask DevExpress support .
List of Projects in a solution not a good answer eh? Maybe they didn’t understand me well or maybe they were too busy.
This shouldn’t be too hard to find so i search a little more on support center and i find this Find in Solution Explorer and also Enumerating projects in a Visual Studio solution
Now we know how to enumerate through all items in a solution and the type of each item !!! the next part is easy. Just write the code and adding it as an extension to EnvDTE.Solution class cause i think its an appropriate place to find there
public static class SolutionExtension
{
public static List<Project> GetAllProjects(this Solution solution)
{
var DTE = CodeRush.ApplicationObject;
var UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object as UIHierarchy;
var projects = new List<Project>();
if (UIHSolutionExplorer != null && UIHSolutionExplorer.UIHierarchyItems.Count > 0)
ProcessSolutionExplorerItem(UIHSolutionExplorer.UIHierarchyItems.Item(1),projects);
return projects;
}
private static void ProcessSolutionExplorerItem(UIHierarchyItem item, List<Project> projects)
{
if (item.UIHierarchyItems.Count > 0)
for (int i = 1; i <= item.UIHierarchyItems.Count; i++)
{
UIHierarchyItem hierarchyItem = item.UIHierarchyItems.Item(i);
object o = hierarchyItem.Object;
if (o is Project && !isSolutionFolder(o))
projects.Add((Project) o);
else if (o is ProjectItem)
{
Project project = ((ProjectItem) o).SubProject;
if (project != null && !isSolutionFolder(project))
projects.Add(project);
}
ProcessSolutionExplorerItem(hierarchyItem, projects);
}
}
private static bool isSolutionFolder(object o)
{
return ((Project)o).Kind == "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}";
}
}
Limitation: if one assembly references another assembly in the project, you need to set 'Copy Local' = true for the referenced assemly otherwise a 'FileNotFound' error pops up when you try to view the model
thnks Steven :)
Collapse all items in solution Explorer
Since all my application are now heavily based on modularization i tend to have a solution template that i use to start a new solution. That solution project count is now roughly about 80 project and I often find myself lost in solution explorer.
So i decided to write a command for CodeRush to help me collapse all items by pressing a shortcut. The command name is collapseAllItemsInSolutionExplorer
public static void CollapseAllFolders(this Solution solution)
{
var DTE = CodeRush.ApplicationObject;
var UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object as UIHierarchy;
if (UIHSolutionExplorer== null||UIHSolutionExplorer.UIHierarchyItems.Count == 0)
return;
UIHierarchyItem rootItem = UIHSolutionExplorer.UIHierarchyItems.Item(1);
rootItem.DTE.SuppressUI = true;
Collapse(rootItem,UIHSolutionExplorer);
// Select the solution node, or else when you click
// on the solution window
// scrollbar, it will synchronize the open document
rootItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
rootItem.DTE.SuppressUI = false;
}
private static void Collapse(UIHierarchyItem item, UIHierarchy solutionExplorer)
{
foreach (UIHierarchyItem hierarchyItem in item.UIHierarchyItems)
{
if (hierarchyItem.UIHierarchyItems.Count>0)
{
Collapse(hierarchyItem, solutionExplorer);
if (hierarchyItem.UIHierarchyItems.Expanded)
hierarchyItem.UIHierarchyItems.Expanded = false;
}
}
}
Enjoy!!!







17 comments: