Capture.JPGHi All,
I am trying to create an extension (vSix) for VS2022. The idea is to get all the pending file details and forward them to some other tools. I am unable to resolve the problem. If anyone has a suggestion, then please let me know.
I had created the extension for VS2019 and its working. But for VS2022 its not working.
Thanks in Advance.
Exception:
System.ComponentModel.Composition.CompositionContractMismatchException: Cannot cast the underlying exported value of type 'Microsoft.VisualStudio.Composition.NetFxAdapters+MefV1ExportProvider+ComposablePartForExportFactory' to type 'Microsoft.TeamFoundation.Controls.ITeamExplorerSection'.
at System.ComponentModel.Composition.ExportServices.CastExportedValue[T](ICompositionElement element, Object exportedValue)
at System.ComponentModel.Composition.ReflectionModel.ExportFactoryCreator.LifetimeContext.GetExportLifetimeContextFromExport[T](Export export)
at System.ComponentModel.Composition.ExportFactory`1.CreateExport()
at Microsoft.TeamFoundation.Controls.WPF.TeamExplorer.Framework.TeamExplorerSectionHost.Create()
using Microsoft.TeamFoundation.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VSIXProject1
{
[TeamExplorerSection("C406700D-28E8-4955-8885-4D98D4D49C10", TeamExplorerPageIds.PendingChanges, 35)]
public class FindPendingChanges : Microsoft.TeamFoundation.Controls.ITeamExplorerSection
{
public string Title => throw new NotImplementedException();
private IServiceProvider ServiceProvider { get; set; }
public object SectionContent => throw new NotImplementedException();
public bool IsVisible { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public bool IsExpanded { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public bool IsBusy => throw new NotImplementedException();
public event PropertyChangedEventHandler PropertyChanged;
event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
{
add
{
throw new NotImplementedException();
}
remove
{
throw new NotImplementedException();
}
}
public void Initialize(object sender, SectionInitializeEventArgs e)
{
System.Diagnostics.Debugger.Launch();
ServiceProvider = e.ServiceProvider;
if (!(ServiceProvider.GetService(typeof(ITeamExplorer)) is ITeamExplorer teamExplorer))
{
}
}
public void Cancel()
{
throw new NotImplementedException();
}
public void Dispose()
{
throw new NotImplementedException();
}
public object GetExtensibilityService(Type serviceType)
{
throw new NotImplementedException();
}
public void Loaded(object sender, SectionLoadedEventArgs e)
{
throw new NotImplementedException();
}
public void Refresh()
{
throw new NotImplementedException();
}
public void SaveContext(object sender, SectionSaveContextEventArgs e)
{
throw new NotImplementedException();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="VSIXProject1.24da91b7-bb83-436f-9613-e0bc24223cc1" Version="1.0" Language="en-US" Publisher="XYZ" />
<DisplayName>VSIXProject1</DisplayName>
<Description>Empty VSIX Project.</Description>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0,18.0)">
<ProductArchitecture>x86</ProductArchitecture>
</InstallationTarget>
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,18.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>
</PackageManifest>