본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)5.8k · #14605

msbuild-modernization

하는 일

이 스킬은 오래된 .NET 프로젝트 파일을 현대화합니다. 더 짧은 SDK 형식으로 바꾸고, 패키지와 공유 설정을 새 형식으로 옮깁니다. 길고 오래된 프로젝트 파일을 단순하게 만들고 싶은 팀을 위한 스킬입니다.

사용하는 경우

  • ✓.csproj 파일이 길고 오래된 형식이어서 파일 목록을 명시하고 ToolsVersion 속성이 있을 때.
  • ✓프로젝트가 여전히 packages.config를 쓰고 PackageReference로 옮겨야 할 때.
  • ✓여러 프로젝트에 반복되는 공유 설정을 Directory.Build.props로 옮겨야 할 때.

스킬 링크

https://github.com/dotnet/skills/blob/main/plugins/dotnet-msbuild/skills/msbuild-modernization/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/dotnet/skills/blob/main/plugins/dotnet-msbuild/skills/msbuild-modernization/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 .NET Framework 프로젝트 파일이 100줄을 넘고 모든 C# 파일을 나열합니다. 최신 형식으로 바꿔 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트가 오래된 표시를 찾고, 자동 파일 포함을 쓰는 SDK 형식으로 프로젝트를 다시 쓰며, 패키지와 공유 설정을 최신 위치로 옮깁니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

MSBuild Modernization: Legacy to SDK-style Migration

Identifying Legacy vs SDK-style Projects

Legacy indicators:

  • <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • Explicit file lists (<Compile Include="..." /> for every .cs file)
  • ToolsVersion attribute on <Project> element
  • packages.config file present
  • Properties\AssemblyInfo.cs with assembly-level attributes

SDK-style indicators:

  • <Project Sdk="Microsoft.NET.Sdk"> attribute on root element
  • Minimal content — a simple project may be 10–15 lines
  • No explicit file includes (implicit globbing)
  • <PackageReference> items instead of packages.config

Quick check: if a .csproj is more than 50 lines for a simple class library or console app, it is likely legacy format.

<!-- Legacy: ~80+ lines for a simple library -->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <OutputType>Library</OutputType>
    <RootNamespace>MyLibrary</RootNamespace>
    <AssemblyName>MyLibrary</AssemblyName>
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <Deterministic>true</Deterministic>
  </PropertyGroup>
  <!-- ... 60+ more lines ... -->
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
<!-- SDK-style: ~8 lines for the same library -->
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
  </PropertyGroup>
</Project>

Migration Checklist: Legacy → SDK-style

Step 1: Replace Project Root Element

BEFORE:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
          Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <!-- ... project content ... -->
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

AFTER:

<Project Sdk="Microsoft.NET.Sdk">
  <!-- ... project content ... -->
</Project>

Remove the XML declaration, ToolsVersion, xmlns, and both <Import> lines. The Sdk attribute replaces all of them.

Step 2: Set TargetFramework

BEFORE:

<PropertyGroup>
  <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
</PropertyGroup>

AFTER:

<PropertyGroup>
  <TargetFramework>net472</TargetFramework>
</PropertyGroup>

TFM mapping table:

Legacy TargetFrameworkVersion SDK-style TargetFramework
v4.6.1 net461
v4.7.2 net472
v4.8 net48
(migrating to .NET 6) net6.0
(migrating to .NET 8) net8.0

Step 3: Remove Explicit File Includes

BEFORE:

<ItemGroup>
  <Compile Include="Controllers\HomeController.cs" />
  <Compile Include="Models\User.cs" />
  <Compile Include="Models\Order.cs" />
  <Compile Include="Services\AuthService.cs" />
  <Compile Include="Services\OrderService.cs" />
  <Compile Include="Properties\AssemblyInfo.cs" />
  <!-- ... 50+ more lines ... -->
</ItemGroup>
<ItemGroup>
  <Content Include="Views\Home\Index.cshtml" />
  <Content Include="Views\Shared\_Layout.cshtml" />
  <!-- ... more content files ... -->
</ItemGroup>

AFTER:

Delete all of these <Compile> and <Content> item groups entirely. SDK-style projects include them automatically via implicit globbing.

Exception: keep explicit entries only for files that need special metadata or reside outside the project directory:

<ItemGroup>
  <Content Include="..\shared\config.json" Link="config.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

Step 4: Remove AssemblyInfo.cs

BEFORE (Properties\AssemblyInfo.cs):

using System.Reflection;
using System.Runtime.InteropServices;

[assembly: Assembl
자주 묻는 질문

제 프로젝트가 오래된 것인지 어떻게 알 수 있나요?

ToolsVersion 속성, 모든 소스 파일의 목록, packages.config 파일이 흔한 신호입니다.

수동 AssemblyInfo 파일을 지우나요?

속성이 자동으로 생성되는 경우에는 지울 수 있으니, 커밋하기 전에 결과를 검토하세요.

중앙 패키지 관리와 같은 건가요?

아니요. 중앙 패키지 관리는 버전 번호를 한곳에 모으는 별도의 스킬입니다.

상세 정보

작성자의 원본 설명

Guide for modernizing and migrating MSBuild project files to SDK-style format. USE FOR: converting legacy .csproj/.vbproj with verbose XML to SDK-style, migrating packages.config to PackageReference, removing Properties/AssemblyInfo.cs in favor of auto-generation, eliminating explicit Compile Include lists via implicit globbing, consolidating shared settings into Directory.Build.props. Indicators of legacy projects: ToolsVersion attribute, an Import of Microsoft.CSharp.targets via $(MSBuildToolsPath), .csproj files over 50 lines for simple projects. DO NOT USE FOR: projects already in SDK-styl

repo: dotnet/skills

인기도

GitHub 스타
5.8k
순위
#14605
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬