[samples] Add Tasks to debug Samples in VSCode (#5880)
Update [`tasks.json`][0] to add the following tasks to VS Code: * `build-sample` * `run-sample` * `build-sample-under-dotnet` * `run-sample-under-dotnet` These tasks build or run one of the following projects; when running the task, the developer will be prompted for which project to use: * `samples/HelloWorld/HelloWorld.csproj` * `samples/HelloWorld/HelloWorld.DotNet.csproj` * `samples/VSAndroidApp/VSAndroidApp.csproj` These projects may also be debugged within VSCode. [0]: https://code.visualstudio.com/docs/editor/tasks-v1
This commit is contained in:
Родитель
c193141639
Коммит
4201dc1835
|
@ -27,7 +27,23 @@
|
|||
"args": [ ],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"stopAtEntry": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Debug Sample",
|
||||
"type": "mono",
|
||||
"request": "attach",
|
||||
"preLaunchTask": "run-sample",
|
||||
"address": "localhost",
|
||||
"port": 10000
|
||||
},
|
||||
{
|
||||
"name": "Debug Sample Under DotNet",
|
||||
"type": "mono",
|
||||
"request": "attach",
|
||||
"address": "localhost",
|
||||
"port": 10000,
|
||||
"preLaunchTask": "run-sample-under-dotnet",
|
||||
},
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
|
|
|
@ -86,7 +86,55 @@
|
|||
"problemMatcher": [
|
||||
"$msCompile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "build-sample",
|
||||
"type": "shell",
|
||||
"command": "bin/${input:configuration}/bin/xabuild ${input:project} /t:${input:target} /p:Configuration=${input:configuration}",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$msCompile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "run-sample",
|
||||
"type": "shell",
|
||||
"command": "bin/${input:configuration}/bin/xabuild ${input:project} /restore \"/t:Install;_Run\" /p:AndroidAttachDebugger=${input:attach} /p:Configuration=${input:configuration}",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$msCompile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "build-sample-under-dotnet",
|
||||
"type": "shell",
|
||||
"command": "${env:HOME}/android-toolchain/dotnet/dotnet build ${input:project} -p:Configuration=${input:configuration} -t:${input:target}",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$msCompile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "run-sample-under-dotnet",
|
||||
"type": "shell",
|
||||
"command": "${env:HOME}/android-toolchain/dotnet/dotnet build ${input:project} \"-t:Run\" --no-restore -p:TargetFramework=${input:targetframework} -p:Configuration=${input:configuration} -p:AndroidAttachDebugger=${input:attach}",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$msCompile"
|
||||
]
|
||||
},
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
|
@ -95,6 +143,50 @@
|
|||
"default": "Debug",
|
||||
"description": "The Build Configuration",
|
||||
"options": [ "Debug", "Release"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "attach",
|
||||
"type": "pickString",
|
||||
"default": "Build",
|
||||
"description": "Attach Debugger?",
|
||||
"options": [
|
||||
"true",
|
||||
"false",
|
||||
]
|
||||
},
|
||||
{
|
||||
// Add additional projects here. They will be available in the drop down
|
||||
// in vscode.
|
||||
"id": "project",
|
||||
"type": "pickString",
|
||||
"default": "samples/HelloWorld/HelloWorld.csproj",
|
||||
"description": "Pick the Project you want to build.",
|
||||
"options": [
|
||||
"samples/HelloWorld/HelloWorld.csproj",
|
||||
"samples/HelloWorld/HelloWorld.DotNet.csproj",
|
||||
"samples/VSAndroidApp/VSAndroidApp.csproj",
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "targetframework",
|
||||
"type": "pickString",
|
||||
"default": "Build",
|
||||
"description": "Select TargetFramework",
|
||||
"options": [
|
||||
"net6.0-android",
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "target",
|
||||
"type": "pickString",
|
||||
"default": "Build",
|
||||
"description": "Select MSBuild Target to run.",
|
||||
"options": [
|
||||
"Build",
|
||||
"Install",
|
||||
"SignAndroidPackage",
|
||||
"Clean"
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-android</TargetFramework>
|
||||
<RootNamespace>HelloLibrary</RootNamespace>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-android</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>HelloWorld</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="HelloLibrary\HelloLibrary.DotNet.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Properties\AssemblyInfo.cs" />
|
||||
<!-- <Compile Remove="Resources\Resource.designer.cs" /> -->
|
||||
<Compile Remove="HelloLibrary\**\*.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="local-xa" value="../bin/BuildDebug/nuget-unsigned" />
|
||||
</packageSources>
|
||||
<disabledPackageSources />
|
||||
</configuration>
|
Загрузка…
Ссылка в новой задаче