一键导入
dependency-management
Manage project dependencies securely with lock files, version pinning, security audits, and update strategies for NuGet, npm, and pip.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Manage project dependencies securely with lock files, version pinning, security audits, and update strategies for NuGet, npm, and pip.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Build production-ready AI agents with Microsoft Foundry and Agent Framework. Covers agent architecture, model selection, orchestration, tracing, and evaluation.
Design robust REST APIs with proper versioning, pagination, error handling, rate limiting, and OpenAPI documentation.
Structure projects for maintainability and scalability with clean architecture, separation of concerns, and consistent project layouts.
Systematic code review and audit practices including automated checks, security audits, compliance verification, and review checklists.
Manage application configuration with environment variables, Azure Key Vault, feature flags, and environment-specific settings.
Fundamental coding principles for production development including SOLID, DRY, KISS, and common design patterns with C# examples.
| name | dependency-management |
| description | Manage project dependencies securely with lock files, version pinning, security audits, and update strategies for NuGet, npm, and pip. |
Purpose: Manage project dependencies securely and reliably.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<!-- Core dependencies with versions -->
<PackageReference Include="Microsoft.AspNetCore.App" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<!-- Use exact versions for production stability -->
<PackageReference Include="Serilog" Version="[3.1.1]" />
<!-- Use version ranges for flexibility -->
<PackageReference Include="AutoMapper" Version="12.*" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<!-- Dev/Test dependencies -->
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
</ItemGroup>
</Project>
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<!-- Define versions centrally for multi-project solutions -->
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageVersion Include="Serilog" Version="3.1.1" />
<PackageVersion Include="AutoMapper" Version="12.0.1" />
<PackageVersion Include="xunit" Version="2.6.6" />
<PackageVersion Include="Moq" Version="4.20.70" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<!-- Versions managed in Directory.Packages.props -->
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Serilog" />
<PackageReference Include="AutoMapper" />
</ItemGroup>
</Project>
dotnet restore
<!-- Exact version -->
<PackageReference Include="Serilog" Version="[3.1.1]" />
<!-- Minimum version -->
<PackageReference Include="Serilog" Version="3.1.1" />
<!-- Version range -->
<PackageReference Include="Serilog" Version="[3.1.1, 4.0.0)" />
<!-- Wildcard (patch updates) -->
<PackageReference Include="Serilog" Version="3.1.*" />
<!-- Float to latest minor/patch -->
<PackageReference Include="Serilog" Version="3.*" />
# .NET Security Audit
dotnet list package --vulnerable
# Include transitive dependencies
dotnet list package --vulnerable --include-transitive
# Update vulnerable packages
dotnet add package <PackageName> --version <SafeVersion>
# Use GitHub Dependabot (for repos on GitHub)
# Create .github/dependabot.yml
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
target-branch: "main"
# NuGet uses packages.lock.json for deterministic restores
# Enable in .csproj:
<PropertyGroup>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>
# Restore and generate lock file
dotnet restore --locked-mode
# Install global tool
dotnet tool install -g dotnet-ef
# Update global tool
dotnet tool update -g dotnet-ef
# List installed tools
dotnet tool list -g
# Uninstall tool
dotnet tool uninstall -g dotnet-ef
[x.y.z] in production for stabilitypackages.lock.json for deterministic buildsdotnet list package --vulnerable<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="MyCompanyFeed" value="https://pkgs.dev.azure.com/mycompany/_packaging/myfeed/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<MyCompanyFeed>
<add key="Username" value="%AZURE_DEVOPS_USERNAME%" />
<add key="ClearTextPassword" value="%AZURE_DEVOPS_PAT%" />
</MyCompanyFeed>
</packageSourceCredentials>
</configuration>
Related Skills: