Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit fcd3c7a

Browse files
authored
Merge pull request #827 from Microsoft/cithomas/net20target
Add netstandard 2.0 target
2 parents d96c1ff + 572ca3a commit fcd3c7a

File tree

6 files changed

+36
-14
lines changed

6 files changed

+36
-14
lines changed

.vsts/linux-build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
queue:
2-
name: Hosted Linux
3-
steps:
1+
pool:
2+
vmImage: 'ubuntu-16.04'
3+
steps:
44

55
- task: DotNetCoreInstaller@0
66
displayName: install dotnet core 2.1.500
@@ -31,17 +31,17 @@ steps:
3131
- task: DotNetCoreInstaller@0
3232
displayName: install dotnet core 1.1.5
3333
inputs:
34-
version: "1.1.5"
35-
34+
version: "1.1.5"
35+
3636
- task: DotNetCoreCLI@1
3737
displayName: Test 1.1.5
3838
continueOnError: true
3939
inputs:
4040
command: "test"
4141
projects: "test/**/*Tests.csproj"
4242
arguments: "--configuration Release -l trx --filter Category!=WindowsOnly"
43-
44-
43+
44+
4545
- task: PublishTestResults@2
4646
inputs:
4747
testRunner: "VSTest"
@@ -55,9 +55,9 @@ steps:
5555
- task: DotNetCoreCLI@1
5656
displayName: Package Nuget
5757
inputs:
58-
command: "pack"
58+
command: "pack"
5959
projects: "src/**/**.csproj"
60-
arguments: "--configuration Release --include-symbols --output $(build.artifactstagingdirectory)"
60+
arguments: "--configuration Release --include-symbols --output $(build.artifactstagingdirectory)"
6161

6262
- task: PublishBuildArtifacts@1
6363
inputs:

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## Version 2.7.0-beta1
4+
- Added NetStandard2.0 target.
5+
36
## Version 2.6.0
47
- Updated Web/Base SDK version dependency to 2.9.0
58
- [Fix: TypeInitializationException when Microsoft.AspNetCore.Hosting and Microsoft.AspNetCore.Hosting.Abstractions versions do not match](https://github.com/Microsoft/ApplicationInsights-aspnetcore/pull/821)

src/Microsoft.ApplicationInsights.AspNetCore/Microsoft.ApplicationInsights.AspNetCore.csproj

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<RepositoryType>git</RepositoryType>
1010
<RepositoryUrl>https://github.com/Microsoft/ApplicationInsights-aspnetcore.git</RepositoryUrl>
1111

12-
<TargetFrameworks>net451;net46;netstandard1.6</TargetFrameworks>
13-
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.6</TargetFrameworks>
12+
<TargetFrameworks>net451;net46;netstandard1.6;netstandard2.0</TargetFrameworks>
13+
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.6;netstandard2.0</TargetFrameworks>
1414

1515
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard1.6' ">1.6.1</NetStandardImplicitPackageVersion>
1616
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\src\$(MSBuildProjectName)</OutputPath>
@@ -94,13 +94,21 @@
9494
<PackageReference Include="System.Text.Encodings.Web" Version="4.3.1" />
9595
</ItemGroup>
9696

97+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
98+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
99+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
100+
<PackageReference Include="Microsoft.Extensions.DiagnosticAdapter" Version="2.0.0" />
101+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.0.0" />
102+
<PackageReference Include="System.Text.Encodings.Web" Version="4.3.1" />
103+
</ItemGroup>
104+
97105
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' OR '$(TargetFramework)' == 'net46' ">
98106
<PackageReference Include="System.Net.Http" Version="4.3.2" />
99107
<Reference Include="System" />
100108
<Reference Include="Microsoft.CSharp" />
101109
</ItemGroup>
102110

103-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
111+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' OR '$(TargetFramework)' == 'netstandard2.0' ">
104112
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
105113
</ItemGroup>
106114

src/Microsoft.ApplicationInsights.AspNetCore/TelemetryInitializers/DomainNameRoleInstanceTelemetryInitializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private string GetMachineName()
3434
string hostName = Dns.GetHostName();
3535

3636
// Issue #61: For dnxcore machine name does not have domain name like in full framework
37-
#if !NETSTANDARD1_6
37+
#if NET451 || NET46
3838
string domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;
3939
if (!hostName.EndsWith(domainName, StringComparison.OrdinalIgnoreCase))
4040
{

test/Microsoft.ApplicationInsights.AspNetCore.Tests/Microsoft.ApplicationInsights.AspNetCore.Tests.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@
4444
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
4545
</ItemGroup>
4646

47+
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
48+
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.0" />
49+
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.0.0" />
50+
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.0.0" />
51+
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="2.0.0" />
52+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.0.0" />
53+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
54+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
55+
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
56+
</ItemGroup>
57+
4758
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
4859
<Reference Include="System" />
4960
<Reference Include="Microsoft.CSharp" />

test/Microsoft.ApplicationInsights.AspNetCore.Tests/TelemetryInitializers/DomainNameRoleInstanceTelemetryInitializerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void RoleInstanceNameIsSetToDomainAndHost()
2424

2525
string hostName = Dns.GetHostName();
2626

27-
#if NET451 || NET46
27+
#if NET46
2828
string domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;
2929
if (hostName.EndsWith(domainName, StringComparison.OrdinalIgnoreCase) == false)
3030
{

0 commit comments

Comments
 (0)