### Install PerfCollect and Prerequisites Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/dotnet-trace-collect/references/perfcollect.md Download the perfcollect script, make it executable, and then install its prerequisites like `perf` and `LTTng` using the script itself. This is the initial setup step on a Linux machine. ```bash curl -OL https://aka.ms/perfcollect chmod +x perfcollect sudo ./perfcollect install ``` -------------------------------- ### Setup Options for Agent Test Environment Source: https://github.com/dotnet/skills/blob/main/eng/skill-validator/src/README.md Configure the test environment by choosing to copy test files, explicitly define files with content or source paths, or specify commands to run before the agent starts. ```markdown | Option | Description | |---|---| | `copy_test_files` | When `true`, copies all files from the eval directory (except `eval.yaml`) into the agent working directory before each run. Useful when test fixtures live alongside the eval file. | | `files` | Explicit list of files to create in the working directory. Each entry has a `path` and either inline `content` or a `source` path (relative to the skill directory). Applied after `copy_test_files`. | | `commands` | Shell commands to run in the work directory before the agent starts (e.g. `dotnet build -bl:build.binlog`). | | `additional_required_skills` | List of skill names (from the same plugin) to load in the **isolated** run alongside the target. Useful when an agent routes to specific skills or a skill depends on sibling skills. Does not affect baseline (nothing loaded) or plugin (everything loaded) runs. | | `additional_required_agents` | List of agent names (from the same plugin) to register in the **isolated** run alongside the target. Same semantics as `additional_required_skills` but for agents. | ``` -------------------------------- ### Install System.IO.Abstractions.TestingHelpers Package Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/generate-testability-wrappers/SKILL.md Installs the testing helper package for System.IO.Abstractions, which provides MockFileSystem for unit testing. ```bash dotnet add package System.IO.Abstractions.TestingHelpers ``` -------------------------------- ### Install .NET MAUI Workload Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/troubleshooting.md Install the necessary MAUI workload for your .NET SDK. ```bash dotnet workload install maui --version $WORKLOAD_VERSION ``` -------------------------------- ### Install a Plugin in Copilot CLI Source: https://github.com/dotnet/skills/blob/main/README.md After adding the marketplace, use this command to install a specific plugin from the .NET skills marketplace. Replace `` with the desired plugin name. Restart your tool after installation. ```bash /plugin install @dotnet-agent-skills ``` -------------------------------- ### Install mcp-publisher Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-ai/skills/mcp-csharp-publish/SKILL.md Install the MCP publisher tool using Homebrew or by downloading a release. ```bash # macOS/Linux brew install mcp-publisher # Or download from https://github.com/modelcontextprotocol/registry/releases ``` -------------------------------- ### Install System.IO.Abstractions NuGet Package Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/generate-testability-wrappers/SKILL.md Installs the System.IO.Abstractions package, which provides an abstraction layer for file system operations. Prefer this over custom wrappers. ```bash dotnet add package System.IO.Abstractions ``` -------------------------------- ### Targeted GlobalSetup for Specific Benchmarks Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/microbenchmarking/references/writing-benchmarks.md When multiple benchmarks require different setup logic, use the `Target` or `Targets` property on `[GlobalSetup]` to specify which benchmarks the setup method applies to. ```csharp [GlobalSetup(Target = nameof(BenchmarkA))] public void SetupA() { ... } [GlobalSetup(Targets = new[] { nameof(BenchmarkB), nameof(BenchmarkC) })] public void SetupBC() { ... } ``` -------------------------------- ### Install OpenTelemetry Core Packages Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-aspnet/skills/configuring-opentelemetry-dotnet/SKILL.md Install the core SDK, ASP.NET Core instrumentation, HTTP client instrumentation, and the OTLP exporter. The OTLP exporter is used for traces, metrics, and logs. ```bash dotnet add package OpenTelemetry.Extensions.Hosting dotnet add package OpenTelemetry.Instrumentation.AspNetCore dotnet add package OpenTelemetry.Instrumentation.Http dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol # OTLP exporter for traces, metrics, AND logs ``` -------------------------------- ### Install dotnet-monitor Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/dotnet-trace-collect/references/dotnet-monitor.md Installs dotnet-monitor as a global tool or provides the container image for Kubernetes sidecar deployments. ```bash # As a global tool dotnet tool install -g dotnet-monitor # As a container image (for K8s sidecar) # mcr.microsoft.com/dotnet/monitor ``` -------------------------------- ### List Xcode Installations and Versions Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/installation-commands-macos.md Lists all installed Xcode applications and displays the active Xcode version and path. Useful for verifying installation and managing multiple Xcode versions. ```bash ls -d /Applications/Xcode*.app 2>/dev/null xcodebuild -version xcode-select -p ``` -------------------------------- ### Check .NET SDK Installation Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/troubleshooting.md Verify if the .NET SDK is installed and accessible in your system's PATH. ```bash which dotnet ``` ```bash export PATH="$PATH:$HOME/.dotnet" ``` -------------------------------- ### Install .NET MAUI Workloads Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/troubleshooting.md Installs required .NET MAUI workloads. Replace `[workload-name]` with the specific workload and `$WORKLOAD_VERSION` with the version. ```bash dotnet workload install [workload-name] --version $WORKLOAD_VERSION ``` -------------------------------- ### MSTest SDK Project Setup Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/writing-mstest-tests/SKILL.md Recommended setup for new MSTest projects using the MSTest SDK. This simplifies configuration and ensures all features are available. ```xml net9.0 ``` -------------------------------- ### Install Android SDK Components Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/installation-commands.md Use these commands to install specific Android SDK components. Ensure the ANDROID_SDK_ROOT environment variable is set. ```powershell & "$env:ANDROID_SDK_ROOT\cmdline-tools\latest\bin\sdkmanager.bat" "platform-tools" ``` ```powershell & "$env:ANDROID_SDK_ROOT\cmdline-tools\latest\bin\sdkmanager.bat" "build-tools;$BUILD_TOOLS_VERSION" ``` ```powershell & "$env:ANDROID_SDK_ROOT\cmdline-tools\latest\bin\sdkmanager.bat" "platforms;android-$API_LEVEL" ``` ```powershell & "$env:ANDROID_SDK_ROOT\cmdline-tools\latest\bin\sdkmanager.bat" "cmdline-tools;$CMDLINE_TOOLS_VERSION" ``` -------------------------------- ### Install Individual Skill using skill-installer CLI Source: https://github.com/dotnet/skills/blob/main/README.md Use the skill-installer CLI to install individual skills from the .NET skills repository by providing the GitHub URL to the specific skill. This is useful for integrating single skills into your project. ```bash $ skill-installer install https://github.com/dotnet/skills/tree/main/plugins//skills/ ``` -------------------------------- ### Install dotnet-trace Global Tool Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/dotnet-trace-collect/references/dotnet-trace-collect.md Installs the dotnet-trace tool globally using the .NET SDK. This is a prerequisite for using the tool from the command line. ```bash dotnet tool install -g dotnet-trace ``` -------------------------------- ### Install mcp-publisher CLI Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-ai/skills/mcp-csharp-publish/references/mcp-registry.md Installs the mcp-publisher CLI tool. Use Homebrew for macOS/Linux or download the binary from releases. ```bash # macOS/Linux (Homebrew) brew install mcp-publisher # Or download binary from releases # https://github.com/modelcontextprotocol/registry/releases ``` -------------------------------- ### Install .NET Skills Plugins via Copilot CLI Source: https://context7.com/dotnet/skills/llms.txt Commands to add the dotnet/skills marketplace, install a specific plugin like dotnet-diag, and list loaded skills. ```bash # Add the marketplace once /plugin marketplace add dotnet/skills # Install a plugin (e.g., dotnet-diag) /plugin install dotnet-diag@dotnet-agent-skills # Restart the agent, then list loaded skills /skills /agents # Update a plugin on demand /plugin update dotnet-diag@dotnet-agent-skills ``` -------------------------------- ### Install Android Platform SDK Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/troubleshooting.md Installs a specific Android API level platform. Replace `$API_LEVEL` with the required API level. ```bash # macOS/Linux $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "platforms;android-$API_LEVEL" # Windows # & "$env:ANDROID_SDK_ROOT\cmdline-tools\latest\bin\sdkmanager.bat" "platforms;android-$API_LEVEL" ``` -------------------------------- ### Define Agent Scenarios with Setup and Assertions Source: https://github.com/dotnet/skills/blob/main/eng/skill-validator/src/README.md Configure a scenario with a descriptive name, prompt, setup instructions (like copying files or defining new ones), and assertions to validate agent behavior and output. ```yaml scenarios: - name: "Descriptive name of the scenario" prompt: "The prompt to send to the agent" setup: copy_test_files: true # auto-copy all sibling files into agent work dir files: - path: "input.txt" content: "file content to create before the run" - path: "data.csv" source: "fixtures/sample-data.csv" # relative to skill dir additional_required_skills: # skills needed by the target in isolated runs - binlog-failure-analysis additional_required_agents: # agents needed by the target in isolated runs - build-perf assertions: - type: "output_contains" value: "expected text" - type: "output_not_contains" value: "text that should not appear" - type: "output_matches" pattern: "regex pattern" - type: "output_not_matches" pattern: "regex that should not match" - type: "file_exists" path: "*.csv" - type: "file_not_exists" path: "*.csproj" - type: "file_contains" path: "*.cs" value: "stackalloc" - type: "exit_success" expect_tools: ["bash"] reject_tools: ["create_file"] max_turns: 15 rubric: - "The output is well-formatted and clear" - "The agent correctly handled edge cases" timeout: 120 ``` -------------------------------- ### Install and Use dotnet-dump Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/dump-collect/references/coreclr-dumps.md Install the `dotnet-dump` global tool for on-demand crash dump collection. List running processes and collect dumps by PID. ```bash # Install (one-time, requires .NET SDK) dotnet tool install -g dotnet-dump # Without the SDK, download directly from https://github.com/dotnet/diagnostics/releases # List .NET processes dotnet-dump ps # Collect a dump from a running process dotnet-dump collect -p # Specify dump type and output path dotnet-dump collect -p --type Full --output /tmp/dumps/myapp.dmp ``` -------------------------------- ### List Installed .NET Workloads Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/installation-commands.md View a list of all .NET workloads currently installed on your system. ```bash dotnet workload list ``` -------------------------------- ### Amortize Setup Costs with OperationsPerInvoke Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/microbenchmarking/references/writing-benchmarks.md When setup involves stack-only types like `Span` and cannot be moved to `[GlobalSetup]`, use `OperationsPerInvoke` to amortize the setup cost. The measured time is divided by this value, and operations are manually unrolled to avoid loop overhead. ```csharp private byte[] _array = new byte[18]; [Benchmark(OperationsPerInvoke = 16)] public Span Slice() { Span span = new Span(_array); // setup: can't go in GlobalSetup (stack-only) // 16 operations, unrolled without a loop span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); span = span.Slice(1); return span; } ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/installation-commands-macos.md Installs the command line tools required for Xcode development. Run this command after downloading Xcode. ```bash xcode-select --install ``` -------------------------------- ### Install Optional Auto-Instrumentation Packages Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-aspnet/skills/configuring-opentelemetry-dotnet/SKILL.md Install additional instrumentation packages based on the libraries your application uses, such as SQL Server, Entity Framework Core, or gRPC client. ```bash dotnet add package OpenTelemetry.Instrumentation.SqlClient # SQL Server queries dotnet add package OpenTelemetry.Instrumentation.EntityFrameworkCore # EF Core dotnet add package OpenTelemetry.Instrumentation.GrpcNetClient # gRPC calls dotnet add package OpenTelemetry.Instrumentation.Runtime # GC, thread pool metrics ``` -------------------------------- ### Install Android Build Tools Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/troubleshooting.md Install the required Android build tools using the `sdkmanager`. Retrieve the specific version needed from `WorkloadDependencies.json`. ```bash # Get build tools version from WorkloadDependencies.json (androidsdk.buildToolsVersion) # Use sdkmanager (macOS/Linux) $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "build-tools;$BUILD_TOOLS_VERSION" ``` ```powershell # Windows # & "$env:ANDROID_SDK_ROOT\cmdline-tools\latest\bin\sdkmanager.bat" "build-tools;$BUILD_TOOLS_VERSION" ``` -------------------------------- ### Install .NET MAUI Workloads with Explicit Version Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/installation-commands.md Install the full MAUI workload or individual components using an explicit version number. Always use the `--version` flag to avoid version inconsistencies. ```bash # Full MAUI installation (recommended) dotnet workload install maui --version $WORKLOAD_VERSION # Individual workloads dotnet workload install android --version $WORKLOAD_VERSION dotnet workload install ios --version $WORKLOAD_VERSION # macOS only meaningful dotnet workload install maccatalyst --version $WORKLOAD_VERSION # macOS only meaningful # Multiple at once dotnet workload install maui android ios maccatalyst --version $WORKLOAD_VERSION ``` -------------------------------- ### Verify Xcode Installation Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/installation-commands-macos.md Verifies the Xcode installation by checking its version and listing available iOS simulators. Ensures that Xcode and its associated tools are correctly set up. ```bash xcodebuild -version xcrun simctl list devices available ``` -------------------------------- ### AppShell.xaml Setup Example Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/maui-shell-navigation/references/shell-navigation-api.md An example of how to set up the AppShell.xaml file to define the navigation hierarchy using FlyoutItem, Tab, and ShellContent elements. ```APIDOC ## AppShell.xaml Setup ```xml ``` ``` -------------------------------- ### Benchmark Project Program.cs Setup Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/microbenchmarking/references/project-setup-and-running.md Replace the default Program.cs with this code to use BenchmarkSwitcher for running benchmarks in a project. ```csharp using BenchmarkDotNet.Running; BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); ``` -------------------------------- ### Classic ML Project Setup with NuGet Packages Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-ai/skills/technology-selection/SKILL.md Configure your project by adding necessary NuGet packages for classic machine learning tasks. Include packages for core ML, AutoML, numerical operations, and data analysis as needed. Avoid using Accord.NET as it is unmaintained. ```xml PackageReference Include="System.Numerics.Tensors" Version="10.* ``` -------------------------------- ### C# Script Evaluation Configuration Source: https://context7.com/dotnet/skills/llms.txt An example eval.yaml file for testing a C# script. It includes setup steps like copying files and running build commands, along with various assertions to validate the script's output and behavior. It also specifies tools to expect and reject. ```yaml config: max_parallel_scenarios: 2 max_parallel_runs: 3 scenarios: - name: "Test a C# language feature with a script" prompt: "Does C# support creating a stackalloc'd Span of native-sized integers? Test it." setup: copy_test_files: true # copies all sibling files into work dir files: - path: "input.txt" content: "inline content" - path: "data.csv" source: "fixtures/sample-data.csv" # relative to skill dir commands: - "dotnet build -bl:build.binlog" additional_required_skills: - binlog-failure-analysis assertions: - type: "exit_success" - type: "output_contains" value: "stackalloc" - type: "output_matches" pattern: "(nint|nuint|native)" - type: "output_not_matches" pattern: "dotnet new console" - type: "file_exists" path: "*.cs" - type: "file_contains" path: "*.cs" value: "stackalloc" expect_tools: ["bash"] reject_tools: ["create_file"] max_turns: 10 max_tokens: 5000 rubric: - "Uses 'dotnet .cs' (file-based app), not 'dotnet new console'" - "Code compiles and runs, demonstrating stackalloc with Span" timeout: 120 ``` -------------------------------- ### Check MCP Server Template Installation Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-ai/skills/mcp-csharp-create/SKILL.md Check if the MCP server template is installed. If not, install it using `dotnet new install Microsoft.McpServer.ProjectTemplates`. ```bash dotnet new list mcpserver ``` -------------------------------- ### Verify Android SDK Installation Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/installation-commands.md Check the installation of Android Debug Bridge (ADB) and list installed SDK packages. ```bash adb --version ``` ```bash $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list_installed ``` ```powershell # & "$env:ANDROID_SDK_ROOT\cmdline-tools\latest\bin\sdkmanager.bat" --list_installed ``` -------------------------------- ### After: Centralized Settings with Directory.Build and Directory.Packages Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-msbuild/skills/directory-build-organization/references/multi-level-examples.md Shows how to centralize build properties and package versions using Directory.Build.props and Directory.Packages.props, resulting in cleaner project files. ```xml latest enable enable true Contoso Contoso Engineering true net8.0 net8.0 ``` -------------------------------- ### Install Specific .NET SDK Version Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/troubleshooting.md Install a specific .NET SDK version required by your project, often needed when `global.json` specifies a version that is not installed. ```bash # Check required version cat global.json ``` ```bash # Install specific version curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version X.Y.Z ``` -------------------------------- ### Verify Java JDK Installation Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/installation-commands.md After installing the Microsoft Build of OpenJDK, run this command to verify the installation. The output MUST include 'Microsoft' to confirm it's the supported version. ```bash # MUST show "Microsoft" in output java -version ``` -------------------------------- ### GlobalSetup for Benchmark Initialization Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/microbenchmarking/references/writing-benchmarks.md Use `[GlobalSetup]` to initialize state once before all benchmark iterations. This method runs once per benchmark case and is suitable for allocating buffers or loading data. ```csharp private int[] _array; [GlobalSetup] public void Setup() => _array = Enumerable.Range(0, 1000).ToArray(); [Benchmark] public int Sum() => _array.Sum(); ``` -------------------------------- ### macOS: Detect Microsoft OpenJDK Installation Path Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/microsoft-openjdk.md These commands help detect if Microsoft OpenJDK is installed on macOS by listing known installation directories or querying the Java home utility. ```bash ls -d /Library/Java/JavaVirtualMachines/microsoft-*.jdk 2>/dev/null ``` ```bash /usr/libexec/java_home -V 2>&1 | grep -i microsoft ``` -------------------------------- ### Azure Container Apps: Full Setup Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-ai/skills/mcp-csharp-publish/references/docker-azure.md Commands to create a new Azure Container Apps environment and deploy an MCP server container, configuring ingress, scaling, and secrets. ```bash # Create environment (one-time) az containerapp env create \ --name myenvironment \ --resource-group mygroup \ --location eastus # Create the container app az containerapp create \ --name mymcpserver \ --resource-group mygroup \ --environment myenvironment \ --image .azurecr.io/:1.0.0 \ --registry-server .azurecr.io \ --target-port 8080 \ --ingress external \ --min-replicas 0 \ --max-replicas 10 \ --cpu 0.5 \ --memory 1.0Gi \ --secrets api-key="your-secret-value" \ --env-vars API_KEY=secretref:api-key # Get the URL az containerapp show --name mymcpserver --resource-group mygroup \ --query properties.configuration.ingress.fqdn -o tsv ``` -------------------------------- ### Build, Pack, and Push NuGet Package Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-ai/skills/mcp-csharp-publish/references/nuget-packaging.md Commands to build your project, create a NuGet package, test it locally, and push it to a NuGet repository. Ensure you replace placeholders like YOUR_NUGET_API_KEY. ```bash # Build dotnet build -c Release # Create NuGet package dotnet pack -c Release # Output: bin/Release/YourUsername.MyMcpServer.1.0.0.nupkg # Test package locally dotnet tool install --global --add-source bin/Release/ YourUsername.MyMcpServer mymcpserver --help dotnet tool uninstall --global YourUsername.MyMcpServer # Push to NuGet.org dotnet nuget push bin/Release/*.nupkg \ --api-key YOUR_NUGET_API_KEY \ --source https://api.nuget.org/v3/index.json ``` -------------------------------- ### Manage Xcode Installations on macOS Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/troubleshooting-macos.md Use these commands to list available Xcode installations and set the active Xcode path. This is useful when multiple Xcode versions are installed or when Xcode is not found at the default location. ```bash # List Xcode installations ls -d /Applications/Xcode*.app 2>/dev/null ``` ```bash # Set active Xcode sudo xcode-select -s /Applications/Xcode.app/Contents/Developer ``` -------------------------------- ### MAUI Shell Navigation Examples Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/maui-shell-navigation/SKILL.md Demonstrates various navigation patterns in MAUI Shell, including absolute routing, relative routing, passing query parameters, and navigating back. ```csharp await Shell.Current.GoToAsync("//animals/cats/domestic"); ``` ```csharp await Shell.Current.GoToAsync("animaldetails"); ``` ```csharp await Shell.Current.GoToAsync($"animaldetails?id={animal.Id}"); ``` ```csharp await Shell.Current.GoToAsync(".."); ``` ```csharp await Shell.Current.GoToAsync("../.."); ``` ```csharp await Shell.Current.GoToAsync("../editanimal"); ``` -------------------------------- ### Instantiate Service with Dependency Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/code-testing-extensions/extensions/dotnet-examples.md Demonstrates how to correctly instantiate a service that requires a dependency, such as an IInvoiceRepository. This is typically used when fixing constructor errors. ```csharp // Before (wrong) var sut = new InvoiceService(); // After (fixed) var repositoryMock = new Mock(); var sut = new InvoiceService(repositoryMock.Object); ``` -------------------------------- ### Install Android Workload Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/troubleshooting.md Installs the Android workload for the .NET SDK. Replace `$WORKLOAD_VERSION` with the specific version if needed. ```bash dotnet workload install android --version $WORKLOAD_VERSION ``` -------------------------------- ### Configuring Runtime Environment with Environment Variables Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/microbenchmarking/references/bdn-internals-and-tuning.md Demonstrates how to set environment variables for the benchmark process using the configuration API. ```csharp job.WithEnvironmentVariable("key", "value") ``` -------------------------------- ### Check Android SDK Installation Paths Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/installation-commands.md Directly check common installation paths for the Android SDK on macOS and Linux. ```bash # Check known paths directly ls -d ~/Library/Android/sdk 2>/dev/null # macOS ls -d ~/Android/Sdk 2>/dev/null # Linux ``` -------------------------------- ### Build and Run Microbenchmarks Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/microbenchmarking/references/project-setup-and-running.md Build the project in Release configuration and then run benchmarks, redirecting all output to a log file. Use `--no-build` to skip rebuilding if already built, and `--filter` to target specific benchmarks. Redirect standard error (2) to standard output (1) to capture all logs. ```bash dotnet build -c Release dotnet run -c Release --no-build -- --filter "*MethodName" --noOverwrite > benchmark.log 2>&1 ``` -------------------------------- ### iOS Workload Dependencies Example Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/workload-dependencies-discovery.md Example JSON structure for iOS workload dependencies, specifying Xcode and SDK version requirements. ```json { "microsoft.net.sdk.ios": { "xcode": { "version": "[26.2,)", "recommendedVersion": "26.2" }, "sdk": { "version": "26.2" } } } ``` -------------------------------- ### Android Workload Dependencies Example Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/references/workload-dependencies-discovery.md Example JSON structure for Android workload dependencies, detailing JDK and Android SDK requirements. ```json { "microsoft.net.sdk.android": { "jdk": { "version": "[17.0,22.0)", "recommendedVersion": "21.0.8" }, "androidsdk": { "packages": ["build-tools;35.0.0", "platform-tools", "platforms;android-35", "cmdline-tools;13.0"], "apiLevel": "35", "buildToolsVersion": "35.0.0", "cmdLineToolsVersion": "13.0" } } } ``` -------------------------------- ### Analyze Build Performance with Binlog Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-msbuild/skills/build-parallelism/SKILL.md Replay a binlog file with diagnostic logging and performance summary enabled to analyze build times and identify bottlenecks. ```bash dotnet msbuild build.binlog -noconlog -fl -flp:v=diag;logfile=full.log;performancesummary ``` -------------------------------- ### Clean Build and Test Commands Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-upgrade/skills/migrate-dotnet9-to-dotnet10/SKILL.md Perform a full clean build and run all tests to verify the migration. Use `--no-incremental` for a complete build. ```bash dotnet build --no-incremental ``` ```bash dotnet test ``` -------------------------------- ### Install Individual Skill via Codex CLI Source: https://context7.com/dotnet/skills/llms.txt Command to install a specific skill, such as 'microbenchmarking' from the dotnet-diag plugin, using its GitHub URL. ```bash # Install an individual skill by GitHub URL skill-installer install https://github.com/dotnet/skills/tree/main/plugins/dotnet-diag/skills/microbenchmarking ``` -------------------------------- ### Runtime Configuration Example Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-upgrade/skills/migrate-dotnet8-to-dotnet9/references/deployment-runtime-dotnet8to9.md Illustrates a runtimeconfig.json setting for server GC. In .NET 9, environment variables like DOTNET_gcServer now take precedence over this configuration. ```json { "runtimeOptions": { "configProperties": { "System.GC.Server": true } } } ``` -------------------------------- ### Install and Run MCP Inspector Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-ai/skills/mcp-csharp-debug/references/mcp-inspector.md Use npx to run the Inspector without a global installation. This command launches the interactive debugging tool. ```bash npx @modelcontextprotocol/inspector ``` -------------------------------- ### Configure Deployment in .runsettings Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/migrate-mstest-v1v2-to-v3/SKILL.md To enable deployment, use the `true` setting in your .runsettings file. If deployment is not needed, this setting can be omitted. ```xml true ``` -------------------------------- ### Install gh aw CLI Extension Source: https://github.com/dotnet/skills/blob/main/docs/agentic-workflows.md Installs the GitHub Agentic Workflow CLI extension. This is the first step to using the agentic workflows. ```bash gh extension install github/gh-aw ``` -------------------------------- ### Flyout Item Template Example Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/maui-shell-navigation/references/shell-navigation-api.md Example of how to customize the appearance of flyout items using DataTemplate and binding to properties like Title and FlyoutIcon. ```APIDOC ## Flyout Item Template Customize appearance with `Shell.ItemTemplate`. BindingContext exposes `Title` and `FlyoutIcon` (FlyoutItem) or `Text` and `IconImageSource` (MenuItem): ```xml ``` ``` -------------------------------- ### Install ReportGenerator Global Tool Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/coverage-analysis/SKILL.md Checks if the `reportgenerator` global tool is available and installs it if not. It adds the tool to the system's PATH for subsequent use. ```powershell $rgAvailable = $false $rgCommand = Get-Command reportgenerator -ErrorAction SilentlyContinue if ($rgCommand) { $rgAvailable = $true Write-Host "RG_INSTALLED:already-present" } else { $rgToolPath = Join-Path "" ".tools" dotnet tool install dotnet-reportgenerator-globaltool --tool-path $rgToolPath if ($LASTEXITCODE -eq 0) { $env:PATH = "$rgToolPath$([System.IO.Path]::PathSeparator)$env:PATH" $rgCommand = Get-Command reportgenerator -ErrorAction SilentlyContinue if ($rgCommand) { $rgAvailable = $true Write-Host "RG_INSTALLED:true (tool-path: $rgToolPath)" } else { Write-Host "RG_INSTALLED:false" Write-Host "RG_INSTALL_ERROR:reportgenerator-not-available" } } else { Write-Host "RG_INSTALLED:false" Write-Host "RG_INSTALL_ERROR:reportgenerator-not-available" } } Write-Host "RG_AVAILABLE:$rgAvailable" ``` -------------------------------- ### List Installed .NET Runtimes Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/clr-activation-debugging/SKILL.md Query the registry to list the installed .NET Framework runtime policies, which helps in understanding which versions are available for activation. ```powershell Get-ChildItem 'Registry::HKLM\SOFTWARE\Microsoft\.NETFramework\policy' ``` -------------------------------- ### Build All Target Frameworks Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-upgrade/skills/dotnet-aot-compat/SKILL.md Execute a `dotnet build` command for a specified project file to build all its target frameworks and verify compatibility. ```bash dotnet build # builds all TFMs ``` -------------------------------- ### MSTest Metapackage Project Setup Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/writing-mstest-tests/SKILL.md Alternative setup for MSTest projects using the MSTest metapackage. Ensure the correct version is specified in your project file. ```xml net9.0 ``` -------------------------------- ### Create and Build a .NET MAUI Test Project Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/dotnet-maui-doctor/SKILL.md Verifies the .NET MAUI development environment by creating a new MAUI project, building it, and then cleaning up the temporary directory. This is a recommended step after all validation checks pass. ```bash TEMP_DIR=$(mktemp -d) dotnet new maui -o "$TEMP_DIR/MauiTest" dotnet build "$TEMP_DIR/MauiTest" rm -rf "$TEMP_DIR" ``` -------------------------------- ### Check .NET SDK Version Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-ai/skills/mcp-csharp-create/SKILL.md Verify that the .NET SDK version is 10.0 or higher. Install from https://dotnet.microsoft.com if needed. ```bash dotnet --version ``` -------------------------------- ### Compose Multi-Project Solution Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-template-engine/skills/template-instantiation/SKILL.md Demonstrates the process of creating multiple projects (API and tests) and linking them together using project references and adding them to a solution file. This is for composing complex solutions. ```bash dotnet new webapi --name MyApi --output ./src/MyApi dotnet new xunit --name MyApi.Tests --output ./tests/MyApi.Tests dotnet add ./tests/MyApi.Tests reference ./src/MyApi dotnet sln add ./src/MyApi ./tests/MyApi.Tests ``` -------------------------------- ### Install zlib in .NET 9 Container Images Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-upgrade/skills/migrate-dotnet8-to-dotnet9/references/containers-interop-dotnet8to9.md If your application has a direct dependency on the zlib system package, install it manually in your .NET 9 container images. ```dockerfile FROM mcr.microsoft.com/dotnet/aspnet:9.0 RUN apt-get update && apt-get install -y zlib1g ``` -------------------------------- ### Manually Create Directory.Packages.props Source: https://github.com/dotnet/skills/blob/main/plugins/dotnet-nuget/skills/convert-to-cpm/references/directory-packages-props.md Manually create the Directory.Packages.props file if the .NET CLI template is unavailable. Ensure `ManagePackageVersionsCentrally` is set to `true`. ```xml true ```