* use a common props file for the version

* remove dirs.proj no longer in use.

* remove extra nupkg.props

* new NupkgAudit script

* update web dirs.proj

* update gitignore

* update script

* fix icon url bug

* cleanup

* fix for netcore projects

* testing file version

* clreanup version

* fix versioning across all projects

* remove unused props and targets

* cleanup

* fix for failing test
This commit is contained in:
Timothy Mothra 2019-11-11 14:44:42 -08:00 коммит произвёл GitHub
Родитель 8dc1ef43f2
Коммит abfb7c1540
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
40 изменённых файлов: 363 добавлений и 795 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -183,4 +183,5 @@ PublishProfiles/
bower_components/
node_modules/
**/wwwroot/lib
/Msbuild.*
/Msbuild.*
**/Nuget.exe

Двоичные данные
.images/icon.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Просмотреть файл

@ -11,28 +11,46 @@
Update for every public release.
-->
<SemanticVersionMajor>2</SemanticVersionMajor>
<SemanticVersionMinor>12</SemanticVersionMinor>
<SemanticVersionMinor>12</SemanticVersionMinor> <!-- If changing the Minor version, also update the Date value. -->
<SemanticVersionPatch>0</SemanticVersionPatch>
<!--Valid values: beta1, beta2, EMPTY for stable -->
<PreReleaseMilestone>beta1</PreReleaseMilestone>
<PreReleaseMilestone>beta2</PreReleaseMilestone> <!--Valid values: beta1, beta2, EMPTY for stable -->
<!--
Date when Semantic Version was changed.
Update for every public release.
Update for every MINOR release.
NOTE!!!!!! Do not update when updating PreReleaseMilestone update
as it will restart file versions so 2.4.0-beta1 may have higher
file version (like 2.4.0.2222) than 2.4.0-beta2 (like 2.4.0.1111)
-->
<SemanticVersionDate>2019-09-23</SemanticVersionDate>
<!--
Pre-release version is used to distinguish internally built NuGet packages.
Pre-release version = Minutes since semantic version was set, divided by 5 (to make it fit in a UInt16 (max 65535 = ~7 months).
-->
<PreReleaseVersion Condition="'$(PreReleaseVersion)'==''">$([MSBuild]::Divide($([System.DateTime]::Now.Subtract($([System.DateTime]::Parse($(SemanticVersionDate)))).TotalMinutes), 5).ToString('F0'))</PreReleaseVersion>
<BuildNumber>$([MSBuild]::Divide($([System.DateTime]::Now.Subtract($([System.DateTime]::Parse($(SemanticVersionDate)))).TotalMinutes), 5).ToString('F0'))</BuildNumber>
<VersionPrefix>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch)</VersionPrefix>
<VersionSuffix>$(PreReleaseMilestone)</VersionSuffix>
<AssemblyVersion>$(VersionPrefix).$(BuildNumber)</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(PackageVersion)'==''">
<PackageVersion>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch)</PackageVersion>
<PackageVersion>$(VersionPrefix)</PackageVersion>
<PackageVersion Condition="'$(PreReleaseMilestone)' != ''">$(PackageVersion)-$(PreReleaseMilestone)</PackageVersion>
<PackageVersion Condition="'$(StableRelease)' != 'True'">$(PackageVersion)-build$(PreReleaseVersion)</PackageVersion>
<PackageVersion Condition="'$(StableRelease)' != 'True'">$(PackageVersion)-build$(BuildNumber)</PackageVersion>
</PropertyGroup>
<ItemGroup>
<!--
AssemblyVersion and AssemblyFileVersion attributes are generated automatically for every build.
NuGet package version is derived from AssemblyFileVersion.
-->
<AssemblyAttributes Include="AssemblyVersion">
<_Parameter1>$(AssemblyVersion)</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyFileVersion">
<_Parameter1>$(FileVersion)</_Parameter1>
</AssemblyAttributes>
</ItemGroup>
</Project>

Просмотреть файл

@ -24,7 +24,7 @@
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://go.microsoft.com/fwlink/?LinkId=392727</PackageProjectUrl>
<PackageIconUrl>http://appanacdn.blob.core.windows.net/cdn/icons/aic.png</PackageIconUrl>
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>https://github.com/Microsoft/ApplicationInsights-dotnet</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageType>Dependency</PackageType>
@ -34,6 +34,10 @@
<PackageTags>Analytics Azure ApplicationInsights Telemetry Monitoring SDK</PackageTags>
</PropertyGroup>
<ItemGroup>
<None Include="$(EnlistmentRoot)\.images\icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>
<PropertyGroup>
<!-- These Properties are unique to the project and must be set in the csproj -->
<PackageId>UNDEFINED</PackageId>

Просмотреть файл

@ -4,12 +4,23 @@
# Authoring Requirements: https://microsoft.sharepoint.com/teams/NuGet/MicrosoftWiki/AuthoringRequirements.aspx
# Signing Requirements: https://microsoft.sharepoint.com/teams/NuGet/MicrosoftWiki/SigningMicrosoftPackages.aspx
Param(
[Parameter(Mandatory=$true,HelpMessage="Path to Artifact files (nupkg):")]
[Parameter(Mandatory=$true,HelpMessage="Path to Nupkg files:")]
[string]
$path,
[Parameter(Mandatory=$true,HelpMessage="Full Log?:")] #Include Pass with Fail output?
$nupkgPath,
[Parameter(Mandatory=$true,HelpMessage="Path to working directory:")]
[string]
$workingDir,
[Parameter(Mandatory=$true,HelpMessage="Full Log?:")] #Include Pass messages with output?
[bool]
$verboseLog
$verboseLog,
[Parameter(Mandatory=$false,HelpMessage="Full Log?:")]
[bool]
$verifySigning = $true
)
@ -19,22 +30,23 @@ $expectedLicense = "MIT"; # MIT License SPDX ID
$expectedOwner = "AppInsightsSdk"; # Application Insights Nuget Account
$expectedTags = @("Azure","Monitoring");
$nugetExePath = "$PSScriptRoot\Nuget.exe";
$sb = [System.Text.StringBuilder]::new();
$script:isValid = $true;
# Get the latest Nuget.exe from here:
if (!(Test-Path ".\Nuget.exe")) {
if (!(Test-Path $nugetExePath)) {
Write-Host "Nuget.exe not found. Attempting download...";
Write-Host "Start time:" (Get-Date -Format G);
$downloadNugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe";
$saveFile = "$PSScriptRoot\Nuget.exe";
(New-Object System.Net.WebClient).DownloadFile($downloadNugetUrl, $saveFile);
(New-Object System.Net.WebClient).DownloadFile($downloadNugetUrl, $nugetExePath);
Write-Host "Finish time:" (Get-Date -Format G);
if (!(Test-Path ".\Nuget.exe")) {
if (!(Test-Path $nugetExePath)) {
throw "Error: Nuget.exe not found! Please download latest from: https://www.nuget.org/downloads";
}
}
@ -95,7 +107,7 @@ function Test-MultiCondition ([bool]$requiredCondition, [bool]$recommendedCondit
function Get-IsPackageSigned([string]$nupkgPath) {
$verifyOutput = "";
$null = .\Nuget.exe verify -signature -CertificateFingerprint 3F9001EA83C560D712C24CF213C3D312CB3BFF51EE89435D3430BD06B5D0EECE $nupkgPath -verbosity detailed 2>&1 | Tee-Object -Variable verifyOutput
$null = & $nugetExePath verify -signature -CertificateFingerprint 3F9001EA83C560D712C24CF213C3D312CB3BFF51EE89435D3430BD06B5D0EECE $nupkgPath -verbosity detailed 2>&1 | Tee-Object -Variable verifyOutput
#TEST OUTPUT
Write-Host $verifyOutput
@ -137,6 +149,16 @@ function Get-DoesXmlDocExist ([string]$dllPath) {
Test-Condition (Test-Path $docFile) $message $requirement;
}
function Get-DoesDllVersionsMatch ([string]$dllPath) {
# CONFIRM Assembly version matches File version
[string]$fileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dllPath).FileVersion;
[string]$assemblyVersion = [Reflection.AssemblyName]::GetAssemblyName($dllPath).Version;
$message = "File Version: '$fileVersion' Assembly Version: '$assemblyVersion";
$requirement = "Versions should match."
Test-Condition ($fileVersion.Equals($assemblyVersion)) $message $requirement;
}
function Get-IsValidPackageId([xml]$nuspecXml) {
$id = $nuspecXml.package.metadata.id;
@ -233,35 +255,23 @@ function Get-IsValidTags([xml]$nuspecXml) {
}
}
function Get-IsValidLogoUrl([xml]$nuspecXml, $path) {
$logoUrl = $nuspecXml.package.metadata.iconUrl;
$isEmpty = [System.String]::IsNullOrEmpty($logoUrl);
$dimension = "";
function Get-IsValidLogo([xml]$nuspecXml, $path) {
$logoValue = $nuspecXml.package.metadata.icon;
$hasLogo = !([System.String]::IsNullOrEmpty($logoValue));
try {
$filePath = Join-Path $path "logo.png";
$wc = New-Object System.Net.WebClient;
$wc.DownloadFile($logoUrl, $filePath);
add-type -AssemblyName System.Drawing
$png = New-Object System.Drawing.Bitmap $filePath
$dimension = "$($png.Height)x$($png.Width)";
# Release lock on png file
Remove-Variable png;
Remove-Variable wc;
$filePath = Join-Path $path $logoValue;
$exists = [System.IO.File]::Exists($filePath)
} catch [System.SystemException] {
$_.Exception.Message;
}
[string[]]$expectedDimensions = ("32x32","48x48","64x64","128x128");
$message = "Logo Url: $logoUrl Dimensions: $dimension";
$message1 = "Logo: $logoValue";
$message2 = "Logo Exists: $exists";
$requirement = "Must have a logo."
$recommendation = "Should be one of these sizes: $expectedDimensions";
$isExpected = ($expectedDimensions -contains $dimension);
Test-MultiCondition (!$isEmpty) ($isExpected) $message $requirement $recommendation;
Test-Condition ($hasLogo) $message1 $requirement;
Test-Condition ($exists) $message2 $requirement;
}
function Invoke-UnZip([string]$zipfile, [string]$outpath) {
@ -273,10 +283,12 @@ function Invoke-UnZip([string]$zipfile, [string]$outpath) {
function Start-EvaluateNupkg ($nupkgPath) {
Write-Break;
Write-Host "Evaluate nupkg:"
Write-Name $nupkgPath;
Get-IsPackageSigned $nupkgPath;
if ($verifySigning){
Get-IsPackageSigned $nupkgPath;
}
$unzipPath = $nupkgPath+"_unzip";
Remove-Item $unzipPath -Recurse -ErrorAction Ignore
@ -284,6 +296,7 @@ function Start-EvaluateNupkg ($nupkgPath) {
# LOOK FOR ALL NUSPEC WITHIN NUPKG
Get-ChildItem -Path $unzipPath -Recurse -Filter *.nuspec | ForEach-Object {
Write-Host "Evaluate nuspec:"
Write-Name $_.FullName;
[xml]$nuspecXml = Get-Content $_.FullName
Get-IsValidPackageId $nuspecXml;
@ -293,25 +306,55 @@ function Start-EvaluateNupkg ($nupkgPath) {
Get-IsValidLicense $nuspecXml;
Get-IsValidLicenseAcceptance $nuspecXml;
Get-IsValidCopyright $nuspecXml;
Get-IsValidLogoUrl $nuspecXml $unzipPath;
Get-IsValidLogo $nuspecXml $unzipPath;
Get-IsValidDescription $nuspecXml;
Get-IsValidTags $nuspecXml;
}
# LOOK FOR ALL DLL WITHIN NUPKG
Get-ChildItem -Path $unzipPath -Recurse -Filter *.dll | ForEach-Object {
Write-Host "Evaluate dll:"
Write-Name $_.FullName;
Get-IsDllSigned $_.FullName;
if ($verifySigning) {
Get-IsDllSigned $_.FullName;
}
Get-DoesDllVersionsMatch $_.FullName;
Get-DoesXmlDocExist $_.FullName;
}
}
# LOOK FOR ALL NUPKG IN A DIRECTORY.
Get-ChildItem -Path $path -Recurse -Filter *.nupkg -Exclude *.symbols.nupkg |
############################
# MAIN EXECUTION STARTS HERE
############################
# CLEAR WORKING DIRECTORY
Remove-Item $workingDir -Recurse -ErrorAction Ignore
New-Item -ItemType directory -Path $workingDir
# FIND ALL NUPKG AND COPY TO WORKING DIRECTORY
Get-ChildItem -Path $nupkgPath -Recurse -Filter *.nupkg -Exclude *.symbols.nupkg -File |
Copy-Item -Destination $workingDir
# LIST ALL FILES IN WORKING DIRECTORY
Write-Host "NUPKGS to audit:"
$files = Get-ChildItem -Path $workingDir -Recurse -File;
$files | ForEach-Object { Write-Host "`t"$_.FullName };
Write-Host "`nCount:" $files.Count;
# RUN AUDIT
Get-ChildItem -Path $workingDir -Recurse -File -Include *.nupkg |
ForEach-Object { Start-EvaluateNupkg $_.FullName }
$sb.ToString() | Add-Content (Join-Path $path "log.txt");
# LOG
$logPath = (Join-Path $workingDir "log.txt")
$sb.ToString() | Add-Content $logPath;
Write-Host "`nLog file created at $logPath"
# RESULT
if (!$script:isValid){
throw "NUPKG or DLL is not valid. Please review log...";
Write-Host "`n"
throw "NUPKG or DLL is not valid. Please review log...";
}

Просмотреть файл

@ -4,7 +4,6 @@
<!-- It defines common build paths and infrastructure. -->
<!-- Other products / repositories using the same build pattern will have their own copy of copy this file -->
<Import Project=".\GlobalStaticVersion.props" />
<PropertyGroup>
<!-- The common project structure looks like this: -->
@ -44,7 +43,14 @@
<EnlistmentRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'EnlistmentRoot.marker'))</EnlistmentRoot>
<SourceRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'SourceRoot.marker'))</SourceRoot>
<BinRoot>$(EnlistmentRoot)\..\bin</BinRoot>
<KeysRoot>$(EnlistmentRoot)\.keys</KeysRoot>
<PropsRoot>$(EnlistmentRoot)\.props</PropsRoot>
<RulesetsRoot>$(EnlistmentRoot)\.rulesets</RulesetsRoot>
<TargetsRoot>$(EnlistmentRoot)\.targets</TargetsRoot>
<BinRoot>$(EnlistmentRoot)\..\bin</BinRoot>
<BinRoot>$([System.IO.Path]::GetFullPath( $(BinRoot) ))</BinRoot>
<RelativeOutputPathBase>$(MSBuildProjectDirectory.Substring($(SourceRoot.Length)))</RelativeOutputPathBase>
@ -76,6 +82,9 @@
<EtwManifestOutDir>$(BinRoot)\$(Configuration)\ETW\$(TargetFramework)\</EtwManifestOutDir>
</PropertyGroup>
<Import Project="$(PropsRoot)\_GlobalStaticVersion.props" />
<PropertyGroup>
<!-- Enable NuGet package restore during build -->
<RestorePackages>true</RestorePackages>
@ -88,16 +97,5 @@
<AssemblyAttributesPath>$(IntermediateOutputPath)\AssemblyInfo.g.cs</AssemblyAttributesPath>
<GenerateAdditionalSources>true</GenerateAdditionalSources>
</PropertyGroup>
<ItemGroup>
<!--
AssemblyVersion and AssemblyFileVersion attributes are generated automatically for every build.
NuGet package version is derived from AssemblyFileVersion.
-->
<AssemblyAttributes Include="AssemblyVersion">
<_Parameter1>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch).0</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyFileVersion">
<_Parameter1>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch).$(PreReleaseVersion)</_Parameter1>
</AssemblyAttributes>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--
Semantic Version. See http://semver.org for full details.
Update for every public release.
-->
<SemanticVersionMajor>2</SemanticVersionMajor>
<SemanticVersionMinor>12</SemanticVersionMinor>
<SemanticVersionPatch>0</SemanticVersionPatch>
<!--Valid values: beta1, beta2, EMPTY for stable -->
<PreReleaseMilestone>beta1</PreReleaseMilestone>
<!--
Date when Semantic Version was changed.
Update for every public release.
NOTE!!!!!! Do not update when updating PreReleaseMilestone update
as it will restart file versions so 2.4.0-beta1 may have higher
file version (like 2.4.0.2222) than 2.4.0-beta2 (like 2.4.0.1111)
-->
<SemanticVersionDate>2019-09-23</SemanticVersionDate>
<!--
Pre-release version is used to distinguish internally built NuGet packages.
Pre-release version = Minutes since semantic version was set, divided by 5 (to make it fit in a UInt16 (max 65535 = ~7 months).
-->
<PreReleaseVersion Condition="'$(PreReleaseVersion)'==''">$([MSBuild]::Divide($([System.DateTime]::Now.Subtract($([System.DateTime]::Parse($(SemanticVersionDate)))).TotalMinutes), 5).ToString('F0'))</PreReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(PackageVersion)'==''">
<PackageVersion>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch)</PackageVersion>
<PackageVersion Condition="'$(PreReleaseMilestone)' != ''">$(PackageVersion)-$(PreReleaseMilestone)</PackageVersion>
<PackageVersion Condition="'$(StableRelease)' != 'True'">$(PackageVersion)-build$(PreReleaseVersion)</PackageVersion>
</PropertyGroup>
</Project>

Просмотреть файл

@ -19,10 +19,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solutio
Common.props = Common.props
Common.targets = Common.targets
Directory.Build.props = Directory.Build.props
dirs.proj = dirs.proj
GlobalStaticVersion.props = GlobalStaticVersion.props
NuGet.config = NuGet.config
Nupkg.props = Nupkg.props
Package.targets = Package.targets
README.md = README.md
Signing.props = Signing.props

Просмотреть файл

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="$(OS) == 'Windows_NT'">
<!-- Including this file will generate both the *.nupkg and *.symbols.nupkg -->
<!--https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg-->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup>
<!-- These are the common properties used when generating the nupkg -->
<!-- https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets -->
<Company>Microsoft</Company>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<!-- <PackageVersion>Defined in GlobalStaticVersion.props</PackageVersion> -->
<Authors>Microsoft</Authors>
<Owners>Microsoft,AppInsightsSdk</Owners>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://go.microsoft.com/fwlink/?LinkId=392727</PackageProjectUrl>
<PackageIconUrl>http://appanacdn.blob.core.windows.net/cdn/icons/aic.png</PackageIconUrl>
<RepositoryUrl>https://github.com/Microsoft/ApplicationInsights-dotnet</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageType>Dependency</PackageType>
<ContentTargetFolders>content</ContentTargetFolders>
<PackageReleaseNotes>For the release notes please follow http://go.microsoft.com/fwlink/?LinkId=535037</PackageReleaseNotes>
<!-- <PackageOutputPath>Defined in Directory.Build.props</PackageOutputPath> -->
<PackageTags>Analytics Azure ApplicationInsights Telemetry Monitoring SDK</PackageTags>
</PropertyGroup>
<PropertyGroup>
<!-- These Properties are unique to the project and must be set in the csproj -->
<PackageId>UNDEFINED</PackageId>
<Title>UNDEFINED</Title>
<Description>UNDEFINED</Description>
<!-- <PackageTags>$(PackageTags) newTag1 newTag2</PackageTags> -->
</PropertyGroup>
<PropertyGroup>
<!-- Disable auto generation of package attributes. This resolves the 'Duplicate attribute' error.
Common cause is a hidden AssemblyInfo.cs file in a project -->
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project=".\GlobalStaticVersion.props" />
<ItemGroup>
<Solution Include="Microsoft.ApplicationInsights.sln" />
</ItemGroup>
<Target Name="Build">
<Exec Command='IF EXIST "%(Solution.FullPath)" nuget.exe restore "%(Solution.FullPath)" -NonInteractive' ContinueOnError="ErrorAndStop"/>
<MSBuild Projects="@(Solution)" Targets="Restore;Build" ContinueOnError="ErrorAndStop" Properties="PreReleaseVersion=$(PreReleaseVersion)"/>
</Target>
<Target Name="Clean">
<RemoveDir Directories="$(BinRoot)\$(Configuration)" />
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
</Target>
</Project>

Просмотреть файл

@ -1,6 +1,6 @@
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />
<Import Project="..\..\Nupkg.props" />
<Import Project="$(PropsRoot)\_Nupkg.props" />
<PropertyGroup>
<TargetFrameworks>net45;net46;netstandard1.3;netstandard2.0</TargetFrameworks>

Просмотреть файл

@ -1,6 +1,6 @@
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />
<Import Project="..\..\Nupkg.props" />
<Import Project="$(PropsRoot)\_Nupkg.props" />
<PropertyGroup>
<TargetFrameworks>net45;netstandard1.3;netstandard2.0</TargetFrameworks>

Просмотреть файл

@ -4,8 +4,6 @@
<!-- It defines common build paths and infrastructure. -->
<!-- Other products / repositories using the same build pattern will have an own copy of copy this file -->
<Import Project=".\GlobalStaticVersion.props" />
<PropertyGroup>
<!-- The common project structure looks like this: -->
<!-- d:\DDGit\ -->
@ -43,8 +41,15 @@
<EnlistmentRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'EnlistmentRoot.marker'))</EnlistmentRoot>
<SourceRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'SourceRoot.marker'))</SourceRoot>
<BinRoot>$(EnlistmentRoot)\..\bin</BinRoot>
<KeysRoot>$(EnlistmentRoot)\.keys</KeysRoot>
<PropsRoot>$(EnlistmentRoot)\.props</PropsRoot>
<RulesetsRoot>$(EnlistmentRoot)\.rulesets</RulesetsRoot>
<TargetsRoot>$(EnlistmentRoot)\.targets</TargetsRoot>
<BinRoot>$(EnlistmentRoot)\..\bin</BinRoot>
<BinRoot>$([System.IO.Path]::GetFullPath( $(BinRoot) ))</BinRoot>
<RelativeOutputPathBase>$(MSBuildProjectDirectory.Substring($(SourceRoot.Length)))</RelativeOutputPathBase>
@ -73,7 +78,10 @@
<PackagesDir>$(EnlistmentRoot)\..\packages</PackagesDir>
<PackagesDir>$([System.IO.Path]::GetFullPath( $(PackagesDir) ))</PackagesDir>
</PropertyGroup>
<Import Project="$(PropsRoot)\_GlobalStaticVersion.props" />
<PropertyGroup>
<!-- Enable NuGet package restore during build -->
<RestorePackages>true</RestorePackages>
@ -90,24 +98,5 @@
<AssemblyAttributesPath>$(IntermediateOutputPath)\AssemblyInfo.g.cs</AssemblyAttributesPath>
<GenerateAdditionalSources>true</GenerateAdditionalSources>
</PropertyGroup>
<ItemGroup>
<!--
AssemblyVersion and AssemblyFileVersion attributes are generated automatically for every build.
NuGet package version is derived from AssemblyFileVersion.
-->
<AssemblyAttributes Include="AssemblyVersion">
<_Parameter1>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch).0</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyFileVersion">
<_Parameter1>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch).$(PreReleaseVersion)</_Parameter1>
</AssemblyAttributes>
</ItemGroup>
<PropertyGroup>
<!-- MSBuild 15 apparently uses slightly different properties for the task of generating assembly/file version. -->
<AssemblyVersion>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch).0</AssemblyVersion>
<FileVersion>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch).$(PreReleaseVersion)</FileVersion>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--
Semantic Version. See http://semver.org for full details.
Update for every public release.
-->
<SemanticVersionMajor>2</SemanticVersionMajor>
<SemanticVersionMinor>12</SemanticVersionMinor>
<SemanticVersionPatch>0</SemanticVersionPatch>
<PreReleaseMilestone>beta1</PreReleaseMilestone>
<!--
Date when Semantic Version was changed.
Update for every public release.
-->
<SemanticVersionDate>2019-09-23</SemanticVersionDate>
<PreReleaseVersionFileName>.PreReleaseVersion</PreReleaseVersionFileName>
<PreReleaseVersionFilePath>$(MSBuildThisFileDirectory)$(PreReleaseVersionFileName)</PreReleaseVersionFilePath>
<!--
Pre-release version is used to distinguish internally built NuGet packages.
Pre-release version = Minutes since semantic version was set, divided by 5 (to make it fit in a UInt16 (max 65535 = ~7 months).
-->
<PreReleaseVersion>$([MSBuild]::Divide($([System.DateTime]::Now.Subtract($([System.DateTime]::Parse($(SemanticVersionDate)))).TotalMinutes), 5).ToString('F0'))</PreReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(PackageVersion)'==''">
<PackageVersion>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch)</PackageVersion>
<PackageVersion Condition="'$(PreReleaseMilestone)' != ''">$(PackageVersion)-$(PreReleaseMilestone)</PackageVersion>
<PackageVersion Condition="'$(StableRelease)' != 'True'">$(PackageVersion)-build$(PreReleaseVersion)</PackageVersion>
</PropertyGroup>
</Project>

Просмотреть файл

@ -18,9 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solutio
Common.props = Common.props
Common.targets = Common.targets
Directory.Build.props = Directory.Build.props
GlobalStaticVersion.props = GlobalStaticVersion.props
NuGet.Config = NuGet.Config
Nupkg.props = Nupkg.props
src\Product.props = src\Product.props
README.md = README.md
Signing.targets = Signing.targets

Просмотреть файл

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="$(OS) == 'Windows_NT'">
<!-- Including this file will generate both the *.nupkg and *.snupkg -->
<!--https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg-->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup>
<!-- These are the common properties used when generating the nupkg -->
<!-- https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets -->
<Company>Microsoft</Company>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<!-- <PackageVersion>Defined in GlobalStaticVersion.props</PackageVersion> -->
<Authors>Microsoft</Authors>
<Owners>Microsoft,AppInsightsSdk</Owners>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://go.microsoft.com/fwlink/?LinkId=392727</PackageProjectUrl>
<PackageIconUrl>http://appanacdn.blob.core.windows.net/cdn/icons/aic.png</PackageIconUrl>
<RepositoryUrl>https://github.com/Microsoft/ApplicationInsights-dotnet-logging</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageType>Dependency</PackageType>
<ContentTargetFolders>content</ContentTargetFolders>
<PackageReleaseNotes>For the release notes please follow http://go.microsoft.com/fwlink/?LinkId=535037</PackageReleaseNotes>
<!-- <PackageOutputPath>Defined in Directory.Build.props</PackageOutputPath> -->
<PackageTags>Azure Monitoring Analytics ApplicationInsights Telemetry</PackageTags>
</PropertyGroup>
<PropertyGroup>
<!-- These Properties are unique to the project and must be set in the csproj -->
<PackageId>UNDEFINED</PackageId>
<Title>UNDEFINED</Title>
<Description>UNDEFINED</Description>
<!-- <PackageTags>$(PackageTags) newTag1 newTag2</PackageTags> -->
</PropertyGroup>
<PropertyGroup>
<!-- Disable auto generation of package attributes. This resolves the 'Duplicate attribute' error.
Common cause is a hidden AssemblyInfo.cs file in a project -->
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project=".\Directory.Build.props" />
<ItemGroup>
<Solution Include="Logging.sln" />
</ItemGroup>
<Target Name="Build">
<!-- Generate build version -->
<WriteLinesToFile File="$(PreReleaseVersionFileName)" Lines="$(PreReleaseVersion)" Overwrite="true" Encoding="Unicode"/>
<Exec Command='IF EXIST "%(Solution.FullPath)" nuget.exe restore "%(Solution.FullPath)" -NonInteractive' ContinueOnError="ErrorAndStop"/>
<MSBuild Projects="@(Solution)" ContinueOnError="ErrorAndStop"/>
</Target>
<Target Name="Clean">
<RemoveDir Directories="$(BinRoot)\$(Configuration)" />
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
</Target>
</Project>

Просмотреть файл

@ -6,8 +6,7 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />
<Import Project="..\..\Nupkg.props" />
<PropertyGroup>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>

Просмотреть файл

@ -6,8 +6,7 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />
<Import Project="..\..\Nupkg.props" />
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunCodeAnalysis>true</RunCodeAnalysis>

Просмотреть файл

@ -6,8 +6,7 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />
<Import Project="..\..\Nupkg.props" />
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunCodeAnalysis>true</RunCodeAnalysis>

Просмотреть файл

@ -6,8 +6,7 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />
<Import Project="..\..\Nupkg.props" />
<PropertyGroup>
<RunCodeAnalysis>false</RunCodeAnalysis>
<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->

Просмотреть файл

@ -6,8 +6,7 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />
<Import Project="..\..\Nupkg.props" />
<PropertyGroup>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>

Просмотреть файл

@ -6,8 +6,7 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />
<Import Project="..\..\Nupkg.props" />
<PropertyGroup>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>

Просмотреть файл

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Common.props'))\Common.props"/>
<Import Project="$(PropsRoot)\_Nupkg.props" />
<PropertyGroup>
<!--Removing the SRC folder from the output directory-->
<CorePath>$(RelativeOutputPathBase)</CorePath>

Просмотреть файл

@ -6,8 +6,7 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />
<Import Project="..\..\Nupkg.props" />
<PropertyGroup>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>

Просмотреть файл

@ -13,10 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solutio
Common.targets = Common.targets
dirs.proj = dirs.proj
NuGet.config = NuGet.config
Nupkg.props = Nupkg.props
Readme.md = Readme.md
RunTestsCore.ps1 = RunTestsCore.ps1
SetEnv.targets = SetEnv.targets
Signing.props = Signing.props
EndProjectSection
EndProject

Просмотреть файл

@ -11,6 +11,13 @@
<!-- SourceRoot is used to reference project dependencies (ex: *.props). -->
<SourceRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'SourceRoot.marker'))</SourceRoot>
<KeysRoot>$(EnlistmentRoot)\.keys</KeysRoot>
<PropsRoot>$(EnlistmentRoot)\.props</PropsRoot>
<RulesetsRoot>$(EnlistmentRoot)\.rulesets</RulesetsRoot>
<TargetsRoot>$(EnlistmentRoot)\.targets</TargetsRoot>
<BinRoot>$(EnlistmentRoot)\..\bin</BinRoot>
<BinRoot>$([System.IO.Path]::GetFullPath( $(BinRoot) ))</BinRoot>
@ -34,4 +41,7 @@
<IntermediateOutputPath>$([System.IO.Path]::GetFullPath( $(IntermediateOutputPath) ))\</IntermediateOutputPath>
</PropertyGroup>
<Import Project="$(PropsRoot)\_GlobalStaticVersion.props" />
</Project>

Просмотреть файл

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="$(OS) == 'Windows_NT'">
<!-- Including this file will generate both the *.nupkg and *.symbols.nupkg -->
<!--https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg-->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup>
<!-- These are the common properties used when generating the nupkg -->
<!-- https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets -->
<Company>Microsoft</Company>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<!-- <PackageVersion>Defined in GlobalStaticVersion.props</PackageVersion> -->
<Authors>Microsoft</Authors>
<Owners>Microsoft,AppInsightsSdk</Owners>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://go.microsoft.com/fwlink/?LinkId=392727</PackageProjectUrl>
<PackageIconUrl>https://appanacdn.blob.core.windows.net/cdn/icons/aic.png</PackageIconUrl>
<RepositoryUrl>https://github.com/Microsoft/applicationinsights-aspnetcore</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageType>Dependency</PackageType>
<ContentTargetFolders>content</ContentTargetFolders>
<PackageReleaseNotes>For the release notes please follow http://go.microsoft.com/fwlink/?LinkId=535037</PackageReleaseNotes>
<!-- <PackageOutputPath>Defined in Directory.Build.props</PackageOutputPath> -->
<PackageTags>Azure;Monitoring;Analytics;ApplicationInsights;Telemetry;AppInsights;</PackageTags>
</PropertyGroup>
<PropertyGroup>
<!-- These Properties are unique to the project and must be set in the csproj -->
<PackageId>UNDEFINED</PackageId>
<Title>UNDEFINED</Title>
<Description>UNDEFINED</Description>
<!-- <PackageTags>$(PackageTags) newTag1 newTag2</PackageTags> -->
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SourceRoot)\Nupkg.props" />
<Import Project="$(PropsRoot)\_Nupkg.props" />
<Import Project="$(SourceRoot)\Signing.props" Condition=" '$(OS)' == 'Windows_NT' " />
<Target Name="Info_ProductProps" BeforeTargets="Build" >
@ -8,7 +8,13 @@
</Target>
<PropertyGroup>
<VersionPrefix>2.12.0-beta1</VersionPrefix>
<!-- Override settings from Nupkg.props. I don't know why the NetCore projects need this and the others don't. -->
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>true</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyDescriptionAttribute>true</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyProductAttribute>true</GenerateAssemblyProductAttribute>
<GenerateAssemblyTitleAttribute>true</GenerateAssemblyTitleAttribute>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--
Date when Semantic Version was changed.
Update for every public release.
-->
<SemanticVersionDate>2016-9-28</SemanticVersionDate>
<!--
Pre-release version is used to distinguish internally built NuGet packages.
Pre-release version = Minutes since semantic version was set, divided by 5 (to make it fit in a UInt16).
-->
<PreReleaseVersion>$([MSBuild]::Divide($([System.DateTime]::Now.Subtract($([System.DateTime]::Parse($(SemanticVersionDate)))).TotalMinutes), 5).ToString('F0'))</PreReleaseVersion>
</PropertyGroup>
<Target Name="SetEnvironmentVariables" Condition="'$(IsOfficialBuild)' != 'True'" BeforeTargets="BeforeBuild">
<!--
Variable DNX_BUILD_VERSION controls the pre-release version of the nuget package that is being generated.
It replaces "*" from the version number present in project.json of all the projects corresponding to this solution.
-->
<SetEnv Name="DNX_BUILD_VERSION" Value="$(PreReleaseVersion)"/>
<Message Importance="high" Text=" SetEnvironmentVariables executed on $(ProjectName)"></Message>
</Target>
<UsingTask TaskName="SetEnv"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<ParameterGroup>
<Name ParameterType="System.String" Required="true" />
<Value ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Environment.SetEnvironmentVariable(Name, Value);
Log.LogMessage (
"Environment varible is set, name={0}, value:{1}",
Name,
Value);
]]>
</Code>
</Task>
</UsingTask>
</Project>

Просмотреть файл

@ -1,216 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Signing.props"/>
<PropertyGroup>
<CliZipFile>$(BUILD_ARTIFACTSTAGINGDIRECTORY)\dotnet-sdk-2.1.4-win-x64.zip</CliZipFile>
<CliToolsPath>$(BUILD_ARTIFACTSTAGINGDIRECTORY)\dotnet-sdk-2.1.4-win-x64.latest</CliToolsPath>
<!-- Library -->
<ProjectToBuild>.\src\Microsoft.ApplicationInsights.AspNetCore\Microsoft.ApplicationInsights.AspNetCore.csproj</ProjectToBuild>
</PropertyGroup>
<ItemGroup>
<!--<Solution Include="src\Microsoft.ApplicationInsights.AspNetCore\Microsoft.ApplicationInsights.AspNetCore.xproj" />-->
<!-- Tests -->
<TestProject Include="test\Microsoft.ApplicationInsights.AspNetCore.Tests\ " />
<TestProject Include="test\WebApi.FunctionalTests\ " />
<TestProject Include="test\WebApi20.FunctionalTests\ " />
<TestProject Include="test\EmptyApp.FunctionalTests\ " />
<TestProject Include="test\EmptyApp20.FunctionalTests\ " />
<TestProject Include="test\MVCFramework.FunctionalTests\ " />
<TestProject Include="test\MVCFramework20.FunctionalTests\ " />
</ItemGroup>
<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<Address ParameterType="System.String" Required="true" />
<FileName ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
new System.Net.WebClient().DownloadFile(Address, FileName);
]]>
</Code>
</Task>
</UsingTask>
<UsingTask TaskName="ExtractZipArchive" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<InputFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<OutputPath ParameterType="System.String" Required="true" />
<ArchiveFileNameAsRootFolder ParameterType="System.Boolean" Required="false" />
<Overwrite ParameterType="System.Boolean" Required="false" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Using Namespace="System.Diagnostics" />
<Using Namespace="System.IO" />
<Using Namespace="System.IO.Compression" />
<Code Type="Fragment" Language="cs">
<![CDATA[
foreach (var inputFilePath in InputFiles.Select(f => f.ItemSpec))
{
using (ZipArchive archive = ZipFile.OpenRead(inputFilePath))
{
string inputFileName = Path.GetFileName(inputFilePath);
if (true == ArchiveFileNameAsRootFolder && true == Overwrite)
{
DirectoryInfo archiveDirectory = new DirectoryInfo(Path.Combine(OutputPath, inputFileName));
if (true == archiveDirectory.Exists)
{
Log.LogMessage ("Archive root folder already exists, deleting path:{0}", archiveDirectory.FullName);
archiveDirectory.Delete(recursive: true);
}
}
foreach (ZipArchiveEntry entry in archive.Entries)
{
string path = ArchiveFileNameAsRootFolder
? Path.Combine(OutputPath, inputFileName, entry.FullName)
: Path.Combine(OutputPath, entry.FullName);
FileInfo fileInfo = new FileInfo(path);
DirectoryInfo directoryInfo = new DirectoryInfo(fileInfo.DirectoryName);
if (false == directoryInfo.Exists)
{
//Log.LogMessage ("Creating directory for archive entry, path:{0}", directoryInfo.FullName);
directoryInfo.Create();
}
//Log.LogMessage("Extracting entry to path:{0}", path);
entry.ExtractToFile(path, Overwrite);
}
}
}
]]>
</Code>
</Task>
</UsingTask>
<UsingTask TaskName="InjectXmlLanguage" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<InputFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Using Namespace="System.Diagnostics" />
<Using Namespace="System.IO" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Log.LogMessage("Called InjectXmlLanguage");
foreach (var inputFilePath in InputFiles.Select(f => f.ItemSpec))
{
Log.LogMessage("Fixing {0}", inputFilePath);
string filePath = inputFilePath;
if (filePath.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
{
filePath = filePath.Substring(0, filePath.Length - 3) + "xml";
}
if (filePath.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
{
string[] files = null;
int starIndex = filePath.IndexOf('*');
if (starIndex >= 0)
{
string dir = filePath.Substring(0, starIndex);
if (string.IsNullOrEmpty(dir))
{
dir = ".";
}
string file = Path.GetFileName(filePath.Substring(starIndex));
files = Directory.GetFiles(dir, file, SearchOption.AllDirectories);
}
else
{
files = new[] { filePath };
}
foreach (string fileName in files)
{
if (File.Exists(fileName))
{
Log.LogMessage("Processing XML: {0}", fileName);
string text = File.ReadAllText(fileName);
text = text.Replace("<doc>", "<doc xml:lang=\"en\">");
File.WriteAllText(fileName, text);
}
}
}
}
]]>
</Code>
</Task>
</UsingTask>
<Target Name="CheckBuildParameters">
<Message Importance="high" Text="ComputerName: $(ComputerName)"></Message>
<Message Importance="high" Text="User: $(USERDOMAIN)\$(USERNAME)"></Message>
<Message Importance="high" Text="RunningInMicroBuild: $(RunningInMicroBuild)"></Message>
<Message Importance="high" Text="Intermediate Output Path: $(BaseIntermediateOutputPath)"></Message>
<Message Importance="high" Text="Bin Root: $(BinRoot)"></Message>
<Message Importance="high" Text="Configuration: $(Configuration)"></Message>
<Message Importance="high" Text="CLI Zip: $(CliZipFile)"></Message>
<Message Importance="high" Text="CLI Tools Path: $(CliToolsPath)"></Message>
<Message Importance="high" Text="Run Tests: $(RunTests)"></Message>
<Message Importance="high" Text="Sign Assembly: $(SignAssembly)"></Message>
</Target>
<Target Name="DownloadCLI">
<!--<DownloadFile Address="https://download.microsoft.com/download/E/7/8/E782433E-7737-4E6C-BFBF-290A0A81C3D7/dotnet-sdk-2.1.4-win-x64.zip" FileName="$(CliZipFile)" />-->
<DownloadFile Address="https://download.microsoft.com/download/1/1/5/115B762D-2B41-4AF3-9A63-92D9680B9409/dotnet-sdk-2.1.4-win-x64.zip" FileName="$(CliZipFile)" />
<ExtractZipArchive InputFiles="$(CliZipFile)" OutputPath="$(CliToolsPath)" ArchiveFileNameAsRootFolder="false" Overwrite="true" />
</Target>
<Target Name="ClearNugetCache">
<Exec Command=".\nuget.exe locals all -clear" ContinueOnError="ErrorAndStop" />
</Target>
<Target Name="Build" DependsOnTargets="CheckBuildParameters;DownloadCLI">
<Exec Command='"$(CliToolsPath)\dotnet.exe" --version' />
<Exec Command='"nuget.exe" restore' ContinueOnError="ErrorAndStop" />
<Exec Command='"$(CliToolsPath)\dotnet.exe" build $(ProjectToBuild) -c $(Configuration)' ContinueOnError="ErrorAndStop" />
<Exec Command='"$(CliToolsPath)\dotnet.exe" build %(TestProject.Identity) -c $(Configuration)' ContinueOnError="ErrorAndStop" />
</Target>
<Target Name="Test" AfterTargets="Build" DependsOnTargets="Build">
<Message Condition="$(RunTests) != '' And $(RunTests)" Importance="high" Text="Running tests..."></Message>
<Exec Condition="$(RunTests) != '' And $(RunTests)" Command='"$(CliToolsPath)\dotnet.exe" test -l trx' WorkingDirectory='%(TestProject.Identity)' ContinueOnError="ErrorAndContinue" />
</Target>
<Target Name="Clean">
<RemoveDir Directories="$(BinRoot)\$(Configuration)" />
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
<RemoveDir Directories="$(BUILD_ARTIFACTSTAGINGDIRECTORY)\dotnet-sdk-2.1.4-win-x64.latest" />
<Delete Files="$(BUILD_ARTIFACTSTAGINGDIRECTORY)\dotnet-sdk-2.1.4-win-x64.zip" />
</Target>
<Target Name="AfterBuild" AfterTargets="Test" DependsOnTargets="Test">
<ItemGroup>
<FilesToSign Include="**\Microsoft.ApplicationInsights.AspNetCore.dll">
<Authenticode Condition="'%(FilesToSign.Authenticode)' == ''">Microsoft</Authenticode>
<StrongName Condition="'%(FilesToSign.StrongName)' == ''">MsSharedLib72</StrongName>
</FilesToSign>
</ItemGroup>
<Message Importance="high" Text="Files to sign:"></Message>
<Message Importance="high" Text="--> File:%(FilesToSign.FileName)%(FilesToSign.Extension)
--> BinariesDirectory:$([System.IO.Path]::GetDirectoryName(%(FilesToSign.FullPath))) --> Authenticode:%(FilesToSign.Authenticode)"></Message>
<ItemGroup>
<DocumentationFiles Include="**\Microsoft.ApplicationInsights.AspNetCore.xml"></DocumentationFiles>
</ItemGroup>
</Target>
<Target Name="FixXmlDocumentation" AfterTargets="AfterBuild" DependsOnTargets="AfterBuild">
<InjectXmlLanguage InputFiles="@(DocumentationFiles)" />
</Target>
<Target Name="PackageNuGet" AfterTargets="SignFiles" DependsOnTargets="AfterBuild;FixXmlDocumentation;SignFiles">
<Exec Command='"$(CliToolsPath)\dotnet.exe" pack $(ProjectToBuild) -c $(Configuration)' ContinueOnError="ErrorAndStop" />
</Target>
</Project>

Просмотреть файл

@ -4,8 +4,6 @@
<!-- It defines common build paths and infrastructure. -->
<!-- Other products / repositories using the same build pattern will have their own copy of copy this file -->
<Import Project=".\GlobalStaticVersion.props" />
<PropertyGroup>
<!-- The common project structure looks like this: -->
<!-- d:\DDGit\ -->
@ -44,7 +42,14 @@
<EnlistmentRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'EnlistmentRoot.marker'))</EnlistmentRoot>
<SourceRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'SourceRoot.marker'))</SourceRoot>
<BinRoot>$(EnlistmentRoot)\..\bin</BinRoot>
<KeysRoot>$(EnlistmentRoot)\.keys</KeysRoot>
<PropsRoot>$(EnlistmentRoot)\.props</PropsRoot>
<RulesetsRoot>$(EnlistmentRoot)\.rulesets</RulesetsRoot>
<TargetsRoot>$(EnlistmentRoot)\.targets</TargetsRoot>
<BinRoot>$(EnlistmentRoot)\..\bin</BinRoot>
<BinRoot>$([System.IO.Path]::GetFullPath( $(BinRoot) ))</BinRoot>
<RelativeOutputPathBase>$(MSBuildProjectDirectory.Substring($(SourceRoot.Length)))</RelativeOutputPathBase>
@ -85,6 +90,9 @@
<EtwManifestOutDir>$(BinRoot)\$(Configuration)\ETW\</EtwManifestOutDir>
</PropertyGroup>
<Import Project="$(PropsRoot)\_GlobalStaticVersion.props" />
<PropertyGroup>
<!-- Enable NuGet package restore during build -->
<RestorePackages>true</RestorePackages>
@ -101,16 +109,5 @@
<AssemblyAttributesPath>$(IntermediateOutputPath)\AssemblyInfo.g.cs</AssemblyAttributesPath>
<GenerateAdditionalSources>true</GenerateAdditionalSources>
</PropertyGroup>
<ItemGroup>
<!--
AssemblyVersion and AssemblyFileVersion attributes are generated automatically for every build.
NuGet package version is derived from AssemblyFileVersion.
-->
<AssemblyAttributes Include="AssemblyVersion">
<_Parameter1>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch).0</_Parameter1>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyFileVersion">
<_Parameter1>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch).$(PreReleaseVersion)</_Parameter1>
</AssemblyAttributes>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--
Semantic Version. See http://semver.org for full details.
Update for every public release.
-->
<SemanticVersionMajor>2</SemanticVersionMajor>
<SemanticVersionMinor>12</SemanticVersionMinor>
<SemanticVersionPatch>0</SemanticVersionPatch>
<!--Valid values: beta1, beta2, EMPTY for stable -->
<PreReleaseMilestone>beta1</PreReleaseMilestone>
<!--
Date when Semantic Version was changed.
Update for every public release.
NOTE!!!!!! Do not update when updating PreReleaseMilestone update
as it will restart file versions so 2.4.0-beta1 may have higher
file version (like 2.4.0.2222) than 2.4.0-beta2 (like 2.4.0.1111)
-->
<SemanticVersionDate>2019-09-23</SemanticVersionDate>
<!--
Pre-release version is used to distinguish internally built NuGet packages.
Pre-release version = Minutes since semantic version was set, divided by 5 (to make it fit in a UInt16 (max 65535 = ~7 months).
-->
<PreReleaseVersion Condition="'$(PreReleaseVersion)'==''">$([MSBuild]::Divide($([System.DateTime]::Now.Subtract($([System.DateTime]::Parse($(SemanticVersionDate)))).TotalMinutes), 5).ToString('F0'))</PreReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(PackageVersion)'==''">
<PackageVersion>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch)</PackageVersion>
<PackageVersion Condition="'$(PreReleaseMilestone)' != ''">$(PackageVersion)-$(PreReleaseMilestone)</PackageVersion>
<PackageVersion Condition="'$(StableRelease)' != 'True'">$(PackageVersion)-build$(PreReleaseVersion)</PackageVersion>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="$(OS) == 'Windows_NT'">
<!-- Including this file will generate both the *.nupkg and *.symbols.nupkg -->
<!--https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg-->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup>
<!-- These are the common properties used when generating the nupkg -->
<!-- https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets -->
<Company>Microsoft</Company>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<!-- <PackageVersion>Defined in GlobalStaticVersion.props</PackageVersion> -->
<Authors>Microsoft</Authors>
<Owners>Microsoft,AppInsightsSdk</Owners>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://go.microsoft.com/fwlink/?LinkId=392727</PackageProjectUrl>
<PackageIconUrl>http://appanacdn.blob.core.windows.net/cdn/icons/aic.png</PackageIconUrl>
<RepositoryUrl>https://github.com/Microsoft/ApplicationInsights-dotnet-server</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageType>Dependency</PackageType>
<ContentTargetFolders>content</ContentTargetFolders>
</PropertyGroup>
<PropertyGroup>
<!-- These Properties are unique to the project and must be set in the csproj -->
<PackageId>UNDEFINED</PackageId>
<Title>UNDEFINED</Title>
<Description>UNDEFINED</Description>
<PackageTags>UNDEFINED</PackageTags>
</PropertyGroup>
<PropertyGroup>
<!-- Disable auto generation of package attributes. This resolves the 'Duplicate attribute' error.
Common cause is a hidden AssemblyInfo.cs file in a project -->
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
</PropertyGroup>
</Project>

Просмотреть файл

@ -29,6 +29,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Implementation\Operation\ObjectInstanceBasedOperationHolderTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Implementation\ServiceBusDiagnosticListenerTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Implementation\EventHubsDiagnosticListenerTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Implementation\SqlClientDiagnosticSourceListenerTestsCopy.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Implementation\SqlClientDiagnosticSourceListenerTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Implementation\TelemetryDiagnosticSourceListenerTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OperationDetailsInitializer.cs" />

Просмотреть файл

@ -328,84 +328,6 @@ namespace Microsoft.ApplicationInsights.Tests
Assert.False(dependencyTelemetry.Success.Value);
}
[Theory]
[InlineData(SqlClientDiagnosticSourceListener.SqlBeforeExecuteCommand, SqlClientDiagnosticSourceListener.SqlErrorExecuteCommand)]
[InlineData(SqlClientDiagnosticSourceListener.SqlMicrosoftBeforeExecuteCommand, SqlClientDiagnosticSourceListener.SqlMicrosoftErrorExecuteCommand)]
public void TracksCommandErrorWhenSqlException(string beforeCommand, string errorCommand)
{
var operationId = Guid.NewGuid();
var sqlConnection = new SqlConnection(TestConnectionString);
var sqlCommand = sqlConnection.CreateCommand();
sqlCommand.CommandText = "select * from orders";
var beforeExecuteEventData = new
{
OperationId = operationId,
Command = sqlCommand,
Timestamp = (long?)1000000L
};
this.fakeSqlClientDiagnosticSource.Write(
beforeCommand,
beforeExecuteEventData);
// Need to create SqlException via reflection because ctor is not public!
var sqlErrorCtor
= typeof(SqlError).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance)
.Single(c => c.GetParameters().Count() == 8);
var sqlError = sqlErrorCtor.Invoke(
new object[]
{
42, // error number
default(byte),
default(byte),
string.Empty,
string.Empty,
string.Empty,
0,
default(Exception)
});
var sqlErrorCollectionCtor
= typeof(SqlErrorCollection).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance)
.Single();
var sqlErrorCollection = sqlErrorCollectionCtor.Invoke(new object[] { });
typeof(SqlErrorCollection).GetMethod("Add", BindingFlags.NonPublic | BindingFlags.Instance)
.Invoke(sqlErrorCollection, new object[] { sqlError });
var sqlExceptionCtor = typeof(SqlException).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance)[0];
var sqlException = (SqlException)sqlExceptionCtor.Invoke(
new object[]
{
"Boom!",
sqlErrorCollection,
null,
Guid.NewGuid()
});
var commandErrorEventData = new
{
OperationId = operationId,
Command = sqlCommand,
Exception = (Exception)sqlException,
Timestamp = 2000000L
};
this.fakeSqlClientDiagnosticSource.Write(
errorCommand,
commandErrorEventData);
var dependencyTelemetry = (DependencyTelemetry)this.sendItems.Single();
Assert.Equal(commandErrorEventData.Exception.ToInvariantString(), dependencyTelemetry.Properties["Exception"]);
Assert.False(dependencyTelemetry.Success.Value);
Assert.Equal("42", dependencyTelemetry.ResultCode);
}
[Theory]
[InlineData(SqlClientDiagnosticSourceListener.SqlBeforeOpenConnection, SqlClientDiagnosticSourceListener.SqlErrorOpenConnection)]
[InlineData(SqlClientDiagnosticSourceListener.SqlMicrosoftBeforeOpenConnection, SqlClientDiagnosticSourceListener.SqlMicrosoftErrorOpenConnection)]

Просмотреть файл

@ -0,0 +1,170 @@
namespace Microsoft.ApplicationInsights.Tests
{
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.DependencyCollector.Implementation;
using Microsoft.ApplicationInsights.DependencyCollector.Implementation.SqlClientDiagnostics;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing;
using Microsoft.ApplicationInsights.W3C.Internal;
using Microsoft.ApplicationInsights.Web.TestFramework;
using Microsoft.VisualStudio.TestTools.UnitTesting;
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
[TestClass]
public class SqlClientDiagnosticSourceListenerTestsCopy : IDisposable
{
private const string TestConnectionString = "Data Source=(localdb)\\MSSQLLocalDB;Database=master";
private IList<ITelemetry> sendItems;
private StubTelemetryChannel stubTelemetryChannel;
private TelemetryConfiguration configuration;
private FakeSqlClientDiagnosticSource fakeSqlClientDiagnosticSource;
private SqlClientDiagnosticSourceListener sqlClientDiagnosticSourceListener;
public SqlClientDiagnosticSourceListenerTestsCopy()
{
this.sendItems = new List<ITelemetry>();
this.stubTelemetryChannel = new StubTelemetryChannel { OnSend = item => this.sendItems.Add(item) };
this.configuration = new TelemetryConfiguration
{
InstrumentationKey = Guid.NewGuid().ToString(),
TelemetryChannel = this.stubTelemetryChannel
};
this.fakeSqlClientDiagnosticSource = new FakeSqlClientDiagnosticSource();
this.sqlClientDiagnosticSourceListener = new SqlClientDiagnosticSourceListener(this.configuration);
}
public void Dispose()
{
this.sqlClientDiagnosticSourceListener.Dispose();
this.fakeSqlClientDiagnosticSource.Dispose();
this.configuration.Dispose();
this.stubTelemetryChannel.Dispose();
while (Activity.Current != null)
{
Activity.Current.Stop();
}
}
/// <summary>
/// This test was failing in XUnit + Net45, so i converted it to MSTest
/// </summary>
[TestMethod]
public void TracksCommandErrorWhenSqlException_Sql() => this.RunTest(SqlClientDiagnosticSourceListener.SqlBeforeExecuteCommand, SqlClientDiagnosticSourceListener.SqlErrorExecuteCommand);
/// <summary>
/// This test was failing in XUnit + Net45, so i converted it to MSTest
/// </summary>
[TestMethod]
public void TracksCommandErrorWhenSqlException_SqlMicrosoft() => this.RunTest(SqlClientDiagnosticSourceListener.SqlMicrosoftBeforeExecuteCommand, SqlClientDiagnosticSourceListener.SqlMicrosoftErrorExecuteCommand);
public void RunTest(string beforeCommand, string errorCommand)
{
var operationId = Guid.NewGuid();
var sqlConnection = new SqlConnection(TestConnectionString);
var sqlCommand = sqlConnection.CreateCommand();
sqlCommand.CommandText = "select * from orders";
var beforeExecuteEventData = new
{
OperationId = operationId,
Command = sqlCommand,
Timestamp = (long?)1000000L
};
this.fakeSqlClientDiagnosticSource.Write(
beforeCommand,
beforeExecuteEventData);
// Need to create SqlException via reflection because ctor is not public!
var sqlErrorCtor
= typeof(SqlError).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance)
.Single(c => c.GetParameters().Count() == 8);
var sqlError = sqlErrorCtor.Invoke(
new object[]
{
42, // error number
default(byte),
default(byte),
string.Empty,
string.Empty,
string.Empty,
0,
default(Exception)
});
var sqlErrorCollectionCtor
= typeof(SqlErrorCollection).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance)
.Single();
var sqlErrorCollection = sqlErrorCollectionCtor.Invoke(new object[] { });
typeof(SqlErrorCollection).GetMethod("Add", BindingFlags.NonPublic | BindingFlags.Instance)
.Invoke(sqlErrorCollection, new object[] { sqlError });
var sqlExceptionCtor = typeof(SqlException).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance)[0];
var sqlException = (SqlException)sqlExceptionCtor.Invoke(
new object[]
{
"Boom!",
sqlErrorCollection,
null,
Guid.NewGuid()
});
var commandErrorEventData = new
{
OperationId = operationId,
Command = sqlCommand,
Exception = (Exception)sqlException,
Timestamp = 2000000L
};
this.fakeSqlClientDiagnosticSource.Write(
errorCommand,
commandErrorEventData);
var dependencyTelemetry = (DependencyTelemetry)this.sendItems.Single();
Assert.AreEqual(commandErrorEventData.Exception.ToInvariantString(), dependencyTelemetry.Properties["Exception"]);
Assert.IsFalse(dependencyTelemetry.Success.Value);
Assert.AreEqual("42", dependencyTelemetry.ResultCode);
}
private class FakeSqlClientDiagnosticSource : IDisposable
{
private readonly DiagnosticListener listener;
public FakeSqlClientDiagnosticSource()
{
this.listener = new DiagnosticListener(SqlClientDiagnosticSourceListener.DiagnosticListenerName);
}
public void Write(string name, object value)
{
this.listener.Write(name, value);
}
public void Dispose()
{
this.listener.Dispose();
}
}
}
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
}

Просмотреть файл

@ -46,9 +46,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solutio
..\Common.props = ..\Common.props
..\Directory.Build.props = ..\Directory.Build.props
..\dirs.proj = ..\dirs.proj
..\GlobalStaticVersion.props = ..\GlobalStaticVersion.props
..\NuGet.config = ..\NuGet.config
..\Nupkg.props = ..\Nupkg.props
Product.props = Product.props
EndProjectSection
EndProject

Просмотреть файл

@ -2,8 +2,8 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove('$(MSBuildThisFileDirectory)\..', 'Common.props'))\Common.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove('$(MSBuildThisFileDirectory)\..', 'Nupkg.props'))\Nupkg.props" />
<Import Project="$(PropsRoot)\_Nupkg.props" />
<!--
Example of how to do logs:
Conditions are supported.

Просмотреть файл

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project=".\GlobalStaticVersion.props" />
<PropertyGroup>
<!-- EnlistmentRoot identifies the root directory of the repo and is used to dermine all other relative paths. -->
<EnlistmentRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'EnlistmentRoot.marker'))</EnlistmentRoot>
<PropsRoot>$(EnlistmentRoot)\.props</PropsRoot>
</PropertyGroup>
<Import Project="$(PropsRoot)\_GlobalStaticVersion.props" />
<ItemGroup>
<Solution Include="Src\Microsoft.ApplicationInsights.Web.sln" />
@ -14,7 +21,7 @@
<Target Name="Build">
<Exec Command='IF EXIST "%(Solution.FullPath)" nuget.exe restore "%(Solution.FullPath)" -NonInteractive' ContinueOnError="ErrorAndStop"/>
<MSBuild Projects="@(Solution)" Targets="Restore;Build" ContinueOnError="ErrorAndStop" Properties="PreReleaseVersion=$(PreReleaseVersion)"/>
<MSBuild Projects="@(Solution)" Targets="Restore;Build" ContinueOnError="ErrorAndStop" />
</Target>
<Target Name="Clean">