Publishing SQL Core library in nuget (#2173)

* Set up CI with Azure Pipelines

[skip ci]

* Update publishSqlCoreProject.yml for Azure Pipelines

* Update publishSqlCoreProject.yml for Azure Pipelines

* Update publishSqlCoreProject.yml for Azure Pipelines

* Update publishSqlCoreProject.yml for Azure Pipelines

* Update publishSqlCoreProject.yml for Azure Pipelines

* Updating json rpc target framework

* Fixing packages to pack

* fixing pattern

* Fixing project pattern

* adding versioning schema

* fixing versioning scheme

* fixing nuget package name

* adding name

* removing var

* Fixing stuff

* Fixing stuff

* Fixing stuff

* Fixing build name

* removing build name

* fixing name

* fixing stuff

* fix pattern

* Fixing stuff

* Fixing feed

* Fix stuff

* Fixing feed

* fixing proj name

* Fixing stuff

* Fixing netframework version

* Fixing target framework

* Adding target framework to dependency

* Fixing frameworks

* adding net7.0

* adding flag

* Fixing target frameworks and making code compatible with lang version

* fixed flag

* Fixing assembly name

* Adding hosting in nuget package

* Fixing tests

* Moving steps to its main pipeline

* only releasing when release is true

* Fixing build scripts

* Adding version to csproj for packaging

* adding version

* Fix dirs

* Adding version number to right prop group

* Adding necessary dis

* Fixing build number

* fixing datatype

* Using different var

* Removing unused yml

* Adding back nullables to hosting

* Adding back more nullables

* adding back more nullables

* moving some props to dir level

* Fixing tests

* Removing dup properties

* Supporting different target frameworks in hosting

* Removing additional setting in csproj

* signing sql core dll in publish

* Fixing version setting

* Adding to build

* Added signing and packaging flag

* Fixing file pattern
This commit is contained in:
Aasim Khan
2023-08-23 06:15:20 +00:00
committed by GitHub
parent 58923bc75e
commit c7d75fa535
39 changed files with 183 additions and 41 deletions

View File

@@ -8,7 +8,6 @@
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<HighEntropyVA>true</HighEntropyVA>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<TargetFramework>net7.0</TargetFramework>
<RootDir>$(MSBuildThisFileDirectory)</RootDir>
<!-- Defaults-->

View File

@@ -58,6 +58,18 @@ steps:
inputs:
useGlobalJson: true
- task: PowerShell@2
displayName: 'Add version number to SqlCore project for packaging'
inputs:
targetType: 'inline'
script: |
$projectFile = '$(Build.SourcesDirectory)\src\Microsoft.SqlTools.SqlCore\Microsoft.SqlTools.SqlCore.csproj'
$props = New-Object XML
$props.Load($projectFile)
$version = ($(Major)).ToString() + '.' + ($(Minor)).ToString() + '.' + $(Patch) + $(Build.BuildNumber);
$props.Project.PropertyGroup.Version = $version;
$props.Save($projectFile)
- task: BatchScript@1
displayName: 'Run script build.cmd'
inputs:
@@ -104,7 +116,7 @@ steps:
summaryFileLocation: '$(Agent.TempDirectory)/coverlet/reports/Cobertura.xml'
- task: PowerShell@2
displayName: 'Generate Nuspec Version'
displayName: 'Generate ManagedBatchParser Nuspec Version'
inputs:
targetType: 'inline'
script: |
@@ -163,7 +175,60 @@ steps:
inputs:
ConnectedServiceName: 'Code Signing'
FolderPath: '$(Build.SourcesDirectory)/artifacts/publish'
Pattern: 'Microsoft.SqlTools.ManagedBatchParser.dll,MicrosoftSqlToolsCredentials.exe,MicrosoftSqlToolsServiceLayer.exe,SqlSerializationService.exe,SqlToolsResourceProviderService.exe,Microsoft.SqlTools.Hosting.dll,Microsoft.SqlTools.ResourceProvider.Core.dll,Microsoft.SqlTools.ResourceProvider.DefaultImpl.dll,MicrosoftSqlToolsCredentials.dll,MicrosoftSqlToolsServiceLayer.dll,Newtonsoft.Json.dll,SqlSerializationService.dll,SqlToolsResourceProviderService.dll,System.Data.SqlClient.dll,System.Net.Sockets.dll,MicrosoftSqlToolsMigration.exe,MicrosoftSqlToolsMigration.dll'
Pattern: 'Microsoft.SqlTools.ManagedBatchParser.dll,MicrosoftSqlToolsCredentials.exe,MicrosoftSqlToolsServiceLayer.exe,SqlSerializationService.exe,SqlToolsResourceProviderService.exe,Microsoft.SqlTools.Hosting.dll,Microsoft.SqlTools.ResourceProvider.Core.dll,Microsoft.SqlTools.ResourceProvider.DefaultImpl.dll,MicrosoftSqlToolsCredentials.dll,MicrosoftSqlToolsServiceLayer.dll,Newtonsoft.Json.dll,SqlSerializationService.dll,SqlToolsResourceProviderService.dll,System.Data.SqlClient.dll,System.Net.Sockets.dll,MicrosoftSqlToolsMigration.exe,MicrosoftSqlToolsMigration.dll,Microsoft.SqlTools.SqlCore.dll'
signConfigType: inlineSignParams
inlineOperation: |
[
{
"keyCode": "CP-230012",
"operationSetCode": "SigntoolSign",
"parameters": [
{
"parameterName": "OpusName",
"parameterValue": "SQL Tools Service"
},
{
"parameterName": "OpusInfo",
"parameterValue": "https://github.com/microsoft/sqltoolsservice"
},
{
"parameterName": "PageHash",
"parameterValue": "/NPH"
},
{
"parameterName": "FileDigest",
"parameterValue": "/fd sha256"
},
{
"parameterName": "TimeStamp",
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
}
],
"toolName": "signtool.exe",
"toolVersion": "6.2.9304.0"
},
{
"keyCode": "CP-230012",
"operationSetCode": "SigntoolVerify",
"parameters": [
{
"parameterName": "VerifyAll",
"parameterValue": "/all"
}
],
"toolName": "signtool.exe",
"toolVersion": "6.2.9304.0"
}
]
SessionTimeout: 600
MaxConcurrency: 5
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: 'ESRP SqlCore CodeSigning - sha256 only'
inputs:
ConnectedServiceName: 'Code Signing'
FolderPath: '$(Build.SourcesDirectory)/src/Microsoft.SqlTools.SqlCore/bin/$(buildConfiguration)/netstandard2.0'
Pattern: '*.dll'
signConfigType: inlineSignParams
inlineOperation: |
[
@@ -225,6 +290,13 @@ steps:
filename: build.cmd
arguments: "-target=dotnetpackservicetools -mono"
- task: DotNetCoreCLI@2
displayName: 'dotnet pack sqlcore'
inputs:
command: custom
custom: pack
arguments: '--output $(Build.SourcesDirectory)\artifacts\nugetPackages --no-build --no-restore src\Microsoft.SqlTools.SqlCore\Microsoft.SqlTools.SqlCore.csproj'
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: 'ESRP Code Signing - Nuget Package'
inputs:
@@ -290,6 +362,15 @@ steps:
publishVstsFeed: '2191dd5f-4aec-491b-ac50-568bbc331c8a'
allowPackageConflicts: true
- task: DotNetCoreCLI@2
displayName: 'NuGet push SqlCore'
condition: eq(variables['RELEASE_SQLCORE'], 'true')
inputs:
command: push
packagesToPush: '$(Build.SourcesDirectory)/artifacts/nugetPackages/**/Microsoft.SqlTools.SqlCore.*.nupkg'
feedPublish: 'mssqltools'
allowPackageConflicts: true
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
inputs:

View File

@@ -37,8 +37,7 @@ var shellExtension = IsRunningOnWindows() ? "ps1" : "sh";
/// </summary>
public class BuildPlan
{
public string[] FxBuildProjects { get; set; }
public string[] FxFrameworks { get; set; }
public Project[] FxBuildProjects { get; set; }
public IDictionary<string, string[]> TestProjects { get; set; }
public string BuildToolsFolder { get; set; }
public string ArtifactsFolder { get; set; }
@@ -63,6 +62,8 @@ public class Project
public string Name { get; set; }
public string[] PackageProjects { get; set; }
public string[] TestProjects { get; set; }
public string[] Frameworks { get; set; }
public bool SkipPack { get; set; }
}
var buildPlan = JsonConvert.DeserializeObject<BuildPlan>(
@@ -263,10 +264,10 @@ Task("BuildFx")
{
foreach (var project in buildPlan.FxBuildProjects)
{
foreach (var framework in buildPlan.FxFrameworks)
foreach (var framework in project.Frameworks)
{
var projectFolder = System.IO.Path.Combine(sourceFolder, project);
var logPath = System.IO.Path.Combine(logFolder, $"{project}-{framework}-build.log");
var projectFolder = System.IO.Path.Combine(sourceFolder, project.Name);
var logPath = System.IO.Path.Combine(logFolder, $"{project.Name}-{framework}-build.log");
using (var logWriter = new StreamWriter(logPath)) {
Run(dotnetcli, $"build --framework {framework} --configuration {configuration} \"{projectFolder}\"",
new RunOptions
@@ -274,7 +275,7 @@ Task("BuildFx")
StandardOutputWriter = logWriter,
StandardErrorWriter = logWriter
})
.ExceptionOnError($"Building test {project} failed for {framework}. See {logPath} for more details.");
.ExceptionOnError($"Building test {project.Name} failed for {framework}. See {logPath} for more details.");
}
}
}
@@ -308,10 +309,14 @@ Task("DotnetPackNuspec")
{
foreach (var project in buildPlan.FxBuildProjects)
{
if (project.SkipPack != null && project.SkipPack)
{
continue;
}
// For now, putting all nugets in the 1 directory
var outputFolder = System.IO.Path.Combine(nugetPackageFolder);
var projectFolder = System.IO.Path.Combine(packagesFolder, project);
DotnetPackNuspec(outputFolder, projectFolder, project);
var projectFolder = System.IO.Path.Combine(packagesFolder, project.Name);
DotnetPackNuspec(outputFolder, projectFolder, project.Name);
}
});
@@ -469,9 +474,10 @@ void PublishProject(string packageName, string[] projects)
}
}
if (buildPlan.FxBuildProjects.Contains(project))
if (buildPlan.FxBuildProjects.Any(p => p.Name == project))
{
foreach(var framework in buildPlan.FxFrameworks)
var projDefinition = buildPlan.FxBuildProjects.First(p => p.Name == project);
foreach(var framework in projDefinition.Frameworks)
{
var outputFolder = System.IO.Path.Combine(publishFolder, packageName, "default", framework);
var publishArguments = "publish";

View File

@@ -24,10 +24,6 @@
"Frameworks": [
"net7.0"
],
"FxFrameworks":[
"net472",
"net7.0"
],
"MainProjects": [
"Microsoft.SqlTools.Credentials",
"Microsoft.SqlTools.ResourceProvider",
@@ -37,7 +33,20 @@
"Microsoft.SqlTools.Migration"
],
"FxBuildProjects": [
"Microsoft.SqlTools.ManagedBatchParser"
{
"Name": "Microsoft.SqlTools.ManagedBatchParser",
"Frameworks": [
"net472",
"net7.0"
]
},
{
"Name": "Microsoft.SqlTools.SqlCore",
"Frameworks": [
"netstandard2.0"
],
"SkipPack": "true"
}
],
"PackageProjects": [
"Microsoft.SqlTools.Hosting"

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>

View File

@@ -12,6 +12,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<DebugType>portable</DebugType>
<TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifiers>$(ToolsServiceTargetRuntimes)</RuntimeIdentifiers>
<!-- False alerts, disabled due to issue: https://github.com/dotnet/roslyn/issues/65850 -->
<NoWarn>$(NoWarn);CS8795</NoWarn>

View File

@@ -3,6 +3,7 @@
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

View File

@@ -18,6 +18,7 @@
This is a Diagnostic Alert .NET 7 onwards.Changing to LibraryImportAttribute would require additional code changes,
therefore this warning is suppressed.-->
<NoWarn>$(NoWarn);SYSLIB1054</NoWarn>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" Exclude="**/obj/**/*.cs" />

View File

@@ -24,7 +24,8 @@ namespace Microsoft.SqlTools.Extensibility
"microsofsqltoolscredentials.dll",
"microsoft.sqltools.hosting.dll",
"microsoftsqltoolsservicelayer.dll",
"microsoftkustoservicelayer.dll"
"microsoftkustoservicelayer.dll",
"microsoft.sqltools.sqlcore.dll"
};
private Func<ConventionBuilder, ContainerConfiguration> config;

View File

@@ -121,7 +121,11 @@ namespace Microsoft.SqlTools.Hosting.Protocol
public async Task WaitForExitAsync()
{
this.endpointExitedTask = new TaskCompletionSource<bool>();
#if NETSTANDARD2_0
await this.endpointExitedTask.Task;
#else
await this.endpointExitedTask.Task.WaitAsync(CancellationToken.None);
#endif
}
public async Task Stop()

View File

@@ -11,6 +11,8 @@
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyTitle>SqlTools Hosting Library</AssemblyTitle>
<Description>Provides hosting services for SqlTools applications.</Description>
<TargetFrameworks>netstandard2.0;net7.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" Exclude="**/obj/**/*.cs" />

View File

@@ -202,7 +202,11 @@ namespace Microsoft.SqlTools.Utility
int uniqueId;
try
{
#if NETSTANDARD2_0
uniqueId = Process.GetCurrentProcess().Id;
#else
uniqueId = Environment.ProcessId;
#endif
}
catch (Exception ex)
{
@@ -256,8 +260,10 @@ namespace Microsoft.SqlTools.Utility
/// Writes a PII message to the log file with the Verbose event level when PII flag is enabled.
/// </summary>
/// <param name="logMessage">The message text to be written.</param>
public static void Pii(string logMessage) {
if (IsPiiEnabled) {
public static void Pii(string logMessage)
{
if (IsPiiEnabled)
{
Write(TraceEventType.Verbose, logMessage);
}
}

View File

@@ -3,6 +3,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#if NETSTANDARD2_0
using System;
#endif
using System.Diagnostics.Tracing;
using Microsoft.SqlTools.Utility;
@@ -41,7 +44,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Utility
{
if (payload != null)
{
#if NETSTANDARD2_0_OR_GREATER
Logger.Verbose($"eventTID:{Environment.CurrentManagedThreadId} {payload.ToString()}");
#else
Logger.Verbose($"eventTID:{eventData.OSThreadId} {payload.ToString()}");
#endif
}
}

View File

@@ -37,6 +37,7 @@
<NuspecProperties>version=$(PackageVersion)</NuspecProperties>
<!-- Disable CA1852 (Seal internal types) as it depends on SrGen Tool -->
<NoWarn>$(NoWarn);CA1852</NoWarn>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" />

View File

@@ -16,6 +16,7 @@
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<AssemblyTitle>SqlTools Migration Host Protocol Library</AssemblyTitle>
<Description>Provides message types and client/server APIs for the SqlTools Migration Services JSON protocol.</Description>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>

View File

@@ -9,6 +9,7 @@
<OutputType>Library</OutputType>
<StartupObject />
<Description>Provides Resource Provider and control plane services for SqlTools applications.</Description>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" />

View File

@@ -12,6 +12,7 @@
<Copyright><EFBFBD> Microsoft Corporation. All rights reserved.</Copyright>
<!-- Disable CA1852 (Seal internal types) as it depends on SrGen Tool -->
<NoWarn>$(NoWarn);CA1852</NoWarn>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" />

View File

@@ -12,6 +12,7 @@
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
<EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
<RuntimeIdentifiers>$(ToolsServiceTargetRuntimes)</RuntimeIdentifiers>
<TargetFramework>net7.0</TargetFramework>
<!-- Disable CA1852 (Seal internal types) as it depends on SrGen Tool -->
<NoWarn>$(NoWarn);CA1852</NoWarn>
</PropertyGroup>

View File

@@ -83,7 +83,7 @@ namespace Microsoft.SqlTools.ServiceLayer
"microsofsqltoolscredentials.dll",
"microsoft.sqltools.hosting.dll",
"microsoftsqltoolsservicelayer.dll",
"microsoftsqltoolssqlcore.dll"
"microsoft.sqltools.sqlcore.dll"
});
serviceProvider.RegisterSingleService(sqlToolsContext);
serviceProvider.RegisterSingleService(serviceHost);

View File

@@ -16,6 +16,7 @@
<Description>Provides message types and client/server APIs for the SqlTools Editor Services JSON protocol.</Description>
<!-- False alerts, disabled due to issue: https://github.com/dotnet/roslyn/issues/65850 -->
<NoWarn>$(NoWarn);CS8795</NoWarn>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>

View File

@@ -3,6 +3,7 @@
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -12,6 +12,10 @@
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyTitle>SqlTools SqlCore Library</AssemblyTitle>
<Description>Provides core sql functionality for SQL server editors like Object explorer, Query Execution and Scripting</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>8.0</LangVersion>
<AssemblyName>Microsoft.SqlTools.SqlCore</AssemblyName>
<Version>1.0.0</Version>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" Exclude="**/obj/**/*.cs" />
@@ -21,7 +25,7 @@
<PackageReference Include="System.Configuration.ConfigurationManager" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" />
<ProjectReference Include="../Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\*.resx" />

View File

@@ -13,7 +13,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
/// <summary>
/// Has information for filtering a SMO object by properties
/// </summary>
public interface INodeFilter
public abstract class INodeFilter
{
/// <summary>
/// Returns true if the filter can be apply to the given type and Server type
@@ -21,15 +21,15 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
/// <param name="type">Type of the querier</param>
/// <param name="validForFlag">Server Type</param>
/// <returns></returns>
bool CanApplyFilter(Type type, ValidForFlag validForFlag);
public abstract bool CanApplyFilter(Type type, ValidForFlag validForFlag);
/// <summary>
/// Creates a string from the filter property and values to be used in the Urn to query the SQL objects
/// Example of the output:[@ IsSystemObject = 0]
/// </summary>
/// <returns></returns>
string ToPropertyFilterString(Type type, ValidForFlag validForFlag);
public abstract string ToPropertyFilterString(Type type, ValidForFlag validForFlag);
/// <summary>
/// Creates a fully paramaterized property filter string for the URN query for SQL objects.
/// Example of the output:[@ IsSystemObject = 0]

View File

@@ -24,7 +24,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
/// </summary>
/// <param name="type">Type of the querier</param>
/// <param name="validForFlag">Server Type</param>
public bool CanApplyFilter(Type type, ValidForFlag validForFlag) {
public override bool CanApplyFilter(Type type, ValidForFlag validForFlag) {
return this.FilterList.Exists(f => f.CanApplyFilter(type, validForFlag));
}
@@ -33,7 +33,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
/// Example of the output: ((@TableTemporalType = 1) or (@LedgerTableType = 1))
/// </summary>
/// <returns></returns>
public string ToPropertyFilterString(Type type, ValidForFlag validForFlag)
public override string ToPropertyFilterString(Type type, ValidForFlag validForFlag)
{
StringBuilder filter = new StringBuilder();
foreach (var nodeFilter in FilterList)

View File

@@ -64,7 +64,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
/// <param name="type">Type of the querier</param>
/// <param name="validForFlag">Server Type</param>
/// <returns></returns>
public bool CanApplyFilter(Type type, ValidForFlag validForFlag)
public override bool CanApplyFilter(Type type, ValidForFlag validForFlag)
{
bool canApplyFilter = false;
canApplyFilter = TypeToReverse == null || TypeToReverse == type;
@@ -78,7 +78,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
/// Example of the output: (@ IsSystemObject = 0)
/// </summary>
/// <returns></returns>
public string ToPropertyFilterString(Type type, ValidForFlag validForFlag)
public override string ToPropertyFilterString(Type type, ValidForFlag validForFlag)
{
// check first if the filter can be applied; if not just return empty string
if (!CanApplyFilter(type, validForFlag))
@@ -186,7 +186,10 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
var escapedString = StringUtils.EscapeStringSQuote(propertyValue.ToString());
if (this.FilterType == FilterType.STARTSWITH || this.FilterType == FilterType.ENDSWITH)
{
escapedString = EscapeLikeURNRegex().Replace(escapedString, "[$0]");
// For filters that use the LIKE operator, we need to escape the following characters: %, _, [, ^
// we do this by wrapping them in square brackets eg: [%], [_], [[], [^]
Regex escapteSqlObjectChars = new Regex(@"%|_|\[|\^");
escapedString = escapteSqlObjectChars.Replace(escapedString, "[$0]");
if (this.FilterType == FilterType.STARTSWITH)
{
@@ -283,11 +286,6 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
return false;
}
}
// For filters that use the LIKE operator, we need to escape the following characters: %, _, [, ^
// we do this by wrapping them in square brackets eg: [%], [_], [[], [^]
[GeneratedRegexAttribute(@"%|_|\[|\^")]
public static partial Regex EscapeLikeURNRegex();
}
public enum FilterType

View File

@@ -323,7 +323,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
}
}
}
ApplicableNodeChildFactories = new Lazy<Dictionary<string, HashSet<ChildFactory>>>(factories);
ApplicableNodeChildFactories = new Lazy<Dictionary<string, HashSet<ChildFactory>>>(() => factories);
}
public IEnumerable<ChildFactory> GetApplicableChildFactories()

View File

@@ -42,7 +42,9 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel
{
NodeTypeDictionary.Add(containedType, new HashSet<Node>());
}
NodeTypeDictionary.GetValueOrDefault(containedType).Add(node);
HashSet<Node> nodeSet;
NodeTypeDictionary.TryGetValue(containedType, out nodeSet);
nodeSet.Add(node);
}
}
var serverNode = TreeRoot.Nodes.FirstOrDefault(node => node.Name == "Server");
@@ -59,7 +61,8 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel
}
var returnSet = new HashSet<string>();
var matchingNodes = NodeTypeDictionary.GetValueOrDefault(typeName);
HashSet<Node> matchingNodes;
NodeTypeDictionary.TryGetValue(typeName, out matchingNodes);
if (matchingNodes == null)
{
return returnSet;

View File

@@ -2,6 +2,7 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,6 +6,7 @@
<PackageId>Microsoft.SqlTools.ManagedBatchParser.IntegrationTests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" />

View File

@@ -6,6 +6,7 @@
<PackageId>Microsoft.SqlTools.Migration.IntegrationTests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" />

View File

@@ -6,6 +6,7 @@
<PackageId>Microsoft.SqlTools.ServiceLayer.IntegrationTests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" />

View File

@@ -11,6 +11,7 @@
<StartupObject>Microsoft.SqlTools.ServiceLayer.PerfTests.Program</StartupObject>
<PreserveCompilationContext>true</PreserveCompilationContext>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj" />

View File

@@ -5,6 +5,7 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DefineConstants>$(DefineConstants);NETCOREAPP1_0;TRACE</DefineConstants>
<IsPackable>false</IsPackable>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Moq" />

View File

@@ -10,6 +10,7 @@
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj" />

View File

@@ -6,6 +6,7 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DefineConstants>$(DefineConstants);NETCOREAPP1_0</DefineConstants>
<IsPackable>false</IsPackable>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />

View File

@@ -7,6 +7,7 @@
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<TargetFramework>net7.0</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
<ItemGroup>

View File

@@ -8,6 +8,7 @@
<StartupObject />
<!-- False alerts, disabled due to issue: https://github.com/dotnet/roslyn/issues/65850 -->
<NoWarn>$(NoWarn);CS8795</NoWarn>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Text.Encoding.CodePages" />

View File

@@ -6,6 +6,7 @@
<PackageId>Microsoft.SqlTools.Test.CompletionExtension</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj" />

View File

@@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>