C#/WPF
[WPF] PublishSingleFile .exe 하나로
딸기우유중독
2024. 12. 19. 13:45
Profile settings 에서 설정하는게 작동이 잘 됨.
OR
<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile>
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
<RootNamespace>App.WindowsService</RootNamespace>
<OutputType>exe</OutputType>
<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.0" />
</ItemGroup>
</Project>
Publish 하면 .exe 파일 하나로 떨굼
https://learn.microsoft.com/en-us/dotnet/core/extensions/windows-service
Create Windows Service using BackgroundService - .NET
Learn how to create a Windows Service using the BackgroundService in .NET.
learn.microsoft.com
728x90