Skip to content

Commit 7d7c497

Browse files
committed
Upgrade to .NET5
1 parent d161321 commit 7d7c497

9 files changed

+31
-37
lines changed

Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
</PropertyGroup>
1616

1717
<PropertyGroup>
18-
<TargetFramework>net461</TargetFramework>
18+
<UseWindowsForms>true</UseWindowsForms>
19+
<TargetFramework>net5.0-windows7.0</TargetFramework>
1920
<VersionPrefix>1.0.0</VersionPrefix>
2021
</PropertyGroup>
2122
</Project>

src/GitExtensions.GerritPlugin/FormGerritDownload.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private async Task<JObject> LoadReviewInfoAsync(int? patchSet = null)
196196

197197
if (projectName.EndsWith(".git"))
198198
{
199-
projectName = projectName.Substring(0, projectName.Length - 4);
199+
projectName = projectName[..^4];
200200
}
201201

202202
string change = await GerritUtil

src/GitExtensions.GerritPlugin/FormGerritPublish.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ private void FormGerritPublishLoad(object sender, EventArgs e)
177177
int remoteIndex = remotes.IndexOf(_currentBranchRemote);
178178
_NO_TRANSLATE_Remotes.SelectedIndex = remoteIndex >= 0 ? remoteIndex : 0;
179179

180-
_NO_TRANSLATE_Branch.DataSource = Module.GetRefs(false).Select(branch => branch.LocalName).ToList();
180+
_NO_TRANSLATE_Branch.DataSource = Module.GetRefs(RefsFilter.Remotes)
181+
.Select(branch => branch.LocalName)
182+
.ToList();
181183
_NO_TRANSLATE_Branch.Text = GetBranchName(Settings.DefaultBranch);
182184

183185
var branches = (IList<string>)_NO_TRANSLATE_Branch.DataSource;

src/GitExtensions.GerritPlugin/GerritPlugin.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private void UpdateGerritMenuItems(object sender, GitUIEventArgs e)
9494
bool isEnabled = _gerritEnabled.ValueOrDefault(Settings);
9595
bool hasGitreviewFile = File.Exists(Path.Combine(gitModule.WorkingDir, ".gitreview"));
9696
bool showGerritItems = isEnabled && isValidWorkingDir && hasGitreviewFile;
97-
bool hasValidCommitMsgHook = HasValidCommitMsgHook(gitModule, true);
97+
bool hasValidCommitMsgHook = showGerritItems && HasValidCommitMsgHook(gitModule, true);
9898

9999
if (isValidWorkingDir)
100100
{
@@ -430,7 +430,7 @@ private async Task<string> DownloadFromScpAsync(GerritSettings settings)
430430
return null;
431431
}
432432

433-
string header = content.Substring(0, index);
433+
string header = content[..index];
434434

435435
if (!header.EndsWith(" commit-msg"))
436436
{
@@ -440,7 +440,7 @@ private async Task<string> DownloadFromScpAsync(GerritSettings settings)
440440
// This looks like a valid scp response; return the rest of the
441441
// response.
442442

443-
content = content.Substring(index + 1);
443+
content = content[(index + 1)..];
444444

445445
// The file should be terminated by a nul.
446446

@@ -450,7 +450,7 @@ private async Task<string> DownloadFromScpAsync(GerritSettings settings)
450450

451451
if (index != -1)
452452
{
453-
content = content.Substring(0, index);
453+
content = content[..index];
454454
}
455455

456456
return content;

src/GitExtensions.GerritPlugin/GerritUtil.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static async Task<string> RunGerritCommandAsync(
8181

8282
var sshCmd = GitSshHelpers.Plink()
8383
? AppSettings.Plink
84-
: SshPathLocatorInstance.Find(AppSettings.GitBinDir);
84+
: SshPathLocatorInstance.GetSshFromGitDir(AppSettings.GitBinDir);
8585

8686
if (string.IsNullOrEmpty(sshCmd))
8787
{
@@ -115,7 +115,7 @@ public static async Task<string> RunGerritCommandAsync(
115115

116116
sb.Append(" \"");
117117
sb.Append(command);
118-
sb.Append("\"");
118+
sb.Append('"');
119119

120120
return await new Executable(sshCmd)
121121
.GetOutputAsync(sb.ToString(), stdIn)

src/GitExtensions.GerritPlugin/GitExtensions.GerritPlugin.csproj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
55
</PropertyGroup>
66

7-
<ItemGroup>
8-
<Reference Include="System.ComponentModel.Composition" />
9-
<Reference Include="System.Windows.Forms" />
10-
</ItemGroup>
11-
127
<ItemGroup>
138
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0">
149
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
1510
</PackageReference>
16-
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.5.132">
11+
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="16.9.20">
12+
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
13+
</PackageReference>
14+
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.10.56">
1715
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
1816
</PackageReference>
1917
<PackageReference Include="Newtonsoft.Json" Version="13.0.1">
@@ -48,7 +46,6 @@
4846
</ItemGroup>
4947

5048
<ItemGroup>
51-
<None Include="app.config" />
5249
<None Include="Resources\GerritDownload.png" />
5350
<None Include="Resources\GerritInstallHook.png" />
5451
<None Include="Resources\GerritPublish.png" />
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<!-- path is relative to $(ProjectDir) -->
5-
<GitExtensionsDownloadPath>..\..\..\gitextensions.shared</GitExtensionsDownloadPath>
6-
<!-- 'latest' or 'v3.1' (= tag from GitHub releases) or 'v3.1.0.5877' (= build number from AppVeyor)-->
7-
<GitExtensionsReferenceVersion>v3.5.4</GitExtensionsReferenceVersion>
8-
<!-- 'GitHub' or 'AppVeyor' -->
9-
<GitExtensionsReferenceSource>GitHub</GitExtensionsReferenceSource>
10-
<!-- for local builds (no download) -->
11-
<GitExtensionsPath />
12-
</PropertyGroup>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<!-- path is relative to $(ProjectDir) -->
5+
<GitExtensionsDownloadPath>..\..\..\gitextensions.shared</GitExtensionsDownloadPath>
6+
<!-- 'latest' or 'v3.1' (= tag from GitHub releases) or 'v3.1.0.5877' (= build number from AppVeyor)-->
7+
<GitExtensionsReferenceVersion>v3.6.0.12924</GitExtensionsReferenceVersion>
8+
<!-- 'GitHub' or 'AppVeyor' -->
9+
<GitExtensionsReferenceSource>AppVeyor</GitExtensionsReferenceSource>
10+
<!-- for local builds (no download) -->
11+
<GitExtensionsPath />
12+
</PropertyGroup>
1313
</Project>

src/GitExtensions.GerritPlugin/GitExtensions.GerritPlugin.nuspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
<group>
1414
<dependency id="GitExtensions.Extensibility" version="[0.1.0, 1.0.0)" />
1515
</group>
16-
<!-- To fix Warning NU5128 Add a dependency group for .NETFramework4.6.1 to the nuspec GitExtensions.GerritPlugin -->
17-
<group targetFramework=".NETFramework4.6.1">
16+
<!-- To fix Warning NU5128 Add a dependency group for net5.0-windows7.0 to the nuspec -->
17+
<group targetFramework="net5.0-windows7.0">
1818
<dependency id="GitExtensions.Extensibility" version="[0.1.0, 1.0.0)" />
1919
</group>
2020
</dependencies>
2121
</metadata>
2222
<files>
2323
<file src="..\..\LICENSE.md" target="\" />
24-
<file src="bin\$configuration$\net461\GitExtensions.GerritPlugin.dll" target="\lib\net461\" />
24+
<file src="bin\$configuration$\net5.0-windows7.0\GitExtensions.GerritPlugin.dll" target="\lib\net5.0-windows7.0\" />
2525
<file src="Resources\IconGerrit.png" target="\Resources\" />
2626
</files>
2727
</package>

src/GitExtensions.GerritPlugin/app.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)