Skip to content

Commit 607a9e9

Browse files
committed
Update dependencies to the latest, convert NuGet to CPVM
This change converts to using the Central Package Version Management feature in NuGet, enforcing that all PackageReference versions are tracked in one central place. I also bumped up the dependencies for most of the packages that we rely upon. Code changes are to address new analyzer issues from updating to the latest analyzer packages.
1 parent 0388369 commit 607a9e9

38 files changed

+146
-195
lines changed

Directory.Build.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<Project>
2-
<Import Project="build\PackageVersions.targets" />
2+
33
</Project>

Directory.Packages.props

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
5+
<!-- This is due to noise caused from the Minimatch package, tracked at https://github.com/SLaks/Minimatch/issues/12 -->
6+
<NoWarn>$(NoWarn);NU1603</NoWarn>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageVersion Include="Microsoft.Build.Framework" Version="16.9.0" />
11+
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="16.9.0" />
12+
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="16.9.0" />
13+
<PackageVersion Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1" />
14+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.0.0" />
15+
<PackageVersion Include="Microsoft.VisualStudio.Editor" Version="17.0.82-g2ecf33c7f7" />
16+
<PackageVersion Include="Microsoft.VisualStudio.Internal.MicroBuild" Version="2.0.65" />
17+
<PackageVersion Include="Microsoft.VisualStudio.Language.Intellisense" Version="17.0.82-g2ecf33c7f7" />
18+
<PackageVersion Include="Microsoft.VisualStudio.Settings.15.0" Version="17.0.0-previews-1-31410-258" />
19+
<PackageVersion Include="Microsoft.VisualStudio.Shell.15.0" Version="17.0.0-preview-2-31221-277" />
20+
<PackageVersion Include="Microsoft.VisualStudio.Telemetry" Version="16.3.110" />
21+
<PackageVersion Include="Microsoft.VSSDK.BuildTools" Version="17.0.1600" />
22+
<PackageVersion Include="MiniMatch" Version="2.0.0" />
23+
<PackageVersion Include="Moq" Version="4.10.1" />
24+
<PackageVersion Include="NerdBank.GitVersioning" Version="3.3.37" />
25+
<PackageVersion Include="Newtonsoft.Json" Version="12.0.2" />
26+
<PackageVersion Include="Nuget.VisualStudio" Version="6.0.0-preview.0.2" />
27+
28+
<PackageVersion Include="System.Net.Http" Version="4.3.1" />
29+
<PackageVersion Include="System.Runtime" Version="4.3.0" />
30+
<PackageVersion Include="System.Runtime.Loader" Version="4.3.0" />
31+
<PackageVersion Include="System.Security.Cryptography.ProtectedData" Version="4.5.0" />
32+
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4"/>
33+
<PackageVersion Include="System.ValueTuple" Version="4.3.0" />
34+
35+
<!-- Test references -->
36+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
37+
<PackageVersion Include="Microsoft.Test.Apex.VisualStudio" Version="16.3.29003.189" />
38+
<PackageVersion Include="MSTest.TestAdapter" Version="2.2.3" />
39+
<PackageVersion Include="MSTest.TestFramework" Version="2.2.3" />
40+
41+
<!-- CommandLine utils -->
42+
<!-- This version should be kept in sync with the value of RuntimeFrameworkVersion where this package is consumed -->
43+
<PackageVersion Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="2.1.0" />
44+
<PackageVersion Include="Microsoft.NETCore.DotnetAppHost" Version="2.1.0" />
45+
46+
</ItemGroup>
47+
48+
</Project>

build/PackageVersions.targets

-63
This file was deleted.

nuget.config

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<clear />
55
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
66
<add key="dotnet-myget-legacy" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/myget-legacy/nuget/v3/index.json" />
7-
<add key="VSIDE vs-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json" />
7+
<add key="vs-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json" />
8+
<add key="vssdk" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json" />
89
</packageSources>
910
</configuration>

src/Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
33

44
<ItemGroup>
5-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" />
5+
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" PrivateAssets="all"/>
66
</ItemGroup>
77

88
<PropertyGroup>

src/LibraryManager.Build/Microsoft.Web.LibraryManager.Build.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.Build.Framework" />
17-
<PackageReference Include="Microsoft.Build.Tasks.Core" />
18-
<PackageReference Include="Microsoft.Build.Utilities.Core" />
16+
<PackageReference Include="Microsoft.Build.Framework" PrivateAssets="all"/>
17+
<PackageReference Include="Microsoft.Build.Tasks.Core" PrivateAssets="all"/>
18+
<PackageReference Include="Microsoft.Build.Utilities.Core" PrivateAssets="all"/>
1919
<PackageReference Include="System.Runtime.Loader" Condition="'$(TargetFramework)' == 'netstandard2.0'"/>
2020
</ItemGroup>
2121

src/LibraryManager.Contracts/FileHelpers.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public static class FileHelpers
2727
/// <returns></returns>
2828
public static async Task<bool> SafeWriteToFileAsync(string fileName, Stream sourceStream, CancellationToken cancellationToken)
2929
{
30+
_ = sourceStream ?? throw new ArgumentNullException(nameof(sourceStream));
3031
cancellationToken.ThrowIfCancellationRequested();
3132

3233
string tempFileName = Path.GetTempFileName();
@@ -232,6 +233,7 @@ public static bool AreFilesUpToDate(FileInfo firstFile, FileInfo secondFile)
232233
/// <returns></returns>
233234
public static bool DeleteFiles(IEnumerable<string> filePaths, string rootDirectory = null)
234235
{
236+
_ = filePaths ?? throw new ArgumentNullException(nameof(filePaths));
235237
HashSet<string> directories = new HashSet<string>();
236238

237239
try
@@ -285,7 +287,7 @@ public static bool DeleteFiles(IEnumerable<string> filePaths, string rootDirecto
285287
/// <returns></returns>
286288
private static bool DeleteEmptyFoldersFromDisk(IEnumerable<string> folderPaths, string rootDirectory)
287289
{
288-
if (folderPaths.Count() == 0)
290+
if (!folderPaths.Any())
289291
{
290292
return true;
291293
}

src/LibraryManager.Contracts/InvalidLibraryException.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public InvalidLibraryException(string libraryId, string providerId)
3636
/// Serializable constructor for <see cref="InvalidLibraryException"/>.
3737
/// </summary>
3838
protected InvalidLibraryException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext)
39-
:this(serializationInfo.GetString(nameof(LibraryId)), serializationInfo.GetString(nameof(ProviderId)))
39+
:this(serializationInfo?.GetString(nameof(LibraryId)), serializationInfo.GetString(nameof(ProviderId)))
4040
{
4141
}
4242

src/LibraryManager.Contracts/ResourceDownloadException.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public ResourceDownloadException(string url, Exception innerException)
4343
/// Serialization constructor for this exception type.
4444
/// </summary>
4545
protected ResourceDownloadException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext)
46-
: this(serializationInfo.GetString(nameof(Url)))
46+
: this(serializationInfo?.GetString(nameof(Url)))
4747
{
4848
}
4949
}

src/LibraryManager.Vsix/Commands/InstallLibraryCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private async Task ExecuteAsync(object sender, EventArgs e)
117117
// the command was invoked.
118118
if (item != null)
119119
{
120-
target = item.FileNames[1];
120+
target = item.get_FileNames(1);
121121
}
122122
else
123123
{

src/LibraryManager.Vsix/Commands/RestoreCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private async Task ExecuteAsync(object sender, EventArgs e)
5858

5959
if (configProjectItem != null)
6060
{
61-
await _libraryCommandService.RestoreAsync(configProjectItem.FileNames[1], CancellationToken.None);
61+
await _libraryCommandService.RestoreAsync(configProjectItem.get_FileNames(1), CancellationToken.None);
6262
}
6363
}
6464
}

src/LibraryManager.Vsix/Commands/RestoreOnBuildCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private async Task ExecuteAsync(object sender, EventArgs e)
8686

8787
try
8888
{
89-
var dependencies = _dependenciesFactory.FromConfigFile(projectItem.FileNames[1]);
89+
var dependencies = _dependenciesFactory.FromConfigFile(projectItem.get_FileNames(1));
9090
IEnumerable<string> packageIds = dependencies.Providers
9191
.Where(p => p.NuGetPackageId != null)
9292
.Select(p => p.NuGetPackageId)

src/LibraryManager.Vsix/ErrorList/DisplayError.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public DisplayError(IError error)
2828
#pragma warning restore CA1308 // Normalize strings to uppercase
2929

3030
/// <summary>The line number containing the error.</summary>
31-
public int Line { get; set; } = 0;
31+
public int Line { get; set; }
3232

3333
/// <summary>The column number containing the error.</summary>
34-
public int Column { get; set; } = 0;
34+
public int Column { get; set; }
3535

3636
public ImageMoniker Moniker => KnownMonikers.StatusWarning;
3737
}

src/LibraryManager.Vsix/Json/SuggestedActions/SuggestedActionProvider.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,22 @@ public IEnumerable<ISuggestedAction> GetSuggestedActions(ITextView textView, ITe
4343

4444
yield return new UninstallSuggestedAction(this, LibraryCommandService);
4545

46+
#pragma warning disable CA2000 // Dispose objects before losing scope
4647
var update = new UpdateSuggestedActionSet(this);
48+
#pragma warning restore CA2000 // Dispose objects before losing scope
4749

4850
if (update.HasActionSets)
51+
{
4952
yield return update;
53+
}
5054
}
5155

5256
public bool HasSuggestedActions(ITextView textView, ITextBuffer textBuffer, int caretPosition, Node node)
5357
{
54-
if (!DocumentService.TryGetTextDocument(textView.TextBuffer, out var doc))
58+
if (!DocumentService.TryGetTextDocument(textView.TextBuffer, out ITextDocument doc))
59+
{
5560
return false;
61+
}
5662

5763
ObjectNode parent = node.FindType<ObjectNode>();
5864

src/LibraryManager.Vsix/Json/SuggestedActions/UninstallSuggestedActions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private async Task InvokeAsync(CancellationToken cancellationToken)
6565
await _libraryCommandService.UninstallAsync(_provider.ConfigFilePath, state.Name, state.Version, state.ProviderId, cancellationToken)
6666
.ConfigureAwait(false);
6767

68-
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
68+
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
6969
using (ITextEdit edit = TextBuffer.CreateEdit())
7070
{
7171
var arrayElement = _provider.LibraryObject.Parent as ArrayElementNode;

0 commit comments

Comments
 (0)