Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

Commit b444a1c

Browse files
committed
multi platform example
1 parent 49f3e33 commit b444a1c

File tree

7 files changed

+76
-21
lines changed

7 files changed

+76
-21
lines changed

.vscode/launch.json

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Para más información, visite: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7+
78
{
89
"name": "Launch C++ Project",
910
"type": "lldb",
@@ -25,33 +26,19 @@
2526
"program": "${workspaceFolder}/builddir/cpp/myApp.exe",
2627
}
2728
},
28-
//{
29-
// "name": "Launch C++ Project(Windows)",
30-
// "type": "cppvsdbg",
31-
// "request": "launch",
32-
// "program": "${workspaceFolder}/builddir/cpp/myApp.exe",
33-
// "args": [],
34-
// "stopAtEntry": false,
35-
// "cwd": "${workspaceFolder}",
36-
// "environment": [
37-
// {
38-
// "name": "Path",
39-
// "value": "${env:Path};${workspaceFolder}/builddir/sdk/appcenter"
40-
// }
41-
// ],
42-
// "console": "externalTerminal",
43-
// "preLaunchTask": "build C++ project"
44-
//},
4529
{
46-
"name": "Launch C# Project",
30+
"name": "Launch C# Project",
4731
"type": "coreclr",
4832
"request": "launch",
4933
"preLaunchTask": "build C# project",
50-
"program": "${workspaceFolder}/csharp/bin/Debug/net6.0-windows/csharp.dll",
34+
"program": "${workspaceFolder}/csharp/bin/Debug/net6.0/csharp-cross-platform.dll",
5135
"args": [],
5236
"cwd": "${workspaceFolder}/csharp",
5337
"console": "internalConsole",
54-
"stopAtEntry": false
38+
"stopAtEntry": false,
39+
"windows": {
40+
"program": "${workspaceFolder}/csharp/bin/Debug/net6.0-windows/csharp.dll",
41+
}
5542
}
5643
]
5744
}

.vscode/tasks.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"type": "shell",
2525
"args": [
2626
"build",
27+
"csharp-cross-platform.csproj",
2728
// Ask dotnet build to generate full paths for file names.
2829
"/property:GenerateFullPaths=true",
2930
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
@@ -37,7 +38,17 @@
3738
"presentation": {
3839
"reveal": "silent"
3940
},
40-
"problemMatcher": "$msCompile"
41+
"problemMatcher": "$msCompile",
42+
"windows":{
43+
"args": [
44+
"build",
45+
"csharp.csproj",
46+
// Ask dotnet build to generate full paths for file names.
47+
"/property:GenerateFullPaths=true",
48+
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
49+
"/consoleloggerparameters:NoSummary"
50+
],
51+
}
4152
}
4253
]
4354
}

Project.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.0.31919.166
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "csharp", "csharp\csharp.csproj", "{E258E54C-03C7-49E9-BDE1-31CE30933D70}"
77
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "csharp-cross-platform", "csharp\csharp-cross-platform.csproj", "{5A8014FC-CB58-4E8F-972C-CAA21BB3857C}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
1517
{E258E54C-03C7-49E9-BDE1-31CE30933D70}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{E258E54C-03C7-49E9-BDE1-31CE30933D70}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{E258E54C-03C7-49E9-BDE1-31CE30933D70}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{5A8014FC-CB58-4E8F-972C-CAA21BB3857C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{5A8014FC-CB58-4E8F-972C-CAA21BB3857C}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{5A8014FC-CB58-4E8F-972C-CAA21BB3857C}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{5A8014FC-CB58-4E8F-972C-CAA21BB3857C}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<Compile Remove="source\Program.cs" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<!-- this will only work on Windows uncomment if true -- >
16+
<PackageReference Include="Microsoft.AppCenter" Version="4.4.0" />
17+
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.4.0" />
18+
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.4.0" />
19+
<!-- -->
20+
</ItemGroup>
21+
22+
<ItemGroup>
23+
<Folder Include="source\" />
24+
</ItemGroup>
25+
26+
</Project>

csharp/csharp.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<ImplicitUsings>enable</ImplicitUsings>
99
</PropertyGroup>
1010

11+
<ItemGroup>
12+
<Compile Remove="source\source.cs" />
13+
</ItemGroup>
14+
1115
<ItemGroup>
1216
<PackageReference Include="Microsoft.AppCenter" Version="4.4.0" />
1317
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.4.0" />

csharp/source/source.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// the cross platform way of this project
2+
// it will show the console window on windows
3+
4+
// DllImport
5+
using System.Runtime.InteropServices;
6+
7+
// Microsoft AppCenter SDK
8+
// using Microsoft.AppCenter;
9+
// using Microsoft.AppCenter.Analytics;
10+
// using Microsoft.AppCenter.Crashes;
11+
12+
13+
Console.WriteLine("App Center Powered.");
14+
// AppCenter.Start("{Your App Secret}", typeof(Analytics), typeof(Crashes));
15+
dllEntry();
16+
17+
18+
19+
// library entry point
20+
[DllImport("myApp", EntryPoint = "dllEntry")]
21+
static extern void dllEntry();

0 commit comments

Comments
 (0)