Skip to content

Commit f4b50c4

Browse files
author
Matthew John Cheetham
authored
Fix the build in Visual Studio (#1711)
Michael J. Lyons reached out privately and reported a problem with building inside Visual Studio. The symptom is: | Error (active) | MSB4044 | The "GenerateWindowsAppManifest" task was not given a value for the required parameter "Version". | | - | - | - | This PR fixes this error, and then also addresses all the warnings pointed out by Visual Studio.
2 parents 4e8e593 + 1a774c1 commit f4b50c4

34 files changed

+197
-161
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<ItemGroup Condition = "'$(TargetFramework)' == 'net472'">
3030
<PackageReference Include="System.Text.Json">
31-
<Version>7.0.2</Version>
31+
<Version>8.0.4</Version>
3232
</PackageReference>
3333
</ItemGroup>
3434

Directory.Build.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Import Project="$(RepoPath)build\GCM.tasks" />
77

88
<!-- Use version specified in VERSION file -->
9-
<Target Name="GetVersion" BeforeTargets="BeforeBuild">
9+
<Target Name="GetVersion" BeforeTargets="BeforeBuild;GenerateWindowsAppManifest">
1010
<GetVersion VersionFile="$(RepoPath)VERSION">
1111
<Output TaskParameter="Version" PropertyName="Version" />
1212
<Output TaskParameter="AssemblyVersion" PropertyName="AssemblyVersion" />
@@ -21,6 +21,7 @@
2121

2222
<!-- Generate the manifest file before we set the win32 manifest properties -->
2323
<Target Name="GenerateWindowsAppManifest"
24+
AfterTargets="GetVersion"
2425
BeforeTargets="SetWin32ManifestProperties"
2526
Condition="'$(GenerateWindowsAppManifest)' != 'false'"
2627
Inputs="$(FileVersion);$(AssemblyName)"

src/shared/Atlassian.Bitbucket.Tests/Atlassian.Bitbucket.Tests.csproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="coverlet.collector" Version="3.1.0">
11+
<PackageReference Include="coverlet.collector" Version="6.0.2">
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
<PrivateAssets>all</PrivateAssets>
1414
</PackageReference>
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
16-
<PackageReference Include="ReportGenerator" Version="5.1.9" />
17-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
16+
<PackageReference Include="ReportGenerator" Version="5.3.10" />
17+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
18+
<PrivateAssets>all</PrivateAssets>
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20+
</PackageReference>
1821
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
1922
</ItemGroup>
2023

src/shared/Core.Tests/ApplicationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public async Task Application_UnconfigureAsync_EmptyAndGcmWithOthersBefore_Remov
244244

245245
Assert.Single(context.Git.Configuration.Global);
246246
Assert.True(context.Git.Configuration.Global.TryGetValue(key, out var actualValues));
247-
Assert.Equal(1, actualValues.Count);
247+
Assert.Single(actualValues);
248248
Assert.Equal(beforeHelper, actualValues[0]);
249249
}
250250

src/shared/Core.Tests/Authentication/BasicAuthenticationTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ namespace GitCredentialManager.Tests.Authentication
1212
public class BasicAuthenticationTests
1313
{
1414
[Fact]
15-
public void BasicAuthentication_GetCredentials_NullResource_ThrowsException()
15+
public async Task BasicAuthentication_GetCredentials_NullResource_ThrowsException()
1616
{
1717
var context = new TestCommandContext();
1818
var basicAuth = new BasicAuthentication(context);
1919

20-
Assert.ThrowsAsync<ArgumentNullException>(() => basicAuth.GetCredentialsAsync(null));
20+
await Assert.ThrowsAsync<ArgumentNullException>(() => basicAuth.GetCredentialsAsync(null));
2121
}
2222

2323
[Fact]
@@ -58,7 +58,7 @@ public async Task BasicAuthentication_GetCredentials_NonDesktopSession_Resource_
5858
}
5959

6060
[Fact]
61-
public void BasicAuthentication_GetCredentials_NonDesktopSession_NoTerminalPrompts_ThrowsException()
61+
public async Task BasicAuthentication_GetCredentials_NonDesktopSession_NoTerminalPrompts_ThrowsException()
6262
{
6363
const string testResource = "https://example.com";
6464

@@ -70,7 +70,7 @@ public void BasicAuthentication_GetCredentials_NonDesktopSession_NoTerminalPromp
7070

7171
var basicAuth = new BasicAuthentication(context);
7272

73-
Assert.ThrowsAsync<InvalidOperationException>(() => basicAuth.GetCredentialsAsync(testResource));
73+
await Assert.ThrowsAsync<GitCredentialManager.Trace2InvalidOperationException>(() => basicAuth.GetCredentialsAsync(testResource));
7474
}
7575

7676
[Fact]

src/shared/Core.Tests/Core.Tests.csproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="coverlet.collector" Version="3.1.0">
12+
<PackageReference Include="coverlet.collector" Version="6.0.2">
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
<PrivateAssets>all</PrivateAssets>
1515
</PackageReference>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
17-
<PackageReference Include="ReportGenerator" Version="5.1.9" />
18-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
17+
<PackageReference Include="ReportGenerator" Version="5.3.10" />
18+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
19+
<PrivateAssets>all</PrivateAssets>
20+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21+
</PackageReference>
1922
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
2023
</ItemGroup>
2124

src/shared/Core.Tests/CurlCookieTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void CurlCookieParser_Parse_MissingFields_SkipsInvalidLines()
3737

3838
IList<Cookie> actual = parser.Parse(content);
3939

40-
Assert.Equal(1, actual.Count);
40+
Assert.Single(actual);
4141
AssertCookie(actual[0], ".example.com", "/path/here", true, 0, "cookie1", "value1");
4242
}
4343

src/shared/Core.Tests/EnvironmentTests.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class EnvironmentTests
1515
private const string PosixPathVar = "/home/john.doe/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
1616
private const string PosixExecName = "foo";
1717

18-
[PlatformFact(Platforms.Windows)]
18+
[WindowsFact]
1919
public void WindowsEnvironment_TryLocateExecutable_NotExists_ReturnFalse()
2020
{
2121
var fs = new TestFileSystem();
@@ -28,7 +28,7 @@ public void WindowsEnvironment_TryLocateExecutable_NotExists_ReturnFalse()
2828
Assert.Null(actualPath);
2929
}
3030

31-
[PlatformFact(Platforms.Windows)]
31+
[WindowsFact]
3232
public void WindowsEnvironment_TryLocateExecutable_Exists_ReturnTrueAndPath()
3333
{
3434
string expectedPath = @"C:\Windows\system32\foo.exe";
@@ -48,7 +48,7 @@ public void WindowsEnvironment_TryLocateExecutable_Exists_ReturnTrueAndPath()
4848
Assert.Equal(expectedPath, actualPath);
4949
}
5050

51-
[PlatformFact(Platforms.Windows)]
51+
[WindowsFact]
5252
public void WindowsEnvironment_TryLocateExecutable_ExistsMultiple_ReturnTrueAndFirstPath()
5353
{
5454
string expectedPath = @"C:\Users\john.doe\bin\foo.exe";
@@ -70,7 +70,7 @@ public void WindowsEnvironment_TryLocateExecutable_ExistsMultiple_ReturnTrueAndF
7070
Assert.Equal(expectedPath, actualPath);
7171
}
7272

73-
[PlatformFact(Platforms.Posix)]
73+
[PosixFact]
7474
public void PosixEnvironment_TryLocateExecutable_NotExists_ReturnFalse()
7575
{
7676
var fs = new TestFileSystem();
@@ -83,7 +83,7 @@ public void PosixEnvironment_TryLocateExecutable_NotExists_ReturnFalse()
8383
Assert.Null(actualPath);
8484
}
8585

86-
[PlatformFact(Platforms.Posix)]
86+
[PosixFact]
8787
public void PosixEnvironment_TryLocateExecutable_Exists_ReturnTrueAndPath()
8888
{
8989
string expectedPath = "/usr/local/bin/foo";
@@ -103,7 +103,7 @@ public void PosixEnvironment_TryLocateExecutable_Exists_ReturnTrueAndPath()
103103
Assert.Equal(expectedPath, actualPath);
104104
}
105105

106-
[PlatformFact(Platforms.Posix)]
106+
[PosixFact]
107107
public void PosixEnvironment_TryLocateExecutable_ExistsMultiple_ReturnTrueAndFirstPath()
108108
{
109109
string expectedPath = "/home/john.doe/bin/foo";
@@ -125,7 +125,7 @@ public void PosixEnvironment_TryLocateExecutable_ExistsMultiple_ReturnTrueAndFir
125125
Assert.Equal(expectedPath, actualPath);
126126
}
127127

128-
[PlatformFact(Platforms.MacOS)]
128+
[MacOSFact]
129129
public void MacOSEnvironment_TryLocateExecutable_Paths_Are_Ignored()
130130
{
131131
List<string> pathsToIgnore = new List<string>()
@@ -150,8 +150,8 @@ public void MacOSEnvironment_TryLocateExecutable_Paths_Are_Ignored()
150150
Assert.True(actualResult);
151151
Assert.Equal(expectedPath, actualPath);
152152
}
153-
154-
[PlatformFact(Platforms.Posix)]
153+
154+
[PosixFact]
155155
public void PosixEnvironment_SetEnvironmentVariable_Sets_Expected_Value()
156156
{
157157
var variable = "FOO_BAR";
@@ -166,8 +166,8 @@ public void PosixEnvironment_SetEnvironmentVariable_Sets_Expected_Value()
166166
Assert.Contains(env.Variables, item
167167
=> item.Key.Equals(variable) && item.Value.Equals(value));
168168
}
169-
170-
[PlatformFact(Platforms.Windows)]
169+
170+
[WindowsFact]
171171
public void WindowsEnvironment_SetEnvironmentVariable_Sets_Expected_Value()
172172
{
173173
var variable = "FOO_BAR";

src/shared/Core.Tests/GenericHostProviderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ public async Task GenericHostProvider_CreateCredentialAsync_NonHttpProtocol_Retu
169169
basicAuthMock.Verify(x => x.GetCredentialsAsync(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
170170
}
171171

172-
[PlatformFact(Platforms.Posix)]
172+
[PosixFact]
173173
public async Task GenericHostProvider_CreateCredentialAsync_NonWindows_WiaSupported_ReturnsBasicCredential()
174174
{
175175
await TestCreateCredentialAsync_ReturnsBasicCredential(wiaSupported: true);
176176
}
177177

178-
[PlatformFact(Platforms.Windows)]
178+
[WindowsFact]
179179
public async Task GenericHostProvider_CreateCredentialAsync_Windows_WiaSupported_ReturnsEmptyCredential()
180180
{
181181
await TestCreateCredentialAsync_ReturnsEmptyCredential(wiaSupported: true);

src/shared/Core.Tests/HostProviderRegistryTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ public void HostProviderRegistry_Register_AutoAuthorityId_ThrowException()
3535
}
3636

3737
[Fact]
38-
public void HostProviderRegistry_GetProvider_NoProviders_ThrowException()
38+
public async Task HostProviderRegistry_GetProvider_NoProviders_ThrowException()
3939
{
4040
var context = new TestCommandContext();
4141
var registry = new HostProviderRegistry(context);
4242
var input = new InputArguments(new Dictionary<string, string>());
4343

44-
Assert.ThrowsAsync<Exception>(() => registry.GetProviderAsync(input));
44+
await Assert.ThrowsAsync<GitCredentialManager.Trace2Exception>(() => registry.GetProviderAsync(input));
4545
}
4646

4747
[Fact]
@@ -119,7 +119,7 @@ public async Task HostProviderRegistry_GetProvider_Auto_HasProviders_DynamicMatc
119119

120120
Assert.Same(providerMock.Object, result);
121121
Assert.True(context.Git.Configuration.Global.TryGetValue(configKey, out IList<string> config));
122-
Assert.Equal(1, config.Count);
122+
Assert.Single(config);
123123
Assert.Equal(providerId, config[0]);
124124
}
125125

@@ -148,7 +148,7 @@ public async Task HostProviderRegistry_GetProvider_Auto_HasProviders_DynamicMatc
148148

149149
Assert.Same(providerMock.Object, result);
150150
Assert.True(context.Git.Configuration.Global.TryGetValue(configKey, out IList<string> config));
151-
Assert.Equal(1, config.Count);
151+
Assert.Single(config);
152152
Assert.Equal(providerId, config[0]);
153153
}
154154

0 commit comments

Comments
 (0)