Skip to content

Commit fb214c5

Browse files
committed
Merge branch 'main' into fix-2312889-duplicate-platforms
2 parents c7c72cc + 24eabd0 commit fb214c5

File tree

1,228 files changed

+70769
-71589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,228 files changed

+70769
-71589
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ dotnet_naming_style.pascal_case_and_prefix_with_I_style.capitalization
133133
# CSharp code style settings:
134134
[*.cs]
135135

136+
# Use file-scoped namespaces
137+
csharp_style_namespace_declarations = file_scoped:error
138+
136139
# Prefer "var" only when the type is apparent
137140
csharp_style_var_for_built_in_types = false:suggestion
138141
csharp_style_var_when_type_is_apparent = true:suggestion

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# convert solution to use file-scoped namespaces
2+
e13927f27b47320d8179af850b1ea31e8b24e12b

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
<!-- 3rd party -->
116116
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
117117
<PackageVersion Include="IsExternalInit" Version="1.0.3" />
118+
<PackageVersion Include="PolySharp" Version="1.15.0" />
118119

119120
<!-- Tests -->
120121
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0-preview-20221003-04" />

docs/design-time-builds.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ CollectFrameworkReferences | NuGet | Returns non-transi
195195
CollectNuGetAuditSuppressions | NuGet | Returns `NuGetAuditSuppress` items. Supports package restore.
196196
CollectPackageDownloads | NuGet | Returns `PackageDownload` items. Supports package restore.
197197
CollectPackageReferences | NuGet | Returns `PackageReference` items. Supports package restore.
198+
CollectPrunePackageReferences | NuGet | Returns `PrunePackageReference` items. Supports package restore.
198199
CollectResolvedCompilationReferencesDesignTime | DNPS |
199200
CollectResolvedSDKReferencesDesignTime | SDK |
200201
CollectSuggestedVisualStudioComponentIds | DNPS | Supports in-product acquisition (IPA).

eng/imports/HostAgnostic.props

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

6161
<!-- 3rd party -->
6262
<PackageReference Include="Newtonsoft.Json" />
63-
<PackageReference Include="IsExternalInit" PrivateAssets="all" />
63+
<PackageReference Include="PolySharp" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
6464

6565
<!-- Host-Agnostic Visual Studio -->
6666
<PackageReference Include="Microsoft.VisualStudio.ImageCatalog" />

setup/Common/ProvideCodeBaseBindingRedirection.cs

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,35 @@
22

33
using Microsoft.VisualStudio.Shell;
44

5-
namespace Microsoft.VisualStudio
5+
namespace Microsoft.VisualStudio;
6+
7+
/// <summary>
8+
/// A <see cref="RegistrationAttribute"/> that provides code-base binding redirects.
9+
/// </summary>
10+
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
11+
internal sealed class ProvideCodeBaseBindingRedirectionAttribute : RegistrationAttribute
612
{
7-
/// <summary>
8-
/// A <see cref="RegistrationAttribute"/> that provides code-base binding redirects.
9-
/// </summary>
10-
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
11-
internal sealed class ProvideCodeBaseBindingRedirectionAttribute : RegistrationAttribute
12-
{
13-
private readonly ProvideBindingRedirectionAttribute _redirectionAttribute;
13+
private readonly ProvideBindingRedirectionAttribute _redirectionAttribute;
1414

15-
public ProvideCodeBaseBindingRedirectionAttribute(string assemblyName)
15+
public ProvideCodeBaseBindingRedirectionAttribute(string assemblyName)
16+
{
17+
// ProvideBindingRedirectionAttribute is sealed, so we can't inherit from it to provide defaults.
18+
// Instead, we'll do more of an aggregation pattern here.
19+
_redirectionAttribute = new ProvideBindingRedirectionAttribute
1620
{
17-
// ProvideBindingRedirectionAttribute is sealed, so we can't inherit from it to provide defaults.
18-
// Instead, we'll do more of an aggregation pattern here.
19-
_redirectionAttribute = new ProvideBindingRedirectionAttribute
20-
{
21-
AssemblyName = assemblyName,
22-
OldVersionLowerBound = "0.0.0.0",
23-
CodeBase = assemblyName + ".dll",
24-
};
25-
}
21+
AssemblyName = assemblyName,
22+
OldVersionLowerBound = "0.0.0.0",
23+
CodeBase = assemblyName + ".dll",
24+
};
25+
}
2626

27-
public override void Register(RegistrationContext context)
28-
{
29-
_redirectionAttribute.Register(context);
30-
}
27+
public override void Register(RegistrationContext context)
28+
{
29+
_redirectionAttribute.Register(context);
30+
}
3131

32-
public override void Unregister(RegistrationContext context)
33-
{
34-
_redirectionAttribute.Unregister(context);
35-
}
32+
public override void Unregister(RegistrationContext context)
33+
{
34+
_redirectionAttribute.Unregister(context);
3635
}
3736
}

src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/CodeMarkerTimerId.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
#pragma warning disable CA1200 // Avoid using cref tags with a prefix
44

5-
namespace Microsoft.VisualStudio
5+
namespace Microsoft.VisualStudio;
6+
7+
/// <summary>
8+
/// Represents timer IDs that are passed to <see cref="T:Microsoft.Internal.Performance.CodeMarker"/>.
9+
/// </summary>
10+
internal static class CodeMarkerTimerId
611
{
712
/// <summary>
8-
/// Represents timer IDs that are passed to <see cref="T:Microsoft.Internal.Performance.CodeMarker"/>.
13+
/// Indicates that NuGet package restore has finished.
914
/// </summary>
10-
internal static class CodeMarkerTimerId
11-
{
12-
/// <summary>
13-
/// Indicates that NuGet package restore has finished.
14-
/// </summary>
15-
public const int PerfPackageRestoreEnd = 7343;
16-
}
15+
public const int PerfPackageRestoreEnd = 7343;
1716
}

src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/IO/WindowsFileExplorer.cs

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,76 +3,75 @@
33
using System.Runtime.InteropServices;
44
using Path = Microsoft.IO.Path;
55

6-
namespace Microsoft.VisualStudio.IO
6+
namespace Microsoft.VisualStudio.IO;
7+
8+
[Export(typeof(IFileExplorer))]
9+
internal class WindowsFileExplorer : IFileExplorer
710
{
8-
[Export(typeof(IFileExplorer))]
9-
internal class WindowsFileExplorer : IFileExplorer
11+
private readonly IFileSystem _fileSystem;
12+
13+
[ImportingConstructor]
14+
public WindowsFileExplorer(IFileSystem fileSystem)
15+
{
16+
_fileSystem = fileSystem;
17+
}
18+
19+
public void OpenContainingFolder(string path)
1020
{
11-
private readonly IFileSystem _fileSystem;
21+
Requires.NotNullOrEmpty(path);
1222

13-
[ImportingConstructor]
14-
public WindowsFileExplorer(IFileSystem fileSystem)
23+
// When 'path' doesn't exist, Explorer just opens the default
24+
// "Quick Access" page, so try to something better than that.
25+
if (_fileSystem.PathExists(path))
1526
{
16-
_fileSystem = fileSystem;
27+
// Tell Explorer to open the parent folder of the item, selecting the item
28+
ShellExecute(
29+
string.Empty,
30+
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "explorer.exe"),
31+
parameters: $"/select,\"{path}\"");
1732
}
18-
19-
public void OpenContainingFolder(string path)
33+
else
2034
{
21-
Requires.NotNullOrEmpty(path);
22-
23-
// When 'path' doesn't exist, Explorer just opens the default
24-
// "Quick Access" page, so try to something better than that.
25-
if (_fileSystem.PathExists(path))
26-
{
27-
// Tell Explorer to open the parent folder of the item, selecting the item
28-
ShellExecute(
29-
string.Empty,
30-
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "explorer.exe"),
31-
parameters: $"/select,\"{path}\"");
32-
}
33-
else
35+
string? parentPath = GetParentPath(path);
36+
if (parentPath is not null && _fileSystem.DirectoryExists(parentPath))
3437
{
35-
string? parentPath = GetParentPath(path);
36-
if (parentPath is not null && _fileSystem.DirectoryExists(parentPath))
37-
{
38-
OpenFolder(parentPath);
39-
}
38+
OpenFolder(parentPath);
4039
}
4140
}
41+
}
4242

43-
public void OpenFolder(string path)
44-
{
45-
Requires.NotNullOrEmpty(path);
43+
public void OpenFolder(string path)
44+
{
45+
Requires.NotNullOrEmpty(path);
4646

47-
// Tell Explorer just open the contents of the folder, selecting nothing
48-
ShellExecute("explore", path);
49-
}
47+
// Tell Explorer just open the contents of the folder, selecting nothing
48+
ShellExecute("explore", path);
49+
}
5050

51-
protected static void ShellExecute(string operation, string filePath, string? parameters = null)
52-
{
53-
// Workaround of CLR bug 1134711; System.Diagnostics.Process.Start() does not support GB18030
54-
_ = ShellExecute(IntPtr.Zero, operation, filePath, parameters, lpDirectory: null, 1);
55-
}
51+
protected static void ShellExecute(string operation, string filePath, string? parameters = null)
52+
{
53+
// Workaround of CLR bug 1134711; System.Diagnostics.Process.Start() does not support GB18030
54+
_ = ShellExecute(IntPtr.Zero, operation, filePath, parameters, lpDirectory: null, 1);
55+
}
5656

57-
private static string? GetParentPath(string path)
57+
private static string? GetParentPath(string path)
58+
{
59+
// Remove trailing slashes, so that GetDirectoryName returns
60+
// "Foo" in C:\Foo\Project\" instead of "C:\Foo\Project".
61+
if (Path.EndsInDirectorySeparator(path))
5862
{
59-
// Remove trailing slashes, so that GetDirectoryName returns
60-
// "Foo" in C:\Foo\Project\" instead of "C:\Foo\Project".
61-
if (Path.EndsInDirectorySeparator(path))
62-
{
63-
path = path.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
64-
}
65-
66-
return Path.GetDirectoryName(path);
63+
path = path.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
6764
}
6865

69-
[DllImport("shell32.dll", EntryPoint = "ShellExecuteW")]
70-
internal static extern IntPtr ShellExecute(
71-
IntPtr hwnd,
72-
[MarshalAs(UnmanagedType.LPWStr)] string lpOperation,
73-
[MarshalAs(UnmanagedType.LPWStr)] string lpFile,
74-
[MarshalAs(UnmanagedType.LPWStr)] string? lpParameters,
75-
[MarshalAs(UnmanagedType.LPWStr)] string? lpDirectory,
76-
int nShowCmd);
66+
return Path.GetDirectoryName(path);
7767
}
68+
69+
[DllImport("shell32.dll", EntryPoint = "ShellExecuteW")]
70+
internal static extern IntPtr ShellExecute(
71+
IntPtr hwnd,
72+
[MarshalAs(UnmanagedType.LPWStr)] string lpOperation,
73+
[MarshalAs(UnmanagedType.LPWStr)] string lpFile,
74+
[MarshalAs(UnmanagedType.LPWStr)] string? lpParameters,
75+
[MarshalAs(UnmanagedType.LPWStr)] string? lpDirectory,
76+
int nShowCmd);
7877
}
Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information.
22

3-
namespace Microsoft.VisualStudio.Input
3+
namespace Microsoft.VisualStudio.Input;
4+
5+
/// <summary>
6+
/// Provides common well-known command groups.
7+
/// </summary>
8+
internal static class CommandGroup
49
{
5-
/// <summary>
6-
/// Provides common well-known command groups.
7-
/// </summary>
8-
internal static class CommandGroup
9-
{
10-
public const string UIHierarchyWindow = VSConstants.CMDSETID.UIHierarchyWindowCommandSet_string;
11-
public const string VisualStudioStandard97 = VSConstants.CMDSETID.StandardCommandSet97_string;
12-
public const string VisualStudioStandard2k = VSConstants.CMDSETID.StandardCommandSet2K_string;
13-
public const string FSharpProject = "{75AC5611-A912-4195-8A65-457AE17416FB}";
14-
public const string ManagedProjectSystemOrder = "{6C4806E9-034E-4B64-99DE-29A6F837B993}";
15-
public const string ManagedProjectSystem = "{568ABDF7-D522-474D-9EED-34B5E5095BA5}";
16-
public const string WPF = "{A8878AC2-6163-4C15-9767-1871DD750C6A}";
17-
}
10+
public const string UIHierarchyWindow = VSConstants.CMDSETID.UIHierarchyWindowCommandSet_string;
11+
public const string VisualStudioStandard97 = VSConstants.CMDSETID.StandardCommandSet97_string;
12+
public const string VisualStudioStandard2k = VSConstants.CMDSETID.StandardCommandSet2K_string;
13+
public const string FSharpProject = "{75AC5611-A912-4195-8A65-457AE17416FB}";
14+
public const string ManagedProjectSystemOrder = "{6C4806E9-034E-4B64-99DE-29A6F837B993}";
15+
public const string ManagedProjectSystem = "{568ABDF7-D522-474D-9EED-34B5E5095BA5}";
16+
public const string WPF = "{A8878AC2-6163-4C15-9767-1871DD750C6A}";
1817
}
Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information.
22

3-
namespace Microsoft.VisualStudio.Input
3+
namespace Microsoft.VisualStudio.Input;
4+
5+
// from VS: src\vsproject\cool\coolpkg\resource.h
6+
internal enum LegacyCSharpStringResourceIds : uint
47
{
5-
// from VS: src\vsproject\cool\coolpkg\resource.h
6-
internal enum LegacyCSharpStringResourceIds : uint
7-
{
8-
IDS_TEMPLATE_NEWWFCWIN32FORM = 2237,
9-
IDS_TEMPLATE_DIRLOCALITEMS = 2339,
10-
IDS_TEMPLATE_NEWCSharpCLASS = 2245,
11-
IDS_TEMPLATE_NEWWFCCOMPONENT = 2246,
12-
IDS_TEMPLATE_NEWUSERCONTROL = 2295,
13-
IDS_PROJECTITEMTYPE_STR = 2346,
14-
}
8+
IDS_TEMPLATE_NEWWFCWIN32FORM = 2237,
9+
IDS_TEMPLATE_DIRLOCALITEMS = 2339,
10+
IDS_TEMPLATE_NEWCSharpCLASS = 2245,
11+
IDS_TEMPLATE_NEWWFCCOMPONENT = 2246,
12+
IDS_TEMPLATE_NEWUSERCONTROL = 2295,
13+
IDS_PROJECTITEMTYPE_STR = 2346,
14+
}
1515

16-
// from VS: src\vsproject\vb\vbprj\vbprjstr.h
17-
internal enum LegacyVBStringResourceIds : uint
18-
{
19-
IDS_VSDIR_ITEM_CLASS = 3020,
20-
IDS_VSDIR_ITEM_COMPONENT = 3024,
21-
IDS_VSDIR_ITEM_MODULE = 3028,
22-
IDS_VSDIR_ITEM_USERCTRL = 3048,
23-
IDS_VSDIR_ITEM_WINFORM = 3050,
24-
IDS_VSDIR_CLIENTPROJECTITEMS = 3081,
25-
IDS_VSDIR_VBPROJECTFILES = 3082,
26-
}
16+
// from VS: src\vsproject\vb\vbprj\vbprjstr.h
17+
internal enum LegacyVBStringResourceIds : uint
18+
{
19+
IDS_VSDIR_ITEM_CLASS = 3020,
20+
IDS_VSDIR_ITEM_COMPONENT = 3024,
21+
IDS_VSDIR_ITEM_MODULE = 3028,
22+
IDS_VSDIR_ITEM_USERCTRL = 3048,
23+
IDS_VSDIR_ITEM_WINFORM = 3050,
24+
IDS_VSDIR_CLIENTPROJECTITEMS = 3081,
25+
IDS_VSDIR_VBPROJECTFILES = 3082,
26+
}
2727

28-
// from VS: src\vsproject\fidalgo\WPF\Flavor\WPFFlavor\WPFProject.cs
29-
internal enum WPFTemplateNames : uint
30-
{
31-
WPFPage = 4658,
32-
WPFResourceDictionary = 4662,
33-
WPFUserControl = 4664,
34-
WPFWindow = 4666,
35-
}
28+
// from VS: src\vsproject\fidalgo\WPF\Flavor\WPFFlavor\WPFProject.cs
29+
internal enum WPFTemplateNames : uint
30+
{
31+
WPFPage = 4658,
32+
WPFResourceDictionary = 4662,
33+
WPFUserControl = 4664,
34+
WPFWindow = 4666,
3635
}

0 commit comments

Comments
 (0)