1 Copy Avalonia URL using EnvDTE; using System; using System.Collections; using System.IO; using System.Linq; using System.Windows.Forms; public class C : VisualCommanderExt.ICommand { public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package) { var toolWindow = DTE.ToolWindows; var solutionExplorer = toolWindow.SolutionExplorer; var selectedItems = (solutionExplorer.SelectedItems as IEnumerable).OfType<UIHierarchyItem>().Select(i=>i.Object).OfType<ProjectItem>(); var selectedItem = selectedItems.FirstOrDefault(); if (selectedItem == null) return; var project = selectedItem.ContainingProject; var projectPath = project.FullName; var projectName = Path.GetFileNameWithoutExtension(projectPath); var projectDirPath = Path.GetDirectoryName(projectPath); var filePath = selectedItem.FileNames[0]; var partPath = filePath.Substring(projectDirPath.Length); var url = GetAvaloniaURL(projectName, partPath); //Console.WriteLine(url); Clipboard.SetText(url); } string GetAvaloniaURL(string assemblyName, string relPath) { var relPathFixed = relPath.Replace('\\', '/'); return "avares://" + assemblyName + relPathFixed ; } } Command CS v4.0 true false 2 Copy WPF URL using EnvDTE; using System; using System.Collections; using System.IO; using System.Linq; using System.Windows.Forms; public class C : VisualCommanderExt.ICommand { public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package) { var toolWindow = DTE.ToolWindows; var solutionExplorer = toolWindow.SolutionExplorer; var selectedItems = (solutionExplorer.SelectedItems as IEnumerable).OfType<UIHierarchyItem>().Select(i=>i.Object).OfType<ProjectItem>(); var selectedItem = selectedItems.FirstOrDefault(); if (selectedItem == null) return; var project = selectedItem.ContainingProject; var projectPath = project.FullName; var projectName = Path.GetFileNameWithoutExtension(projectPath); var projectDirPath = Path.GetDirectoryName(projectPath); var filePath = selectedItem.FileNames[0]; var partPath = filePath.Substring(projectDirPath.Length); var url = GetWPFURL(projectName, partPath); //Console.WriteLine(url); Clipboard.SetText(url); } string GetWPFURL(string assemblyName, string relPath) { var relPathFixed = relPath.Replace('\\', '/'); return "pack://application:,,,/"+assemblyName+";component"+relPathFixed; } } Command CS v4.0 true false