Code/C#

C# .NET 5.0 단일 파일로 빌드

Segel 2021. 7. 24. 18:33

문제:

    VS2019의 Publish 창의 옵션에서 Produce single file을 선택해도 몇몇 dll이 따로 밖에 나와있음

해결:

    프로젝트 파일(.csproj)의 PropertyGroup에 <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> 추가

예시:

<PropertyGroup>
	<OutputType>Exe</OutputType>
	<TargetFramework>net5.0</TargetFramework>
	<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
</PropertyGroup>

 

반응형