본문 바로가기

C#/예제 코드

c# 특정 폴더 컴파일 제외 .csproj 수정

사전지식

때때로 컴파일이 안됬으면 하는 cs파일이 있기 마련이다.


실습

.csproj 파일

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net6.0</TargetFramework>
        <LangVersion>10.0</LangVersion>
    </PropertyGroup>

    <ItemGroup>
        <Compile Remove="Views\**" />
    </ItemGroup>

</Project>

설명

Views 폴더에 있는 cs파일은 컴파일 대상에서 제외된다.