Skip to content

Commit cc9f222

Browse files
authored
Fix changes view (#31)
* proper target version to mef components * fix: only load proper version of assemblies Previous version was loading all versions (2015, 2017, 2019) due to assembly scanning, now we only pick the proper one * fix: "open local config" not enabled if file doesn't exist
1 parent 8ab8432 commit cc9f222

File tree

6 files changed

+28
-15
lines changed

6 files changed

+28
-15
lines changed

vs-commitizen.Settings/ExtensionRegistry.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,22 @@ public ExtensionRegistry()
1414
this.Scan(i =>
1515
{
1616
i.TheCallingAssembly();
17-
i.AssembliesFromPath(Path.GetDirectoryName(Assembly.GetCallingAssembly().Location));
17+
i.Assembly("vs-commitizen");
18+
19+
var productMajorPart = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileVersionInfo.ProductMajorPart;
20+
if (productMajorPart == 14)
21+
{
22+
i.Assembly("vs-commitizen.vs2015");
23+
}
24+
else if (productMajorPart == 15)
25+
{
26+
i.Assembly("vs-commitizen.vs2017");
27+
}
28+
else if (productMajorPart >= 16)
29+
{
30+
i.Assembly("vs-commitizen.vs2019");
31+
}
32+
1833
i.WithDefaultConventions();
1934
i.LookForRegistries();
2035
});

vs-commitizen.Tests/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:vs_commitizen.Tests"
7-
xmlns:vs="clr-namespace:vs_commitizen.vs;assembly=vs-commitizen.vs2017" x:Class="vs_commitizen.Tests.MainWindow"
7+
xmlns:vs="clr-namespace:vs_commitizen.vs;assembly=vs-commitizen.vs2019" x:Class="vs_commitizen.Tests.MainWindow"
88
mc:Ignorable="d"
99
Title="MainWindow" Height="650" Width="525">
1010
<Grid>

vs-commitizen.Tests/vs-commitizen.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<EmbedInteropTypes>False</EmbedInteropTypes>
5555
</Reference>
5656
<Reference Include="Microsoft.TeamFoundation.Controls">
57-
<HintPath>..\lib\vs2017\Microsoft.TeamFoundation.Controls.dll</HintPath>
57+
<HintPath>..\lib\vs2019\Microsoft.TeamFoundation.Controls.dll</HintPath>
5858
</Reference>
5959
<Reference Include="PresentationCore" />
6060
<Reference Include="PresentationFramework" />
@@ -93,9 +93,9 @@
9393
<Project>{1952D753-DC63-46B4-9561-7D84CF215D6A}</Project>
9494
<Name>vs-commitizen.Settings</Name>
9595
</ProjectReference>
96-
<ProjectReference Include="..\vs-commitizen.vs2017\vs-commitizen.vs2017.csproj">
97-
<Project>{93748016-5aa8-4d74-887e-64959d8d2496}</Project>
98-
<Name>vs-commitizen.vs2017</Name>
96+
<ProjectReference Include="..\vs-commitizen.vs2019\vs-commitizen.vs2019.csproj">
97+
<Project>{c6ecb6ff-d446-499c-b3cc-db5cb6455db7}</Project>
98+
<Name>vs-commitizen.vs2019</Name>
9999
</ProjectReference>
100100
<ProjectReference Include="..\vs-commitizen\vs-commitizen.csproj">
101101
<Project>{8382bf18-b8bc-4c54-9826-8d9d20cd868d}</Project>

vs-commitizen.vs2019/vs-commitizen.vs2019.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@
3333
<WarningLevel>4</WarningLevel>
3434
</PropertyGroup>
3535
<ItemGroup>
36-
<Reference Include="Microsoft.TeamFoundation.Controls, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
36+
<Reference Include="Microsoft.TeamFoundation.Controls">
3737
<HintPath>..\lib\vs2019\Microsoft.TeamFoundation.Controls.dll</HintPath>
38-
<SpecificVersion>False</SpecificVersion>
3938
<Private>False</Private>
4039
</Reference>
4140
<Reference Include="Microsoft.TeamFoundation.Git.Controls">
4241
<HintPath>..\lib\vs2019\Microsoft.TeamFoundation.Git.Controls.dll</HintPath>
42+
<Private>False</Private>
4343
</Reference>
4444
<Reference Include="Microsoft.TeamFoundation.Git.Provider">
4545
<HintPath>..\lib\vs2019\Microsoft.TeamFoundation.Git.Provider.dll</HintPath>
46+
<Private>False</Private>
4647
</Reference>
4748
<Reference Include="PresentationCore" />
4849
<Reference Include="PresentationFramework" />

vs-commitizen/Infrastructure/ConfigFileProvider.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,7 @@ public async Task<string> TryGetLocalConfigAsync()
112112
var (isRepositoryLoaded, repositoryPath) = await GetLocalPathAsync(); // await GetCurrentSolutionAsync();
113113
if (isRepositoryLoaded)
114114
{
115-
var localConfigPath = Path.Combine(repositoryPath, CONFIGFILE_NAME);
116-
117-
if (this.fileAccessor.Exists(localConfigPath))
118-
return localConfigPath;
115+
return Path.Combine(repositoryPath, CONFIGFILE_NAME);
119116
}
120117

121118
return string.Empty;

vs-commitizen/source.extension.vsixmanifest

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
</Prerequisites>
2323
<Assets>
2424
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
25-
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%.vs2015" Path="|vs-commitizen.vs2015|" />
26-
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%.vs2017" Path="|vs-commitizen.vs2017|" />
25+
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%.vs2015" Path="|vs-commitizen.vs2015|" TargetVersion="[14.0,15.0)" />
26+
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%.vs2017" Path="|vs-commitizen.vs2017|" TargetVersion="[15.0,16.0)" />
2727
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%.Settings" Path="|vs-commitizen.Settings|" />
28-
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%.vs2019" Path="|vs-commitizen.vs2019|" />
28+
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%.vs2019" Path="|vs-commitizen.vs2019|" TargetVersion="[16.0,17.0)" />
2929
</Assets>
3030
</PackageManifest>

0 commit comments

Comments
 (0)