From 1a041d63b70a972eb8dd56ea910ce238ea60ae27 Mon Sep 17 00:00:00 2001 From: Timothy Mothra Date: Wed, 13 Nov 2019 14:22:29 -0800 Subject: [PATCH 1/3] Tilee/fix tests (#1301) * move integration tests to other solution * add readme * update to script * fix script --- .scripts/build_Clean.ps1 | 24 ++++++++++++++++++++---- Everything.sln | 14 -------------- IntegrationTests.Readme.md | 7 +++++++ IntegrationTests.sln | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 18 deletions(-) create mode 100644 IntegrationTests.Readme.md create mode 100644 IntegrationTests.sln diff --git a/.scripts/build_Clean.ps1 b/.scripts/build_Clean.ps1 index 6286b98dc..8ddc3602e 100644 --- a/.scripts/build_Clean.ps1 +++ b/.scripts/build_Clean.ps1 @@ -1,7 +1,11 @@ param( [Parameter(Mandatory=$True)] [System.String] - $Directory + $Directory, + + [Parameter(Mandatory=$False)] + [System.Boolean] + $CleanBinAndObj ) @@ -15,9 +19,11 @@ function Clean ([string]$dir) { Write-Host "`nDirectory: $($dir)"; if (Test-Path $dir) - { + { + PrintFileCount $dir; Remove-Item $dir -Recurse -Force; Write-Host " removed"; + PrintFileCount $dir; } else { @@ -25,5 +31,15 @@ function Clean ([string]$dir) { } } -Clean "$($Directory)\bin" -Clean "$($Directory)\obj" +function PrintFileCount ([string]$dir) { + $count = ( Get-ChildItem $dir -Recurse | Measure-Object ).Count; + Write-Host " File count: $($count)"; +} + + +if ($CleanBinAndObj) { + Clean "$($Directory)\bin" + Clean "$($Directory)\obj" +} else { + Clean "$($Directory)" +} diff --git a/Everything.sln b/Everything.sln index 3fedaf922..4df63c676 100644 --- a/Everything.sln +++ b/Everything.sln @@ -209,10 +209,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi20.FunctionalTests20" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationInsightsTypes", "NETCORE\test\ApplicationInsightsTypes\ApplicationInsightsTypes.csproj", "{3D7258E3-5DDC-45A4-A457-9AA3BCC92DE7}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp30", "NETCORE\test\TestApp30\TestApp30.csproj", "{E9D9D625-D7C0-4DDE-8701-ED7747D4B96E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp30.Tests30", "NETCORE\test\TestApp30.Tests\TestApp30.Tests30.csproj", "{72489742-5F18-4C99-889E-3A8102D8AC42}" -EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution WEB\Src\PerformanceCollector\Perf.Shared.NetStandard20Net45\Perf.Shared.NetStandard20Net45.projitems*{054c25dc-e545-4712-95c4-81f30cf65ce8}*SharedItemsImports = 13 @@ -488,14 +484,6 @@ Global {3D7258E3-5DDC-45A4-A457-9AA3BCC92DE7}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D7258E3-5DDC-45A4-A457-9AA3BCC92DE7}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D7258E3-5DDC-45A4-A457-9AA3BCC92DE7}.Release|Any CPU.Build.0 = Release|Any CPU - {E9D9D625-D7C0-4DDE-8701-ED7747D4B96E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E9D9D625-D7C0-4DDE-8701-ED7747D4B96E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E9D9D625-D7C0-4DDE-8701-ED7747D4B96E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E9D9D625-D7C0-4DDE-8701-ED7747D4B96E}.Release|Any CPU.Build.0 = Release|Any CPU - {72489742-5F18-4C99-889E-3A8102D8AC42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {72489742-5F18-4C99-889E-3A8102D8AC42}.Debug|Any CPU.Build.0 = Debug|Any CPU - {72489742-5F18-4C99-889E-3A8102D8AC42}.Release|Any CPU.ActiveCfg = Release|Any CPU - {72489742-5F18-4C99-889E-3A8102D8AC42}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -577,8 +565,6 @@ Global {12660582-2FB1-4849-85CB-1C42FA0E2C7C} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0} {4871B8AC-FB79-4D3D-940D-80E796110359} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0} {3D7258E3-5DDC-45A4-A457-9AA3BCC92DE7} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0} - {E9D9D625-D7C0-4DDE-8701-ED7747D4B96E} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0} - {72489742-5F18-4C99-889E-3A8102D8AC42} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0E0415AF-37CC-4999-8E5B-DD36F75BFD4D} diff --git a/IntegrationTests.Readme.md b/IntegrationTests.Readme.md new file mode 100644 index 000000000..3fe96f40d --- /dev/null +++ b/IntegrationTests.Readme.md @@ -0,0 +1,7 @@ +# Net Core Integration Tests +Integration Tests are fundamentally different than Unit Tests. +Unlike Unit Tests, these cannot be run as a standalone DLL and must be run in the context of their project (*.csproj). + +For more information please visit [Integration tests in ASP.NET Core](https://docs.microsoft.com/aspnet/core/test/integration-tests) + +For the purpose of our build servers, please use this solution for all Integration Tests. \ No newline at end of file diff --git a/IntegrationTests.sln b/IntegrationTests.sln new file mode 100644 index 000000000..50591ee46 --- /dev/null +++ b/IntegrationTests.sln @@ -0,0 +1,36 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29424.173 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp30.Tests30", "NETCORE\test\TestApp30.Tests\TestApp30.Tests30.csproj", "{A0FBD783-55E4-4B8F-993A-DFA3248EBFBA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp30", "NETCORE\test\TestApp30\TestApp30.csproj", "{EA160527-1F9B-449C-A0B3-D07A47C4FDB9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solution Items", "{81C43018-3373-4B85-9A00-5BBA2BC8C749}" + ProjectSection(SolutionItems) = preProject + IntegrationTests.Readme.md = IntegrationTests.Readme.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A0FBD783-55E4-4B8F-993A-DFA3248EBFBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0FBD783-55E4-4B8F-993A-DFA3248EBFBA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0FBD783-55E4-4B8F-993A-DFA3248EBFBA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0FBD783-55E4-4B8F-993A-DFA3248EBFBA}.Release|Any CPU.Build.0 = Release|Any CPU + {EA160527-1F9B-449C-A0B3-D07A47C4FDB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA160527-1F9B-449C-A0B3-D07A47C4FDB9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA160527-1F9B-449C-A0B3-D07A47C4FDB9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA160527-1F9B-449C-A0B3-D07A47C4FDB9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0E0415AF-37CC-4999-8E5B-DD36F75BFD4D} + EndGlobalSection +EndGlobal From 8e83183ee25400604ea373da5fb49dd05d809e4f Mon Sep 17 00:00:00 2001 From: Paul Harrington Date: Thu, 14 Nov 2019 10:28:24 -0800 Subject: [PATCH 2/3] Flush the TelemetryChannel when the logger provider is disposed (#1289) * Flush the TelemetryChannel when the logger provider is disposed * Update CHANGELOG --- LOGGING/CHANGELOG.md | 3 ++ .../ApplicationInsightsLoggerOptions.cs | 7 +++- .../ApplicationInsightsLoggerProvider.cs | 10 ++++- .../ILoggerIntegrationTests.cs | 37 ++++++++++++++++++- .../TestTelemetryChannel.cs | 30 +++++++++++++++ 5 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 LOGGING/test/ILogger.NetStandard.Tests/TestTelemetryChannel.cs diff --git a/LOGGING/CHANGELOG.md b/LOGGING/CHANGELOG.md index 89475282a..7c6f3bf04 100644 --- a/LOGGING/CHANGELOG.md +++ b/LOGGING/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## Version 2.12.0-beta1 +- [ILogger - Flush TelemetryChannel when the ILoggerProvider is Disposed.](https://github.com/microsoft/ApplicationInsights-dotnet/pull/1289) + ## Version 2.11.0 - Update Base SDK to 2.11.0 - Update System.Diagnostics.DiagnosticSource to 4.6.0. diff --git a/LOGGING/src/ILogger/ApplicationInsightsLoggerOptions.cs b/LOGGING/src/ILogger/ApplicationInsightsLoggerOptions.cs index 838d9b3c3..10367dd73 100644 --- a/LOGGING/src/ILogger/ApplicationInsightsLoggerOptions.cs +++ b/LOGGING/src/ILogger/ApplicationInsightsLoggerOptions.cs @@ -8,7 +8,6 @@ namespace Microsoft.Extensions.Logging.ApplicationInsights { using Microsoft.ApplicationInsights.DataContracts; - using Microsoft.Extensions.Logging; /// /// defines the custom behavior of the tracing information sent to Application Insights. @@ -26,5 +25,11 @@ namespace Microsoft.Extensions.Logging.ApplicationInsights /// Defaults to true. /// public bool IncludeScopes { get; set; } = true; + + /// + /// Gets or sets a value indicating whether to flush telemetry when disposing + /// of the logger provider. + /// + public bool FlushOnDispose { get; set; } = true; } } \ No newline at end of file diff --git a/LOGGING/src/ILogger/ApplicationInsightsLoggerProvider.cs b/LOGGING/src/ILogger/ApplicationInsightsLoggerProvider.cs index 05f2a024e..bbea5b2bb 100644 --- a/LOGGING/src/ILogger/ApplicationInsightsLoggerProvider.cs +++ b/LOGGING/src/ILogger/ApplicationInsightsLoggerProvider.cs @@ -8,7 +8,6 @@ namespace Microsoft.Extensions.Logging.ApplicationInsights { using System; - using System.Collections.Concurrent; using Microsoft.ApplicationInsights; using Microsoft.ApplicationInsights.Extensibility; using Microsoft.ApplicationInsights.Extensibility.Implementation; @@ -105,7 +104,14 @@ namespace Microsoft.Extensions.Logging.ApplicationInsights /// Release managed resources. protected virtual void Dispose(bool releasedManagedResources) { - // Nothing to dispose right now. + if (releasedManagedResources && this.applicationInsightsLoggerOptions.FlushOnDispose) + { + this.telemetryClient.Flush(); + + // With the ServerTelemetryChannel, Flush pushes buffered telemetry to the Transmitter, + // but it doesn't guarantee that all events have been transmitted to the endpoint. + // TODO: Should we sleep here? Should that be controlled by options? + } } } } diff --git a/LOGGING/test/ILogger.NetStandard.Tests/ILoggerIntegrationTests.cs b/LOGGING/test/ILogger.NetStandard.Tests/ILoggerIntegrationTests.cs index dc98bcc10..7110ef9c6 100644 --- a/LOGGING/test/ILogger.NetStandard.Tests/ILoggerIntegrationTests.cs +++ b/LOGGING/test/ILogger.NetStandard.Tests/ILoggerIntegrationTests.cs @@ -248,6 +248,39 @@ namespace Microsoft.ApplicationInsights Assert.IsTrue(registeredOptions.Value.IncludeScopes); } + [TestMethod] + [TestCategory("ILogger")] + public void TelemetryChannelIsFlushedWhenServiceProviderIsDisposed() + { + TestTelemetryChannel testTelemetryChannel = new TestTelemetryChannel(); + + using (ServiceProvider serviceProvider = ILoggerIntegrationTests.SetupApplicationInsightsLoggerIntegration( + delegate { }, + telemetryConfiguration => telemetryConfiguration.TelemetryChannel = testTelemetryChannel)) + { + serviceProvider.GetRequiredService>(); + } + + Assert.AreEqual(1, testTelemetryChannel.FlushCount); + } + + [TestMethod] + [TestCategory("ILogger")] + public void TelemetryChannelIsNotFlushedWhenFlushOnDisposeIsFalse() + { + TestTelemetryChannel testTelemetryChannel = new TestTelemetryChannel(); + + using (ServiceProvider serviceProvider = ILoggerIntegrationTests.SetupApplicationInsightsLoggerIntegration( + delegate { }, + telemetryConfiguration => telemetryConfiguration.TelemetryChannel = testTelemetryChannel, + applicationInsightsOptions => applicationInsightsOptions.FlushOnDispose = false)) + { + serviceProvider.GetRequiredService>(); + } + + Assert.AreEqual(0, testTelemetryChannel.FlushCount); + } + /// /// Sets up the Application insights logger. /// @@ -256,7 +289,7 @@ namespace Microsoft.ApplicationInsights /// Action to configure logger options. /// Action to add, configure services to DI container. /// Built DI container. - private static IServiceProvider SetupApplicationInsightsLoggerIntegration( + private static ServiceProvider SetupApplicationInsightsLoggerIntegration( Action telemetryActionCallback, Action configureTelemetryConfiguration = null, Action configureApplicationInsightsOptions = null, @@ -298,7 +331,7 @@ namespace Microsoft.ApplicationInsights services = configureServices.Invoke(services); } - IServiceProvider serviceProvider = services.BuildServiceProvider(); + ServiceProvider serviceProvider = services.BuildServiceProvider(); return serviceProvider; } diff --git a/LOGGING/test/ILogger.NetStandard.Tests/TestTelemetryChannel.cs b/LOGGING/test/ILogger.NetStandard.Tests/TestTelemetryChannel.cs new file mode 100644 index 000000000..dc193b6fd --- /dev/null +++ b/LOGGING/test/ILogger.NetStandard.Tests/TestTelemetryChannel.cs @@ -0,0 +1,30 @@ +// +// Copyright © Microsoft. All Rights Reserved. +// + +using Microsoft.ApplicationInsights.Channel; + +namespace Microsoft.ApplicationInsights +{ + internal sealed class TestTelemetryChannel : ITelemetryChannel + { + public TestTelemetryChannel() + { + } + + public bool? DeveloperMode { get; set; } + public string EndpointAddress { get; set; } + + public void Dispose() + { + } + + public void Flush() => FlushCount++; + + public void Send(ITelemetry item) => SendCount++; + + public int FlushCount { get; private set; } + + public int SendCount { get; private set; } + } +} \ No newline at end of file From 2d0081872cfeef91209c853e990b92aa3559b219 Mon Sep 17 00:00:00 2001 From: Timothy Mothra Date: Thu, 14 Nov 2019 11:03:49 -0800 Subject: [PATCH 3/3] delete rulesets. delete old scripts. move scripts for future work. (#1303) * delete rulesets. delete old scripts. move scripts for future work. * change to projects to use common rulesets --- .scripts/build_DockerCleanup.ps1 | 53 ++ .scripts/build_KillIisExpress.ps1 | 32 + BASE/ApplicationInsightsSDKRules.ruleset | 632 ------------------ BASE/Common.props | 2 +- BASE/GenerateReleaseMetadata.ps1 | 194 ------ BASE/Microsoft-Security-Recommended.ruleset | 73 -- BASE/Microsoft.ApplicationInsights.sln | 1 - BASE/SDL/FxCopSetup.ps1 | 92 --- BASE/disablestrongnamevalidation.ps1 | 2 - BASE/enablestrongnamevalidation.ps1 | 2 - LOGGING/ApplicationInsightsSDKRules.ruleset | 630 ----------------- LOGGING/Common.props | 2 +- LOGGING/GenerateReleaseMetadata.ps1 | 194 ------ .../Microsoft-Security-Recommended.ruleset | 73 -- LOGGING/SDL/BinSkimSetup.ps1 | 53 -- LOGGING/SDL/FxCopSetup.ps1 | 99 --- LOGGING/disablestrongnamevalidation.ps1 | 3 - LOGGING/enablestrongnamevalidation.ps1 | 3 - NETCORE/GenerateReleaseMetadata.ps1 | 194 ------ .../Microsoft-Security-Recommended.ruleset | 73 -- NETCORE/disablestrongnamevalidation.ps1 | 3 - NETCORE/enablestrongnamevalidation.ps1 | 3 - WEB/ApplicationInsightsSDKRules.ruleset | 628 ----------------- WEB/Common.props | 2 +- WEB/DevDivRuleSet.ruleset | 146 ---- WEB/GenerateReleaseMetadata.ps1 | 194 ------ WEB/Microsoft-Security-Recommended.ruleset | 73 -- WEB/NetCore.props | 2 +- WEB/SDL/BinSkimSetup.ps1 | 53 -- WEB/SDL/FxCopSetup.ps1 | 99 --- .../Xdt.Tests/Xdt.Tests.csproj | 1 - WEB/disablestrongnamevalidation.ps1 | 3 - WEB/enablestrongnamevalidation.ps1 | 3 - WEB/upgradeVersion.ps1 | 43 -- 34 files changed, 89 insertions(+), 3571 deletions(-) create mode 100644 .scripts/build_DockerCleanup.ps1 create mode 100644 .scripts/build_KillIisExpress.ps1 delete mode 100644 BASE/ApplicationInsightsSDKRules.ruleset delete mode 100644 BASE/GenerateReleaseMetadata.ps1 delete mode 100644 BASE/Microsoft-Security-Recommended.ruleset delete mode 100644 BASE/SDL/FxCopSetup.ps1 delete mode 100644 BASE/disablestrongnamevalidation.ps1 delete mode 100644 BASE/enablestrongnamevalidation.ps1 delete mode 100644 LOGGING/ApplicationInsightsSDKRules.ruleset delete mode 100644 LOGGING/GenerateReleaseMetadata.ps1 delete mode 100644 LOGGING/Microsoft-Security-Recommended.ruleset delete mode 100644 LOGGING/SDL/BinSkimSetup.ps1 delete mode 100644 LOGGING/SDL/FxCopSetup.ps1 delete mode 100644 LOGGING/disablestrongnamevalidation.ps1 delete mode 100644 LOGGING/enablestrongnamevalidation.ps1 delete mode 100644 NETCORE/GenerateReleaseMetadata.ps1 delete mode 100644 NETCORE/Microsoft-Security-Recommended.ruleset delete mode 100644 NETCORE/disablestrongnamevalidation.ps1 delete mode 100644 NETCORE/enablestrongnamevalidation.ps1 delete mode 100644 WEB/ApplicationInsightsSDKRules.ruleset delete mode 100644 WEB/DevDivRuleSet.ruleset delete mode 100644 WEB/GenerateReleaseMetadata.ps1 delete mode 100644 WEB/Microsoft-Security-Recommended.ruleset delete mode 100644 WEB/SDL/BinSkimSetup.ps1 delete mode 100644 WEB/SDL/FxCopSetup.ps1 delete mode 100644 WEB/disablestrongnamevalidation.ps1 delete mode 100644 WEB/enablestrongnamevalidation.ps1 delete mode 100644 WEB/upgradeVersion.ps1 diff --git a/.scripts/build_DockerCleanup.ps1 b/.scripts/build_DockerCleanup.ps1 new file mode 100644 index 000000000..7ea7e04c3 --- /dev/null +++ b/.scripts/build_DockerCleanup.ps1 @@ -0,0 +1,53 @@ + +# SUMMARY +# This script will stop and remove docker images from a build server. +# This is used to prevent consuming all available space on a build server. + +$ErrorActionPreference = "silentlycontinue" + +& docker info +& docker images -a +& docker ps -a + +Write-Host "Images before cleanup" +& docker images -a + +Write-Host "Containers before cleanup" +& docker ps -a + +Write-Host "Stopping E2E Containers" +& docker stop e2etests_ingestionservice_1 +& docker stop e2etests_e2etestwebapi_1 +& docker stop e2etests_e2etestwebappcore20_1 +& docker stop e2etests_e2etestwebappcore30_1 +& docker stop e2etests_e2etestwebapp_1 +& docker stop e2etests_sql-server_1 +& docker stop e2etests_azureemulator_1 + +Write-Host "Removing E2E Containers" +& docker rm e2etests_ingestionservice_1 +& docker rm e2etests_e2etestwebapi_1 +& docker rm e2etests_e2etestwebappcore20_1 +& docker rm e2etests_e2etestwebappcore30_1 +& docker rm e2etests_e2etestwebapp_1 +& docker rm e2etests_sql-server_1 +& docker rm e2etests_azureemulator_1 + +Write-Host "Removing E2E Images" +& docker rmi -f e2etests_ingestionservice +& docker rmi -f e2etests_e2etestwebapi +& docker rmi -f e2etests_e2etestwebappcore20 +& docker rmi -f e2etests_e2etestwebappcore30 +& docker rmi -f e2etests_e2etestwebapp +& docker rmi -f e2etests_azureemulator + +Write-Host "Removing dangling images" +docker images -f "dangling=true" -q | ForEach-Object {docker rmi $_ -f} + +Write-Host "Removing E2E Containers" +docker ps -a -q | ForEach-Object {docker rm $_ -f} + +Write-Host "Images after cleanup" +& docker images -a +Write-Host "Containers after cleanup" +& docker ps -a \ No newline at end of file diff --git a/.scripts/build_KillIisExpress.ps1 b/.scripts/build_KillIisExpress.ps1 new file mode 100644 index 000000000..547ac0cfd --- /dev/null +++ b/.scripts/build_KillIisExpress.ps1 @@ -0,0 +1,32 @@ + +# SUMMARY +# This script will kill iis express processes. +# This is used with our functional tests. + + +Write-Host "Cleaning up iisexpress" + +$s = Get-Process -Name iisexpress -ErrorAction SilentlyContinue + +if($s -ne $null) +{ + $s | Stop-Process +} +else +{ + Write-Host "IISExpress.exe not found" +} + +$s = Get-Process -Name iisexpresstray -ErrorAction SilentlyContinue + +if($s -ne $null) +{ + $s | Stop-Process +} +else +{ + Write-Host "iisexpresstray.exe not found" +} + +Write-Host "Cleaning up iisexpresstray completed" + diff --git a/BASE/ApplicationInsightsSDKRules.ruleset b/BASE/ApplicationInsightsSDKRules.ruleset deleted file mode 100644 index 0876baca7..000000000 --- a/BASE/ApplicationInsightsSDKRules.ruleset +++ /dev/null @@ -1,632 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BASE/Common.props b/BASE/Common.props index c0982a7ab..82027d0fb 100644 --- a/BASE/Common.props +++ b/BASE/Common.props @@ -23,7 +23,7 @@ - $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'ApplicationInsightsSDKRules.ruleset'))\ApplicationInsightsSDKRules.ruleset + $(RulesetsRoot)\ApplicationInsightsSDKRules.ruleset diff --git a/BASE/GenerateReleaseMetadata.ps1 b/BASE/GenerateReleaseMetadata.ps1 deleted file mode 100644 index e163a2b49..000000000 --- a/BASE/GenerateReleaseMetadata.ps1 +++ /dev/null @@ -1,194 +0,0 @@ -Param( - [Parameter(Mandatory=$true,HelpMessage="Path to Artifact files (nupkg):")] - [string] - $artifactsPath, - [Parameter(Mandatory=$true,HelpMessage="Path to Source files (changelog):")] - [string] - $sourcePath, - [Parameter(Mandatory=$false,HelpMessage="Path to save metadata:")] - [string] - $outPath -) - -class PackageInfo { - [string]$Name - [string]$NuspecVersion - [string]$DllVersion - [string]$MyGetUri - - PackageInfo([string]$name, [string]$nuspecVersion, [string]$dllVersion) { - $this.Name = $name - $this.NuspecVersion = $nuspecVersion - $this.DllVersion = $dllVersion - - $mygetBasePath = "https://www.myget.org/feed/applicationinsights/package/nuget/{0}/{1}" - $this.MyGetUri = $mygetBasePath -f $name, $nuspecVersion - } -} - -class ReleaseInfo { - [string]$ReleaseName - [string]$ReleaseVersion - [string]$NuspecVersion - [string]$FormattedReleaseName - [bool]$IsPreRelease - [string]$CommitId - [string]$ChangeLog - [PackageInfo[]]$Packages -} - -Function Get-GitChangeset() { - # if running localy, use git command. for VSTS, probably better to use Build.SourceVersion - # Git command only works if this script executes in the repo's directory - [string]$commit = "" - try { - $commit = $(Build.SourceVersion) - } catch { - try { - $commit = git log -1 --format=%H - } catch { - $commit = "not found" - } - } - - Write-Host "Git Commit: $commit" - return [string]$commit -} - -function Get-NuspecVersionName ([string]$version) { - # get everything up to word "-build" (ex: "1.2.3-beta1-build1234 returns: "1.2.3-beta1") - # get everything (ex: "1.2.3-beta1 returns: "1.2.3-beta1") - # get everything (ex: "1.2.3 returns: "1.2.3") - $splitVersion = $version.split('-') - if($splitVersion.Length -gt 2 ) { - return $splitVersion[0]+"-"+$splitVersion[1] - } else { - return $version - } -} - -function Invoke-UnZip([string]$zipfile, [string]$outpath) { - Write-Verbose "Unzip - source: $zipfile" - Write-Verbose "Unzip - target: $outpath" - Add-Type -assembly "system.io.compression.filesystem" - [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) -} - -function Get-PackageInfoFromNupkg([string]$nupkgPath) { - $unzipPath = $nupkgPath+"_unzip" - $null = Invoke-UnZip $nupkgPath $unzipPath - - $nuspecPath = Get-ChildItem -Path $unzipPath -Recurse -Filter *.nuspec | Select-Object -First 1 - Write-Verbose ("Found Nuspec: " + $nuspecPath.FullName) - [xml]$nuspec = Get-Content $nuspecPath.FullName - $name = $nuspec.package.metadata.id - $nuspecVersion = $nuspec.package.metadata.version - - $dllPath = Get-ChildItem -Path $unzipPath -Recurse -Filter *.dll | Select-Object -First 1 - Write-Verbose ("Found Dll: " + $dllPath.FullName) - $dllVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dllPath.FullName).FileVersion - - return [PackageInfo]::new($name, $nuspecVersion, $dllVersion) -} - -function Get-ReleaseMetaData ([string]$artifactsPath, [string]$sourcePath) { - $object = [ReleaseInfo]::new() - $object.CommitId = Get-GitChangeset - $object.Packages = $() - - Get-ChildItem -Path $artifactsPath -Recurse -Filter *.nupkg -Exclude *.symbols.nupkg | - ForEach-Object { $object.Packages += Get-PackageInfoFromNupkg $_.FullName } - - $object.NuspecVersion = $object.Packages[0].NuspecVersion - $object.ReleaseName = Get-NuspecVersionName($object.Packages[0].NuspecVersion) - $object.ReleaseVersion = $object.Packages[0].DllVersion - - $object.FormattedReleaseName = "$($object.ReleaseName) ($($object.ReleaseVersion))" - - $object.IsPreRelease = [bool]($object.ReleaseName -like "*beta*") - - $object.ChangeLog = Get-ChangelogText $sourcePath $object.ReleaseName - return $object -} - -Function Get-ChangelogText ([string]$sourcePath, [string]$versionName) { - $sb = [System.Text.StringBuilder]::new() - $saveLines = $false - $readFile = $true - - $changelogPath = Get-ChildItem -Path $sourcePath -Recurse -Filter changelog.md | Select-Object -First 1 - Write-Verbose "Changelog Found: $changelogPath" - Get-Content -Path $changelogPath.FullName | ForEach-Object { - - if($readFile) { - - if($saveLines) { - if($_ -like "##*") { - Write-Verbose "STOP at $_" - $readFile = $false - } - - if($readFile) { - [void]$sb.AppendLine($_) - } - } else { - if(($_ -like "##*") -and ($_ -match $versionName)) { - $saveLines = $true - Write-Verbose "START at $_" - } - } - } - - } - return $sb.ToString() -} - -Function Save-ToXml([string]$outPath, [ReleaseInfo]$object) { - $outFilePath = Join-Path $outPath "releaseMetaData.xml" - $xmlWriter = [System.XMl.XmlTextWriter]::new($outFilePath, $Null) - $xmlWriter.Formatting = "Indented" - $xmlWriter.Indentation = 1 - $XmlWriter.IndentChar = "`t" - - # write the header - $xmlWriter.WriteStartDocument() - - # create root node: - $xmlWriter.WriteStartElement("MetaData") - - $XmlWriter.WriteElementString("ReleaseName", $object.ReleaseName) - $XmlWriter.WriteElementString("ReleaseVersion", $object.ReleaseVersion) - $XmlWriter.WriteElementString("FormattedReleaseName", $object.FormattedReleaseName) - $XmlWriter.WriteElementString("NuspecVersion", $object.NuspecVersion) - $XmlWriter.WriteElementString("IsPreRelease", $object.IsPreRelease) - $XmlWriter.WriteElementString("CommitId", $object.CommitId) - - $XmlWriter.WriteElementString("ChangeLog", $object.ChangeLog) - - $XmlWriter.WriteStartElement("Packages") - $object.Packages | ForEach-Object { - $XmlWriter.WriteStartElement("Package") - $XmlWriter.WriteElementString("Name", $_.Name) - $XmlWriter.WriteElementString("NuspecVersion", $_.NuspecVersion) - $XmlWriter.WriteElementString("DllVersion", $_.DllVersion) - $XmlWriter.WriteElementString("MyGetUri", $_.MyGetUri) - $XmlWriter.WriteEndElement() - } - $XmlWriter.WriteEndElement() - - # close the root node: - $xmlWriter.WriteEndElement() - - # finalize the document: - $xmlWriter.WriteEndDocument() - $xmlWriter.Flush() - $xmlWriter.Close() -} - -# 1) GET META DATA FROM ARTIFACTS -$metaData = Get-ReleaseMetaData $artifactsPath $sourcePath -Write-Output $metaData -$metaData.Packages | ForEach-Object { Write-Output $_ } - -# 2) SAVE -Save-ToXml $outPath $metaData \ No newline at end of file diff --git a/BASE/Microsoft-Security-Recommended.ruleset b/BASE/Microsoft-Security-Recommended.ruleset deleted file mode 100644 index 279d77f56..000000000 --- a/BASE/Microsoft-Security-Recommended.ruleset +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BASE/Microsoft.ApplicationInsights.sln b/BASE/Microsoft.ApplicationInsights.sln index 4c3c4bf0e..ac211e268 100644 --- a/BASE/Microsoft.ApplicationInsights.sln +++ b/BASE/Microsoft.ApplicationInsights.sln @@ -13,7 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solutio ProjectSection(SolutionItems) = preProject .gitignore = .gitignore AddXmlLanguage.targets = AddXmlLanguage.targets - ApplicationInsightsSDKRules.ruleset = ApplicationInsightsSDKRules.ruleset CHANGELOG.md = CHANGELOG.md CodeCov.ps1 = CodeCov.ps1 Common.props = Common.props diff --git a/BASE/SDL/FxCopSetup.ps1 b/BASE/SDL/FxCopSetup.ps1 deleted file mode 100644 index 675ea72d5..000000000 --- a/BASE/SDL/FxCopSetup.ps1 +++ /dev/null @@ -1,92 +0,0 @@ -[CmdletBinding()] -Param( - # C:\Repos\bin\Debug\Src - [string]$buildDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "bin\Debug") , - - # C:\Repos\fxCop - [string]$fxCopDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "fxCop") -) - -function IsFileDependency { - [CmdletBinding()] - param - ( - $file - ) - $dependencyFiles | ForEach-Object { - if($file.Name -eq $_) { - return $true; - } - } - - return $false; - } - -# these are dlls that end up in the bin, but do not belong to us and don't need to be scanned. -$excludedFiles = @(); -$dependencyFiles = @("System.Diagnostics.DiagnosticSource.dll"); - -Write-Host "`nPARAMETERS:"; -Write-Host "`tbuildDirectory:" $buildDirectory; -Write-Host "`tfxCopDirectory:" $fxCopDirectory; - -$fxCopTargetDir = Join-Path -Path $fxCopDirectory -ChildPath "target"; -$fxCopDependenciesDir = Join-Path -Path $fxCopDirectory -ChildPath "dependencies"; - - -$frameworks = @("net45", "net46", "netstandard1.3"); - -# don't need to clean folder on build server, but is needed for local dev -Write-Host "`nCreate FxCop Directory..."; -if (Test-Path $fxCopDirectory) { Remove-Item $fxCopDirectory -Recurse; } - -# copy all -Write-Host "`nCopy all files (excluding 'Test' directories)..."; -Get-ChildItem -Path $buildDirectory -Recurse -File -Include *.dll, *.pdb | - ForEach-Object { - $file = $_; - - # exclude test files - if ($file.Directory -match "Test") { - return; - } - - #find matching framework - $frameworks | ForEach-Object { - if($file.Directory -match $_) { - $framework = $_; - - #is this file a dependency - if (IsFileDependency($file)) { - Copy-Item $file.FullName -Destination (New-Item (Join-Path -Path $fxCopDependenciesDir -ChildPath $framework) -Type container -Force) -Force; - } else { - Copy-Item $file.FullName -Destination (New-Item (Join-Path -Path $fxCopTargetDir -ChildPath $framework) -Type container -Force) -Force; - } - } - } - } - -# delete excluded files -if ($excludedFiles.Count -gt 0) { - Write-Host "`nDelete excluded files..."; - Get-ChildItem -Path $fxCopDirectory -Recurse -File | - ForEach-Object { - if ($excludedFiles.Contains($_.Name)) { - Write-Host "Excluded File:" $_.FullName; - Remove-Item $_.FullName; - } - } -} - -# summary for log output (file list and count) -Write-Host "`nCopied Files:"; - -$count = 0; -Get-ChildItem -Path $fxCopDirectory -Recurse -File | - ForEach-Object { - Write-Host "`t"$_.FullName; - $count++; - } - -Write-Host "`nTOTAL FILES:" $count; - diff --git a/BASE/disablestrongnamevalidation.ps1 b/BASE/disablestrongnamevalidation.ps1 deleted file mode 100644 index 0ecd95825..000000000 --- a/BASE/disablestrongnamevalidation.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64\sn.exe" -Vr *,31bf3856ad364e35 -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\sn.exe" -Vr *,31bf3856ad364e35 diff --git a/BASE/enablestrongnamevalidation.ps1 b/BASE/enablestrongnamevalidation.ps1 deleted file mode 100644 index 2cb21ffaf..000000000 --- a/BASE/enablestrongnamevalidation.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64\sn.exe" -Vu *,31bf3856ad364e35 -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\sn.exe" -Vu *,31bf3856ad364e35 \ No newline at end of file diff --git a/LOGGING/ApplicationInsightsSDKRules.ruleset b/LOGGING/ApplicationInsightsSDKRules.ruleset deleted file mode 100644 index f7803bbc9..000000000 --- a/LOGGING/ApplicationInsightsSDKRules.ruleset +++ /dev/null @@ -1,630 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LOGGING/Common.props b/LOGGING/Common.props index f8678a837..475ad2bb8 100644 --- a/LOGGING/Common.props +++ b/LOGGING/Common.props @@ -6,7 +6,7 @@ - $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'ApplicationInsightsSDKRules.ruleset'))\ApplicationInsightsSDKRules.ruleset + $(RulesetsRoot)\ApplicationInsightsSDKRules.ruleset diff --git a/LOGGING/GenerateReleaseMetadata.ps1 b/LOGGING/GenerateReleaseMetadata.ps1 deleted file mode 100644 index e163a2b49..000000000 --- a/LOGGING/GenerateReleaseMetadata.ps1 +++ /dev/null @@ -1,194 +0,0 @@ -Param( - [Parameter(Mandatory=$true,HelpMessage="Path to Artifact files (nupkg):")] - [string] - $artifactsPath, - [Parameter(Mandatory=$true,HelpMessage="Path to Source files (changelog):")] - [string] - $sourcePath, - [Parameter(Mandatory=$false,HelpMessage="Path to save metadata:")] - [string] - $outPath -) - -class PackageInfo { - [string]$Name - [string]$NuspecVersion - [string]$DllVersion - [string]$MyGetUri - - PackageInfo([string]$name, [string]$nuspecVersion, [string]$dllVersion) { - $this.Name = $name - $this.NuspecVersion = $nuspecVersion - $this.DllVersion = $dllVersion - - $mygetBasePath = "https://www.myget.org/feed/applicationinsights/package/nuget/{0}/{1}" - $this.MyGetUri = $mygetBasePath -f $name, $nuspecVersion - } -} - -class ReleaseInfo { - [string]$ReleaseName - [string]$ReleaseVersion - [string]$NuspecVersion - [string]$FormattedReleaseName - [bool]$IsPreRelease - [string]$CommitId - [string]$ChangeLog - [PackageInfo[]]$Packages -} - -Function Get-GitChangeset() { - # if running localy, use git command. for VSTS, probably better to use Build.SourceVersion - # Git command only works if this script executes in the repo's directory - [string]$commit = "" - try { - $commit = $(Build.SourceVersion) - } catch { - try { - $commit = git log -1 --format=%H - } catch { - $commit = "not found" - } - } - - Write-Host "Git Commit: $commit" - return [string]$commit -} - -function Get-NuspecVersionName ([string]$version) { - # get everything up to word "-build" (ex: "1.2.3-beta1-build1234 returns: "1.2.3-beta1") - # get everything (ex: "1.2.3-beta1 returns: "1.2.3-beta1") - # get everything (ex: "1.2.3 returns: "1.2.3") - $splitVersion = $version.split('-') - if($splitVersion.Length -gt 2 ) { - return $splitVersion[0]+"-"+$splitVersion[1] - } else { - return $version - } -} - -function Invoke-UnZip([string]$zipfile, [string]$outpath) { - Write-Verbose "Unzip - source: $zipfile" - Write-Verbose "Unzip - target: $outpath" - Add-Type -assembly "system.io.compression.filesystem" - [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) -} - -function Get-PackageInfoFromNupkg([string]$nupkgPath) { - $unzipPath = $nupkgPath+"_unzip" - $null = Invoke-UnZip $nupkgPath $unzipPath - - $nuspecPath = Get-ChildItem -Path $unzipPath -Recurse -Filter *.nuspec | Select-Object -First 1 - Write-Verbose ("Found Nuspec: " + $nuspecPath.FullName) - [xml]$nuspec = Get-Content $nuspecPath.FullName - $name = $nuspec.package.metadata.id - $nuspecVersion = $nuspec.package.metadata.version - - $dllPath = Get-ChildItem -Path $unzipPath -Recurse -Filter *.dll | Select-Object -First 1 - Write-Verbose ("Found Dll: " + $dllPath.FullName) - $dllVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dllPath.FullName).FileVersion - - return [PackageInfo]::new($name, $nuspecVersion, $dllVersion) -} - -function Get-ReleaseMetaData ([string]$artifactsPath, [string]$sourcePath) { - $object = [ReleaseInfo]::new() - $object.CommitId = Get-GitChangeset - $object.Packages = $() - - Get-ChildItem -Path $artifactsPath -Recurse -Filter *.nupkg -Exclude *.symbols.nupkg | - ForEach-Object { $object.Packages += Get-PackageInfoFromNupkg $_.FullName } - - $object.NuspecVersion = $object.Packages[0].NuspecVersion - $object.ReleaseName = Get-NuspecVersionName($object.Packages[0].NuspecVersion) - $object.ReleaseVersion = $object.Packages[0].DllVersion - - $object.FormattedReleaseName = "$($object.ReleaseName) ($($object.ReleaseVersion))" - - $object.IsPreRelease = [bool]($object.ReleaseName -like "*beta*") - - $object.ChangeLog = Get-ChangelogText $sourcePath $object.ReleaseName - return $object -} - -Function Get-ChangelogText ([string]$sourcePath, [string]$versionName) { - $sb = [System.Text.StringBuilder]::new() - $saveLines = $false - $readFile = $true - - $changelogPath = Get-ChildItem -Path $sourcePath -Recurse -Filter changelog.md | Select-Object -First 1 - Write-Verbose "Changelog Found: $changelogPath" - Get-Content -Path $changelogPath.FullName | ForEach-Object { - - if($readFile) { - - if($saveLines) { - if($_ -like "##*") { - Write-Verbose "STOP at $_" - $readFile = $false - } - - if($readFile) { - [void]$sb.AppendLine($_) - } - } else { - if(($_ -like "##*") -and ($_ -match $versionName)) { - $saveLines = $true - Write-Verbose "START at $_" - } - } - } - - } - return $sb.ToString() -} - -Function Save-ToXml([string]$outPath, [ReleaseInfo]$object) { - $outFilePath = Join-Path $outPath "releaseMetaData.xml" - $xmlWriter = [System.XMl.XmlTextWriter]::new($outFilePath, $Null) - $xmlWriter.Formatting = "Indented" - $xmlWriter.Indentation = 1 - $XmlWriter.IndentChar = "`t" - - # write the header - $xmlWriter.WriteStartDocument() - - # create root node: - $xmlWriter.WriteStartElement("MetaData") - - $XmlWriter.WriteElementString("ReleaseName", $object.ReleaseName) - $XmlWriter.WriteElementString("ReleaseVersion", $object.ReleaseVersion) - $XmlWriter.WriteElementString("FormattedReleaseName", $object.FormattedReleaseName) - $XmlWriter.WriteElementString("NuspecVersion", $object.NuspecVersion) - $XmlWriter.WriteElementString("IsPreRelease", $object.IsPreRelease) - $XmlWriter.WriteElementString("CommitId", $object.CommitId) - - $XmlWriter.WriteElementString("ChangeLog", $object.ChangeLog) - - $XmlWriter.WriteStartElement("Packages") - $object.Packages | ForEach-Object { - $XmlWriter.WriteStartElement("Package") - $XmlWriter.WriteElementString("Name", $_.Name) - $XmlWriter.WriteElementString("NuspecVersion", $_.NuspecVersion) - $XmlWriter.WriteElementString("DllVersion", $_.DllVersion) - $XmlWriter.WriteElementString("MyGetUri", $_.MyGetUri) - $XmlWriter.WriteEndElement() - } - $XmlWriter.WriteEndElement() - - # close the root node: - $xmlWriter.WriteEndElement() - - # finalize the document: - $xmlWriter.WriteEndDocument() - $xmlWriter.Flush() - $xmlWriter.Close() -} - -# 1) GET META DATA FROM ARTIFACTS -$metaData = Get-ReleaseMetaData $artifactsPath $sourcePath -Write-Output $metaData -$metaData.Packages | ForEach-Object { Write-Output $_ } - -# 2) SAVE -Save-ToXml $outPath $metaData \ No newline at end of file diff --git a/LOGGING/Microsoft-Security-Recommended.ruleset b/LOGGING/Microsoft-Security-Recommended.ruleset deleted file mode 100644 index 279d77f56..000000000 --- a/LOGGING/Microsoft-Security-Recommended.ruleset +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LOGGING/SDL/BinSkimSetup.ps1 b/LOGGING/SDL/BinSkimSetup.ps1 deleted file mode 100644 index 52931b5be..000000000 --- a/LOGGING/SDL/BinSkimSetup.ps1 +++ /dev/null @@ -1,53 +0,0 @@ -[CmdletBinding()] -Param( - # C:\Repos\bin\Debug\Src - [string]$buildDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "bin\Debug\Src") , - - # C:\Repos\binSkim - [string]$binSkimDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "binSkim") -) - -# these are dlls that end up in the bin, but do not belong to us and don't need to be scanned. -$excludedFiles = @("KernelTraceControl.dll", "msdia140.dll") - -Write-Host "`nPARAMETERS:"; -Write-Host "`tbuildDirectory:" $buildDirectory; -Write-Host "`tbinSkimDirectory:" $binSkimDirectory; - -# don't need to clean folder on build server, but is needed for local dev -Write-Host "`nCreate BinSkim Directory..."; -if (Test-Path $binSkimDirectory) { Remove-Item $binSkimDirectory -Recurse; } - -# copy all -Write-Host "`nCopy all files..."; -Copy-Item -Path $buildDirectory -Filter "*.dll" -Destination $binSkimDirectory -Recurse; - -# delete test directories -Write-Host "`nDelete any 'Test' directories..."; -Get-ChildItem -Path $binSkimDirectory -Recurse -Directory | - Where-Object {$_ -match "Test"} | - Remove-Item -Recurse; - -# delete excluded files -if ($excludedFiles.Count -gt 0) { - Write-Host "`nDelete excluded files..."; - Get-ChildItem -Path $binSkimDirectory -Recurse -File | - ForEach-Object { - if ($excludedFiles.Contains($_.Name)) { - Write-Host "Excluded File:" $_.FullName; - Remove-Item $_.FullName; - } - } -} - -# summary for log output (file list and count) -Write-Host "`nCopied Files:"; - -$count = 0; -Get-ChildItem -Path $binSkimDirectory -Recurse -File | - ForEach-Object { - Write-Host "`t"$_.FullName; - $count++; - } - -Write-Host "`nTOTAL FILES:" $count; \ No newline at end of file diff --git a/LOGGING/SDL/FxCopSetup.ps1 b/LOGGING/SDL/FxCopSetup.ps1 deleted file mode 100644 index 470ae47fa..000000000 --- a/LOGGING/SDL/FxCopSetup.ps1 +++ /dev/null @@ -1,99 +0,0 @@ -[CmdletBinding()] -Param( - # C:\Repos\bin\Debug\Src - [string]$buildDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "bin\Debug") , - - # C:\Repos\fxCop - [string]$fxCopDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "fxCop") -) - -function IsFileDependency { - [CmdletBinding()] - param - ( - $file - ) - $dependencyFiles | ForEach-Object { - if($file.Name -eq $_) { - return $true; - } - } - - return $false; - } - -# these are dlls that end up in the bin, but do not belong to us and don't need to be scanned. -$excludedFiles = @( - "KernelTraceControl.dll", - "msdia140.dll"); -$dependencyFiles = @( - "Microsoft.ApplicationInsights.dll", - "log4net.dll", - "NLog.dll", - "Microsoft.Diagnostics.Tracing.TraceEvent.dll", - "System.Diagnostics.DiagnosticSource.dll"); - -Write-Host "`nPARAMETERS:"; -Write-Host "`tbuildDirectory:" $buildDirectory; -Write-Host "`tfxCopDirectory:" $fxCopDirectory; - -$fxCopTargetDir = Join-Path -Path $fxCopDirectory -ChildPath "target"; -$fxCopDependenciesDir = Join-Path -Path $fxCopDirectory -ChildPath "dependencies"; - - -$frameworks = @("net45", "net451", "netstandard1.3"); - -# don't need to clean folder on build server, but is needed for local dev -Write-Host "`nCreate FxCop Directory..."; -if (Test-Path $fxCopDirectory) { Remove-Item $fxCopDirectory -Recurse; } - -# copy all -Write-Host "`nCopy all files (excluding 'Test' directories)..."; -Get-ChildItem -Path $buildDirectory -Recurse -File -Include *.dll, *.pdb | - ForEach-Object { - $file = $_; - - # exclude test files - if ($file.Directory -match "Test") { - return; - } - - #find matching framework - $frameworks | ForEach-Object { - if($file.Directory -match $_) { - $framework = $_; - - #is this file a dependency - if (IsFileDependency($file)) { - Copy-Item $file.FullName -Destination (New-Item (Join-Path -Path $fxCopDependenciesDir -ChildPath $framework) -Type container -Force) -Force; - } else { - Copy-Item $file.FullName -Destination (New-Item (Join-Path -Path $fxCopTargetDir -ChildPath $framework) -Type container -Force) -Force; - } - } - } - } - -# delete excluded files -if ($excludedFiles.Count -gt 0) { - Write-Host "`nDelete excluded files..."; - Get-ChildItem -Path $fxCopDirectory -Recurse -File | - ForEach-Object { - if ($excludedFiles.Contains($_.Name)) { - Write-Host "Excluded File:" $_.FullName; - Remove-Item $_.FullName; - } - } -} - -# summary for log output (file list and count) -Write-Host "`nCopied Files:"; - -$count = 0; -Get-ChildItem -Path $fxCopDirectory -Recurse -File | - ForEach-Object { - Write-Host "`t"$_.FullName; - $count++; - } - -Write-Host "`nTOTAL FILES:" $count; - diff --git a/LOGGING/disablestrongnamevalidation.ps1 b/LOGGING/disablestrongnamevalidation.ps1 deleted file mode 100644 index 6d8f5668a..000000000 --- a/LOGGING/disablestrongnamevalidation.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64\sn.exe" -Vr *,31bf3856ad364e35 -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\sn.exe" -Vr *,31bf3856ad364e35 -# running both the above as a hack which is known to work. Its not clear why both are needed. diff --git a/LOGGING/enablestrongnamevalidation.ps1 b/LOGGING/enablestrongnamevalidation.ps1 deleted file mode 100644 index 456ca45ee..000000000 --- a/LOGGING/enablestrongnamevalidation.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64\sn.exe" -Vu *,31bf3856ad364e35 -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\sn.exe" -Vu *,31bf3856ad364e35 -# running both the above as a hack which is known to work. Its not clear why both are needed. \ No newline at end of file diff --git a/NETCORE/GenerateReleaseMetadata.ps1 b/NETCORE/GenerateReleaseMetadata.ps1 deleted file mode 100644 index e163a2b49..000000000 --- a/NETCORE/GenerateReleaseMetadata.ps1 +++ /dev/null @@ -1,194 +0,0 @@ -Param( - [Parameter(Mandatory=$true,HelpMessage="Path to Artifact files (nupkg):")] - [string] - $artifactsPath, - [Parameter(Mandatory=$true,HelpMessage="Path to Source files (changelog):")] - [string] - $sourcePath, - [Parameter(Mandatory=$false,HelpMessage="Path to save metadata:")] - [string] - $outPath -) - -class PackageInfo { - [string]$Name - [string]$NuspecVersion - [string]$DllVersion - [string]$MyGetUri - - PackageInfo([string]$name, [string]$nuspecVersion, [string]$dllVersion) { - $this.Name = $name - $this.NuspecVersion = $nuspecVersion - $this.DllVersion = $dllVersion - - $mygetBasePath = "https://www.myget.org/feed/applicationinsights/package/nuget/{0}/{1}" - $this.MyGetUri = $mygetBasePath -f $name, $nuspecVersion - } -} - -class ReleaseInfo { - [string]$ReleaseName - [string]$ReleaseVersion - [string]$NuspecVersion - [string]$FormattedReleaseName - [bool]$IsPreRelease - [string]$CommitId - [string]$ChangeLog - [PackageInfo[]]$Packages -} - -Function Get-GitChangeset() { - # if running localy, use git command. for VSTS, probably better to use Build.SourceVersion - # Git command only works if this script executes in the repo's directory - [string]$commit = "" - try { - $commit = $(Build.SourceVersion) - } catch { - try { - $commit = git log -1 --format=%H - } catch { - $commit = "not found" - } - } - - Write-Host "Git Commit: $commit" - return [string]$commit -} - -function Get-NuspecVersionName ([string]$version) { - # get everything up to word "-build" (ex: "1.2.3-beta1-build1234 returns: "1.2.3-beta1") - # get everything (ex: "1.2.3-beta1 returns: "1.2.3-beta1") - # get everything (ex: "1.2.3 returns: "1.2.3") - $splitVersion = $version.split('-') - if($splitVersion.Length -gt 2 ) { - return $splitVersion[0]+"-"+$splitVersion[1] - } else { - return $version - } -} - -function Invoke-UnZip([string]$zipfile, [string]$outpath) { - Write-Verbose "Unzip - source: $zipfile" - Write-Verbose "Unzip - target: $outpath" - Add-Type -assembly "system.io.compression.filesystem" - [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) -} - -function Get-PackageInfoFromNupkg([string]$nupkgPath) { - $unzipPath = $nupkgPath+"_unzip" - $null = Invoke-UnZip $nupkgPath $unzipPath - - $nuspecPath = Get-ChildItem -Path $unzipPath -Recurse -Filter *.nuspec | Select-Object -First 1 - Write-Verbose ("Found Nuspec: " + $nuspecPath.FullName) - [xml]$nuspec = Get-Content $nuspecPath.FullName - $name = $nuspec.package.metadata.id - $nuspecVersion = $nuspec.package.metadata.version - - $dllPath = Get-ChildItem -Path $unzipPath -Recurse -Filter *.dll | Select-Object -First 1 - Write-Verbose ("Found Dll: " + $dllPath.FullName) - $dllVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dllPath.FullName).FileVersion - - return [PackageInfo]::new($name, $nuspecVersion, $dllVersion) -} - -function Get-ReleaseMetaData ([string]$artifactsPath, [string]$sourcePath) { - $object = [ReleaseInfo]::new() - $object.CommitId = Get-GitChangeset - $object.Packages = $() - - Get-ChildItem -Path $artifactsPath -Recurse -Filter *.nupkg -Exclude *.symbols.nupkg | - ForEach-Object { $object.Packages += Get-PackageInfoFromNupkg $_.FullName } - - $object.NuspecVersion = $object.Packages[0].NuspecVersion - $object.ReleaseName = Get-NuspecVersionName($object.Packages[0].NuspecVersion) - $object.ReleaseVersion = $object.Packages[0].DllVersion - - $object.FormattedReleaseName = "$($object.ReleaseName) ($($object.ReleaseVersion))" - - $object.IsPreRelease = [bool]($object.ReleaseName -like "*beta*") - - $object.ChangeLog = Get-ChangelogText $sourcePath $object.ReleaseName - return $object -} - -Function Get-ChangelogText ([string]$sourcePath, [string]$versionName) { - $sb = [System.Text.StringBuilder]::new() - $saveLines = $false - $readFile = $true - - $changelogPath = Get-ChildItem -Path $sourcePath -Recurse -Filter changelog.md | Select-Object -First 1 - Write-Verbose "Changelog Found: $changelogPath" - Get-Content -Path $changelogPath.FullName | ForEach-Object { - - if($readFile) { - - if($saveLines) { - if($_ -like "##*") { - Write-Verbose "STOP at $_" - $readFile = $false - } - - if($readFile) { - [void]$sb.AppendLine($_) - } - } else { - if(($_ -like "##*") -and ($_ -match $versionName)) { - $saveLines = $true - Write-Verbose "START at $_" - } - } - } - - } - return $sb.ToString() -} - -Function Save-ToXml([string]$outPath, [ReleaseInfo]$object) { - $outFilePath = Join-Path $outPath "releaseMetaData.xml" - $xmlWriter = [System.XMl.XmlTextWriter]::new($outFilePath, $Null) - $xmlWriter.Formatting = "Indented" - $xmlWriter.Indentation = 1 - $XmlWriter.IndentChar = "`t" - - # write the header - $xmlWriter.WriteStartDocument() - - # create root node: - $xmlWriter.WriteStartElement("MetaData") - - $XmlWriter.WriteElementString("ReleaseName", $object.ReleaseName) - $XmlWriter.WriteElementString("ReleaseVersion", $object.ReleaseVersion) - $XmlWriter.WriteElementString("FormattedReleaseName", $object.FormattedReleaseName) - $XmlWriter.WriteElementString("NuspecVersion", $object.NuspecVersion) - $XmlWriter.WriteElementString("IsPreRelease", $object.IsPreRelease) - $XmlWriter.WriteElementString("CommitId", $object.CommitId) - - $XmlWriter.WriteElementString("ChangeLog", $object.ChangeLog) - - $XmlWriter.WriteStartElement("Packages") - $object.Packages | ForEach-Object { - $XmlWriter.WriteStartElement("Package") - $XmlWriter.WriteElementString("Name", $_.Name) - $XmlWriter.WriteElementString("NuspecVersion", $_.NuspecVersion) - $XmlWriter.WriteElementString("DllVersion", $_.DllVersion) - $XmlWriter.WriteElementString("MyGetUri", $_.MyGetUri) - $XmlWriter.WriteEndElement() - } - $XmlWriter.WriteEndElement() - - # close the root node: - $xmlWriter.WriteEndElement() - - # finalize the document: - $xmlWriter.WriteEndDocument() - $xmlWriter.Flush() - $xmlWriter.Close() -} - -# 1) GET META DATA FROM ARTIFACTS -$metaData = Get-ReleaseMetaData $artifactsPath $sourcePath -Write-Output $metaData -$metaData.Packages | ForEach-Object { Write-Output $_ } - -# 2) SAVE -Save-ToXml $outPath $metaData \ No newline at end of file diff --git a/NETCORE/Microsoft-Security-Recommended.ruleset b/NETCORE/Microsoft-Security-Recommended.ruleset deleted file mode 100644 index 279d77f56..000000000 --- a/NETCORE/Microsoft-Security-Recommended.ruleset +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NETCORE/disablestrongnamevalidation.ps1 b/NETCORE/disablestrongnamevalidation.ps1 deleted file mode 100644 index 6d8f5668a..000000000 --- a/NETCORE/disablestrongnamevalidation.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64\sn.exe" -Vr *,31bf3856ad364e35 -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\sn.exe" -Vr *,31bf3856ad364e35 -# running both the above as a hack which is known to work. Its not clear why both are needed. diff --git a/NETCORE/enablestrongnamevalidation.ps1 b/NETCORE/enablestrongnamevalidation.ps1 deleted file mode 100644 index 456ca45ee..000000000 --- a/NETCORE/enablestrongnamevalidation.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64\sn.exe" -Vu *,31bf3856ad364e35 -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\sn.exe" -Vu *,31bf3856ad364e35 -# running both the above as a hack which is known to work. Its not clear why both are needed. \ No newline at end of file diff --git a/WEB/ApplicationInsightsSDKRules.ruleset b/WEB/ApplicationInsightsSDKRules.ruleset deleted file mode 100644 index 90d1b67cb..000000000 --- a/WEB/ApplicationInsightsSDKRules.ruleset +++ /dev/null @@ -1,628 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/WEB/Common.props b/WEB/Common.props index 513c8ec27..777a40542 100644 --- a/WEB/Common.props +++ b/WEB/Common.props @@ -11,7 +11,7 @@ 4 True False - $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'ApplicationInsightsSDKRules.ruleset'))\ApplicationInsightsSDKRules.ruleset + $(RulesetsRoot)\ApplicationInsightsSDKRules.ruleset true diff --git a/WEB/DevDivRuleSet.ruleset b/WEB/DevDivRuleSet.ruleset deleted file mode 100644 index 240044124..000000000 --- a/WEB/DevDivRuleSet.ruleset +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/WEB/GenerateReleaseMetadata.ps1 b/WEB/GenerateReleaseMetadata.ps1 deleted file mode 100644 index e163a2b49..000000000 --- a/WEB/GenerateReleaseMetadata.ps1 +++ /dev/null @@ -1,194 +0,0 @@ -Param( - [Parameter(Mandatory=$true,HelpMessage="Path to Artifact files (nupkg):")] - [string] - $artifactsPath, - [Parameter(Mandatory=$true,HelpMessage="Path to Source files (changelog):")] - [string] - $sourcePath, - [Parameter(Mandatory=$false,HelpMessage="Path to save metadata:")] - [string] - $outPath -) - -class PackageInfo { - [string]$Name - [string]$NuspecVersion - [string]$DllVersion - [string]$MyGetUri - - PackageInfo([string]$name, [string]$nuspecVersion, [string]$dllVersion) { - $this.Name = $name - $this.NuspecVersion = $nuspecVersion - $this.DllVersion = $dllVersion - - $mygetBasePath = "https://www.myget.org/feed/applicationinsights/package/nuget/{0}/{1}" - $this.MyGetUri = $mygetBasePath -f $name, $nuspecVersion - } -} - -class ReleaseInfo { - [string]$ReleaseName - [string]$ReleaseVersion - [string]$NuspecVersion - [string]$FormattedReleaseName - [bool]$IsPreRelease - [string]$CommitId - [string]$ChangeLog - [PackageInfo[]]$Packages -} - -Function Get-GitChangeset() { - # if running localy, use git command. for VSTS, probably better to use Build.SourceVersion - # Git command only works if this script executes in the repo's directory - [string]$commit = "" - try { - $commit = $(Build.SourceVersion) - } catch { - try { - $commit = git log -1 --format=%H - } catch { - $commit = "not found" - } - } - - Write-Host "Git Commit: $commit" - return [string]$commit -} - -function Get-NuspecVersionName ([string]$version) { - # get everything up to word "-build" (ex: "1.2.3-beta1-build1234 returns: "1.2.3-beta1") - # get everything (ex: "1.2.3-beta1 returns: "1.2.3-beta1") - # get everything (ex: "1.2.3 returns: "1.2.3") - $splitVersion = $version.split('-') - if($splitVersion.Length -gt 2 ) { - return $splitVersion[0]+"-"+$splitVersion[1] - } else { - return $version - } -} - -function Invoke-UnZip([string]$zipfile, [string]$outpath) { - Write-Verbose "Unzip - source: $zipfile" - Write-Verbose "Unzip - target: $outpath" - Add-Type -assembly "system.io.compression.filesystem" - [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) -} - -function Get-PackageInfoFromNupkg([string]$nupkgPath) { - $unzipPath = $nupkgPath+"_unzip" - $null = Invoke-UnZip $nupkgPath $unzipPath - - $nuspecPath = Get-ChildItem -Path $unzipPath -Recurse -Filter *.nuspec | Select-Object -First 1 - Write-Verbose ("Found Nuspec: " + $nuspecPath.FullName) - [xml]$nuspec = Get-Content $nuspecPath.FullName - $name = $nuspec.package.metadata.id - $nuspecVersion = $nuspec.package.metadata.version - - $dllPath = Get-ChildItem -Path $unzipPath -Recurse -Filter *.dll | Select-Object -First 1 - Write-Verbose ("Found Dll: " + $dllPath.FullName) - $dllVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dllPath.FullName).FileVersion - - return [PackageInfo]::new($name, $nuspecVersion, $dllVersion) -} - -function Get-ReleaseMetaData ([string]$artifactsPath, [string]$sourcePath) { - $object = [ReleaseInfo]::new() - $object.CommitId = Get-GitChangeset - $object.Packages = $() - - Get-ChildItem -Path $artifactsPath -Recurse -Filter *.nupkg -Exclude *.symbols.nupkg | - ForEach-Object { $object.Packages += Get-PackageInfoFromNupkg $_.FullName } - - $object.NuspecVersion = $object.Packages[0].NuspecVersion - $object.ReleaseName = Get-NuspecVersionName($object.Packages[0].NuspecVersion) - $object.ReleaseVersion = $object.Packages[0].DllVersion - - $object.FormattedReleaseName = "$($object.ReleaseName) ($($object.ReleaseVersion))" - - $object.IsPreRelease = [bool]($object.ReleaseName -like "*beta*") - - $object.ChangeLog = Get-ChangelogText $sourcePath $object.ReleaseName - return $object -} - -Function Get-ChangelogText ([string]$sourcePath, [string]$versionName) { - $sb = [System.Text.StringBuilder]::new() - $saveLines = $false - $readFile = $true - - $changelogPath = Get-ChildItem -Path $sourcePath -Recurse -Filter changelog.md | Select-Object -First 1 - Write-Verbose "Changelog Found: $changelogPath" - Get-Content -Path $changelogPath.FullName | ForEach-Object { - - if($readFile) { - - if($saveLines) { - if($_ -like "##*") { - Write-Verbose "STOP at $_" - $readFile = $false - } - - if($readFile) { - [void]$sb.AppendLine($_) - } - } else { - if(($_ -like "##*") -and ($_ -match $versionName)) { - $saveLines = $true - Write-Verbose "START at $_" - } - } - } - - } - return $sb.ToString() -} - -Function Save-ToXml([string]$outPath, [ReleaseInfo]$object) { - $outFilePath = Join-Path $outPath "releaseMetaData.xml" - $xmlWriter = [System.XMl.XmlTextWriter]::new($outFilePath, $Null) - $xmlWriter.Formatting = "Indented" - $xmlWriter.Indentation = 1 - $XmlWriter.IndentChar = "`t" - - # write the header - $xmlWriter.WriteStartDocument() - - # create root node: - $xmlWriter.WriteStartElement("MetaData") - - $XmlWriter.WriteElementString("ReleaseName", $object.ReleaseName) - $XmlWriter.WriteElementString("ReleaseVersion", $object.ReleaseVersion) - $XmlWriter.WriteElementString("FormattedReleaseName", $object.FormattedReleaseName) - $XmlWriter.WriteElementString("NuspecVersion", $object.NuspecVersion) - $XmlWriter.WriteElementString("IsPreRelease", $object.IsPreRelease) - $XmlWriter.WriteElementString("CommitId", $object.CommitId) - - $XmlWriter.WriteElementString("ChangeLog", $object.ChangeLog) - - $XmlWriter.WriteStartElement("Packages") - $object.Packages | ForEach-Object { - $XmlWriter.WriteStartElement("Package") - $XmlWriter.WriteElementString("Name", $_.Name) - $XmlWriter.WriteElementString("NuspecVersion", $_.NuspecVersion) - $XmlWriter.WriteElementString("DllVersion", $_.DllVersion) - $XmlWriter.WriteElementString("MyGetUri", $_.MyGetUri) - $XmlWriter.WriteEndElement() - } - $XmlWriter.WriteEndElement() - - # close the root node: - $xmlWriter.WriteEndElement() - - # finalize the document: - $xmlWriter.WriteEndDocument() - $xmlWriter.Flush() - $xmlWriter.Close() -} - -# 1) GET META DATA FROM ARTIFACTS -$metaData = Get-ReleaseMetaData $artifactsPath $sourcePath -Write-Output $metaData -$metaData.Packages | ForEach-Object { Write-Output $_ } - -# 2) SAVE -Save-ToXml $outPath $metaData \ No newline at end of file diff --git a/WEB/Microsoft-Security-Recommended.ruleset b/WEB/Microsoft-Security-Recommended.ruleset deleted file mode 100644 index 8af932e91..000000000 --- a/WEB/Microsoft-Security-Recommended.ruleset +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/WEB/NetCore.props b/WEB/NetCore.props index e2e9bde4b..5a3797d7e 100644 --- a/WEB/NetCore.props +++ b/WEB/NetCore.props @@ -7,7 +7,7 @@ false True False - $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'ApplicationInsightsSDKRules.ruleset'))\ApplicationInsightsSDKRules.ruleset + $(RulesetsRoot)\ApplicationInsightsSDKRules.ruleset true diff --git a/WEB/SDL/BinSkimSetup.ps1 b/WEB/SDL/BinSkimSetup.ps1 deleted file mode 100644 index 6ebc3cd0f..000000000 --- a/WEB/SDL/BinSkimSetup.ps1 +++ /dev/null @@ -1,53 +0,0 @@ -[CmdletBinding()] -Param( - # C:\Repos\bin\Debug\Src - [string]$buildDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "bin\Debug\Src") , - - # C:\Repos\binSkim - [string]$binSkimDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "binSkim") -) - -# these are dlls that end up in the bin, but do not belong to us and don't need to be scanned. -$excludedFiles = @("Microsoft.Web.Infrastructure.dll") - -Write-Host "`nPARAMETERS:"; -Write-Host "`tbuildDirectory:" $buildDirectory; -Write-Host "`tbinSkimDirectory:" $binSkimDirectory; - -# don't need to clean folder on build server, but is needed for local dev -Write-Host "`nCreate BinSkim Directory..."; -if (Test-Path $binSkimDirectory) { Remove-Item $binSkimDirectory -Recurse; } - -# copy all -Write-Host "`nCopy all files..."; -Copy-Item -Path $buildDirectory -Filter "*.dll" -Destination $binSkimDirectory -Recurse; - -# delete test directories -Write-Host "`nDelete any 'Test' directories..."; -Get-ChildItem -Path $binSkimDirectory -Recurse -Directory | - Where-Object {$_ -match "Test"} | - Remove-Item -Recurse; - -# delete excluded files -if ($excludedFiles.Count -gt 0) { - Write-Host "`nDelete excluded files..."; - Get-ChildItem -Path $binSkimDirectory -Recurse -File | - ForEach-Object { - if ($excludedFiles.Contains($_.Name)) { - Write-Host "Excluded File:" $_.FullName; - Remove-Item $_.FullName; - } - } -} - -# summary for log output (file list and count) -Write-Host "`nCopied Files:"; - -$count = 0; -Get-ChildItem -Path $binSkimDirectory -Recurse -File | - ForEach-Object { - Write-Host "`t"$_.FullName; - $count++; - } - -Write-Host "`nTOTAL FILES:" $count; \ No newline at end of file diff --git a/WEB/SDL/FxCopSetup.ps1 b/WEB/SDL/FxCopSetup.ps1 deleted file mode 100644 index c48a62f87..000000000 --- a/WEB/SDL/FxCopSetup.ps1 +++ /dev/null @@ -1,99 +0,0 @@ -[CmdletBinding()] -Param( - # C:\Repos\bin\Debug\Src - [string]$buildDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "bin\Debug") , - - # C:\Repos\fxCop - [string]$fxCopDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "fxCop") -) - -function IsFileDependency { - [CmdletBinding()] - param - ( - $file - ) - $dependencyFiles | ForEach-Object { - if($file.Name -eq $_) { - return $true; - } - } - - return $false; - } - -# these are dlls that end up in the bin, but do not belong to us and don't need to be scanned. -$excludedFiles = @( - "Microsoft.ApplicationInsights.TestFramework.Net45.dll", - "Microsoft.ApplicationInsights.TestFramework.Net45.pdb"); -$dependencyFiles = @( - "Microsoft.AI.Agent.Intercept.dll", - "Microsoft.ApplicationInsights.dll", - "Microsoft.AspNet.TelemetryCorrelation.dll", - "Microsoft.Web.Infrastructure.dll", - "System.Diagnostics.DiagnosticSource.dll"); - -Write-Host "`nPARAMETERS:"; -Write-Host "`tbuildDirectory:" $buildDirectory; -Write-Host "`tfxCopDirectory:" $fxCopDirectory; - -$fxCopTargetDir = Join-Path -Path $fxCopDirectory -ChildPath "target"; -$fxCopDependenciesDir = Join-Path -Path $fxCopDirectory -ChildPath "dependencies"; - - -$frameworks = @("net45", "net46", "netstandard1.6"); - -# don't need to clean folder on build server, but is needed for local dev -Write-Host "`nCreate FxCop Directory..."; -if (Test-Path $fxCopDirectory) { Remove-Item $fxCopDirectory -Recurse; } - -# copy all -Write-Host "`nCopy all files (excluding 'Test' directories)..."; -Get-ChildItem -Path $buildDirectory -Recurse -File -Include *.dll, *.pdb | - ForEach-Object { - $file = $_; - - # exclude test files - if ($file.Directory -match "Test") { - return; - } - - #find matching framework - $frameworks | ForEach-Object { - if($file.Directory -match $_) { - $framework = $_; - - #is this file a dependency - if (IsFileDependency($file)) { - Copy-Item $file.FullName -Destination (New-Item (Join-Path -Path $fxCopDependenciesDir -ChildPath $framework) -Type container -Force) -Force; - } else { - Copy-Item $file.FullName -Destination (New-Item (Join-Path -Path $fxCopTargetDir -ChildPath $framework) -Type container -Force) -Force; - } - } - } - } - -# delete excluded files -if ($excludedFiles.Count -gt 0) { - Write-Host "`nDelete excluded files..."; - Get-ChildItem -Path $fxCopDirectory -Recurse -File | - ForEach-Object { - if ($excludedFiles.Contains($_.Name)) { - Write-Host "Excluded File:" $_.FullName; - Remove-Item $_.FullName; - } - } -} - -# summary for log output (file list and count) -Write-Host "`nCopied Files:"; - -$count = 0; -Get-ChildItem -Path $fxCopDirectory -Recurse -File | - ForEach-Object { - Write-Host "`t"$_.FullName; - $count++; - } - -Write-Host "`nTOTAL FILES:" $count; - diff --git a/WEB/Src/PerformanceCollector/Xdt.Tests/Xdt.Tests.csproj b/WEB/Src/PerformanceCollector/Xdt.Tests/Xdt.Tests.csproj index 49c506dc1..d6041d891 100644 --- a/WEB/Src/PerformanceCollector/Xdt.Tests/Xdt.Tests.csproj +++ b/WEB/Src/PerformanceCollector/Xdt.Tests/Xdt.Tests.csproj @@ -35,7 +35,6 @@ TRACE prompt 4 - ..\..\..\ApplicationInsightsSDKRules.ruleset true diff --git a/WEB/disablestrongnamevalidation.ps1 b/WEB/disablestrongnamevalidation.ps1 deleted file mode 100644 index 6d8f5668a..000000000 --- a/WEB/disablestrongnamevalidation.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64\sn.exe" -Vr *,31bf3856ad364e35 -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\sn.exe" -Vr *,31bf3856ad364e35 -# running both the above as a hack which is known to work. Its not clear why both are needed. diff --git a/WEB/enablestrongnamevalidation.ps1 b/WEB/enablestrongnamevalidation.ps1 deleted file mode 100644 index 456ca45ee..000000000 --- a/WEB/enablestrongnamevalidation.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64\sn.exe" -Vu *,31bf3856ad364e35 -& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\sn.exe" -Vu *,31bf3856ad364e35 -# running both the above as a hack which is known to work. Its not clear why both are needed. \ No newline at end of file diff --git a/WEB/upgradeVersion.ps1 b/WEB/upgradeVersion.ps1 deleted file mode 100644 index 484fb7ef2..000000000 --- a/WEB/upgradeVersion.ps1 +++ /dev/null @@ -1,43 +0,0 @@ -$directory = $PSScriptRoot; -Write-Host "Scanning $directory"; - - -$oldVersion = "2.12.0-beta1-build4530" -Write-Host "Old Version: $oldVersion"; - -##Use this to get the new version from MyGet## -#$newVersion = .\NuGet.exe list "Microsoft.ApplicationInsights" -Source https://www.myget.org/F/applicationinsights -Pre -NonInteractive | Select-String -Pattern "Microsoft.ApplicationInsights " | %{$_.Line.Split(" ")} | Select -skip 1 - -##Use this to manually set the new version## -$newVersion = "2.12.0-beta1" # this is package version, 2.10.0-beta4 for beta, 2.10.0 for stable -Write-Host "New Version: $newVersion"; - -$oldAssemblyVersion = "2.11.0.0" -$newAssemblyVersion = "2.12.0.0" # this is assembly version 2.10.0-beta4 for beta, 2.10.0.0 for stable -Write-Host "Old Asembly Version: $oldAssemblyVersion"; -Write-Host "New Asembly Version: $newAssemblyVersion"; - - -function Replace ([string] $Filter, [string] $Old, [string] $New) { - Write-Host ""; - Write-Host "FILTER: $($Filter) REPLACE: $($Old) with $($New)"; - - Get-ChildItem -Path $directory -Filter $Filter -Recurse | - foreach-object { - Write-Host " - $($_.FullName)"; - (Get-Content $_.FullName) | Foreach-Object { $_ -replace $Old, $New; } | Set-Content $_.FullName - } -} - -# -Replace -Filter "packages.config" -Old $oldVersion -New $newVersion; - -# -Replace -Filter "*proj" -Old "Version=$oldAssemblyVersion" -New "Version=$newAssemblyVersion"; - -# ..\..\..\..\packages\Microsoft.ApplicationInsights.2.11.0\lib\net45\Microsoft.ApplicationInsights.dll -# -Replace -Filter "*proj" -Old $oldVersion -New $newVersion; - - -Replace -Filter "*.props" -Old $oldVersion -New $newVersion;