mayerwin / vs-customize-window-title

Customize Visual Studio Window Title - Visual Studio Extension
https://marketplace.visualstudio.com/items?itemName=mayerwin.RenameVisualStudioWindowTitle
MIT License
108 stars 30 forks source link

tfsBranchName does not work on VS2019 #43

Closed timhaovo closed 5 years ago

timhaovo commented 5 years ago

tfsBranchName does not work in VS2019, because it somehow fails to resolve the new vesions of the TFS assemblies, despite having "Specific Version"=false for the references.

Manual matching of the assemblies to the loaded assemblies in AssemblyResolve fixes the issue, though:

    YourVsixPackageConstructor()
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
        }

        private System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            if (args.Name.StartsWith("Microsoft.TeamFoundation.") || args.Name.StartsWith("Microsoft.VisualStudio.Services.")) {
                var aname = new System.Reflection.AssemblyName(args.Name);
                foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
                {
                    if (asm.GetName().Name == aname.Name)
                        return asm;
                }
            }
            return null;
        }
mayerwin commented 5 years ago

Thanks, I'll implement this! Specific Version=false will only work if there are Assembly bindings set up for this assembly in devenv, which doesn't seem to be the case. So I believe your solution is the best. The only other option would be to reference the Nuget package for the TFS client, but this would bloat the extension.

mayerwin commented 5 years ago

Fixed with 4.3.3, let me know if you notice any issue.