Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Sample: console (#5)
Browse files Browse the repository at this point in the history
* Runtime has FrameworkInstallation when compiled to NETFX
* Sample app outputs calls in different targets
* Run sample on Mono
* Execute flag on run.sh
* Add sample output to Console readme
  • Loading branch information
bruno-garcia committed May 21, 2018
1 parent 6ad14aa commit 0bec1b5
Show file tree
Hide file tree
Showing 14 changed files with 597 additions and 45 deletions.
2 changes: 2 additions & 0 deletions Directory.Build.props
@@ -1,5 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>7.2</LangVersion>

<!-- When compiling .NET SDK 2.0 projects targeting .NET 4.x on 32 bit Windows or Mono using 'dotnet build' you -->
<!-- have to teach MSBuild where the Mono copy of the reference asssemblies is -->
<TargetFullFx Condition="$(TargetFramework.StartsWith('net4')) OR $(TargetFramework.StartsWith('net3'))">true</TargetFullFx>
Expand Down
25 changes: 24 additions & 1 deletion Sentry.PlatformAbstractions.sln
Expand Up @@ -7,18 +7,28 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B56B8225-B35
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{4D401EA1-FD88-4B51-A438-AD793CBBCB6C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sentry.PlatformAbstractions", "src\Sentry.PlatformAbstractions\\Sentry.PlatformAbstractions.csproj", "{3E855C8F-BFC8-4E65-9AF9-A940432879B0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sentry.PlatformAbstractions", "src\Sentry.PlatformAbstractions\Sentry.PlatformAbstractions.csproj", "{3E855C8F-BFC8-4E65-9AF9-A940432879B0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sentry.PlatformAbstractions.Tests", "test\Sentry.PlatformAbstractions.Tests\Sentry.PlatformAbstractions.Tests.csproj", "{91265AF9-00FD-4025-89CC-59B3618A2DCA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1 - Solution Items", "1 - Solution Items", "{4A9DC244-EBD1-4422-BBCA-90198EF28FD5}"
ProjectSection(SolutionItems) = preProject
.appveyor.yml = .appveyor.yml
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
.travis.yml = .travis.yml
build.ps1 = build.ps1
build.sh = build.sh
Directory.Build.props = Directory.Build.props
global.json = global.json
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{6C66C83F-F92F-4BB3-8A85-7EE101330CCD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sentry.PlatformAbstractions.Console", "samples\Sentry.PlatformAbstractions.Console\Sentry.PlatformAbstractions.Console.csproj", "{B60303FA-3E44-4694-8B57-85ABBA397529}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -53,13 +63,26 @@ Global
{91265AF9-00FD-4025-89CC-59B3618A2DCA}.Release|x64.Build.0 = Release|Any CPU
{91265AF9-00FD-4025-89CC-59B3618A2DCA}.Release|x86.ActiveCfg = Release|Any CPU
{91265AF9-00FD-4025-89CC-59B3618A2DCA}.Release|x86.Build.0 = Release|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Debug|x64.ActiveCfg = Debug|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Debug|x64.Build.0 = Debug|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Debug|x86.ActiveCfg = Debug|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Debug|x86.Build.0 = Debug|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Release|Any CPU.Build.0 = Release|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Release|x64.ActiveCfg = Release|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Release|x64.Build.0 = Release|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Release|x86.ActiveCfg = Release|Any CPU
{B60303FA-3E44-4694-8B57-85ABBA397529}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{3E855C8F-BFC8-4E65-9AF9-A940432879B0} = {B56B8225-B353-465A-9F60-7C4752F1CC00}
{91265AF9-00FD-4025-89CC-59B3618A2DCA} = {4D401EA1-FD88-4B51-A438-AD793CBBCB6C}
{B60303FA-3E44-4694-8B57-85ABBA397529} = {6C66C83F-F92F-4BB3-8A85-7EE101330CCD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C2209186-15DA-444D-A1BE-F47CDE7D902B}
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Expand Up @@ -74,7 +74,7 @@ function TestAllTargets($project)
}
else
{
dotnet test -c Release -f $target $project
dotnet test --no-build -c Release -f $target $project
if ($lastexitcode -ne 0) { Set-Variable -name fail -value true }
}
}
Expand Down
34 changes: 34 additions & 0 deletions samples/Sentry.PlatformAbstractions.Console/Program.cs
@@ -0,0 +1,34 @@
namespace Sentry.PlatformAbstractions.Console
{
internal static class Program
{
private static void Main()
{
System.Console.WriteLine($@"Runtime.Current:
ToString(): {Runtime.Current}
Name: {Runtime.Current.Name}
Version: {Runtime.Current.Version}
Raw: {Runtime.Current.Raw}");

#if !NETCOREAPP2_0 && !NETCOREAPP1_1
System.Console.WriteLine($@"
Runtime.Current.FrameworkInstallation:
ShortName: {Runtime.Current.FrameworkInstallation?.ShortName}
Profile: {Runtime.Current.FrameworkInstallation?.Profile}
Version: {Runtime.Current.FrameworkInstallation?.Version}
ServicePack: {Runtime.Current.FrameworkInstallation?.ServicePack}
Release: {Runtime.Current.FrameworkInstallation?.Release}
ToString(): {Runtime.Current.FrameworkInstallation}
");
#endif

System.Console.WriteLine($@"Extension methods on Runtime:
IsMono(): {Runtime.Current.IsMono()}
IsNetCore() {Runtime.Current.IsNetCore()}
IsNetFx(): {Runtime.Current.IsNetFx()}
");
}
}
}

0 comments on commit 0bec1b5

Please sign in to comment.