Visual Studio

[VS] 설치 프로그램 만들기

딸기우유중독 2024. 12. 19. 14:47

Publish

Publish시 .exe 파일 하나로 떨굼

<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile>

 

 

 

 

.exe 단일 파일 생성

 

 

Windows Service program

 




https://learn.microsoft.com/ko-kr/dotnet/core/extensions/windows-service-with-installer?tabs=wix

 

Windows 서비스 설치 프로그램 만들기 - .NET

Windows 서비스 설치 프로그램 프로젝트를 만드는 방법을 알아봅니다.

learn.microsoft.com

 


 

 

설치프로그램 어떤 방법으로 만들지 선택.

 

Wix 방법

 

Package.wxs

<?xml version="1.0" encoding="UTF-8"?>

<!-- Define the variables in "$(var.*) expressions" -->
<?define Name = "LSISDSM" ?>
<?define Manufacturer = "LSIS" ?>
<?define Version = "1.0.0.0" ?>
<?define UpgradeCode = "74a228be-c133-45a8-a958-47767b258f9c" ?>

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
	 xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
	<Package Name="$(Name)"
			  Manufacturer="$(Manufacturer)"
			  Version="$(Version)"
			  UpgradeCode="$(var.UpgradeCode)"
			  Compressed="true">

		<!--displayed icon in program or feature. 프로그램 및 기능에 표시되는 아이콘-->
		<Icon Id="LSIS.ico" SourceFile="$(SolutionDir)/LSIS.ico"/>
		<Property Id="ARPPRODUCTICON" Value="LSIS.ico" />


		<!-- Allow upgrades and prevent downgrades -->
		<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />

		<!--.cab file is embedded in the MSI-->
		<MediaTemplate EmbedCab="yes" />

		<!--C:\Program Files\LSIS ~ -->
		<StandardDirectory Id="ProgramFiles64Folder">
			<!-- Create a folder inside program files -->
			<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">

				<!-- Create a folder within the parent folder given the name -->
				<Directory Id="INSTALLFOLDER" Name="$(Name)" />
			</Directory>
		</StandardDirectory>

		<!-- The files inside this DirectoryRef are linked to
             the App.WindowsService directory via INSTALLFOLDER -->
		<DirectoryRef Id="INSTALLFOLDER">

			<!-- Create a single component which is the App.WindowsService.exe file -->
			<Component Id="ServiceExecutable" Bitness="always64">

				<!-- Copies the App.WindowsService.exe file using the
                     project reference preprocessor variables -->
				<File Id="DSM.exe"
                      Source="$(var.LS.DevSquare.Service.DSM.TargetDir)\net6.0-windows\publish\DSM.exe"
                      KeyPath="true" />

				<!-- Remove all files from the INSTALLFOLDER on uninstall -->
				<RemoveFile Id="ALLFILES" Name="*.*" On="both" />

				<!-- Tell WiX to install the Service -->
				<ServiceInstall Id="ServiceInstaller"
                                Type="ownProcess"
                                Name="LSISDSM"
                                DisplayName="LSIS DSM Service"
                                Description="A Service that archive related DevSquare Service ex)LSISTagService."
                                Start="auto"
                                ErrorControl="normal" />

				<!-- Tell WiX to start the Service -->
				<ServiceControl Id="StartService"
                                Start="install"
                                Stop="both"
                                Remove="uninstall"
                                Name="LSISDSM"
                                Wait="true" />

				<ServiceConfigFailureActions
					ServiceName="LSISDSM"
					Command="restart" 
					OnInstall="true"
					RebootMessage="Restarting the service" 
					ResetPeriod="10"/>
				
			</Component>
		</DirectoryRef>

		<!-- Tell WiX to install the files -->
		<Feature Id="DSMService" Title="LS.DevSquare.Service.DSM Setup" Level="1">
			<ComponentRef Id="ServiceExecutable" />
		</Feature>

	</Package>
</Wix>

 

 

Build (Wix Porject)

 


 

https://wixtoolset.org/docs/intro/

 

Get started with WiX | WiX Toolset

There are three ways to use WiX:

wixtoolset.org

 


 

Microsoft 설치 프로그램 방법

 

 

 

Install 폴더 우클릭

 

Apllication Folder 더블클릭

 

 

Add Output...

 

Project 선택 및 .exe items 선택 ( publish 폴더에 있는거, output폴더에 있는거)

 

 

OK

 

 

Unistall 반복

 

 


Build


 

 

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

 

 

https://learn.microsoft.com/ko-kr/visualstudio/deployment/deploying-applications-services-and-components?view=vs-2022

 

배포 소개 - Visual Studio (Windows)

Azure, 웹, 네트워크 공유, 디바이스, Microsoft Store 및 Windows 데스크톱 설치 관리자 패키지를 포함하여 Visual Studio에서 애플리케이션 배포 옵션을 살펴봅니다.

learn.microsoft.com

 

https://wixtoolset.org/docs/v3/howtos/general/install_windows_service/#step-2-configure-the-service-optional

 

How To: Install a Windows service | WiX Toolset

To install a Windows service, use the ServiceInstall

wixtoolset.org

 

 

https://www.advancedinstaller.com/create-msi-installer-with-visual-studio.html

 

How to create MSI installers with Visual Studio

In this article, we focus on how to create an MSI package for a Windows Presentation Foundation (WPF) application using Visual Studio.

www.advancedinstaller.com

 

 

https://learn.microsoft.com/ko-kr/visualstudio/deployment/deploying-applications-services-and-components?view=vs-2022

 

배포 소개 - Visual Studio (Windows)

Azure, 웹, 네트워크 공유, 디바이스, Microsoft Store 및 Windows 데스크톱 설치 관리자 패키지를 포함하여 Visual Studio에서 애플리케이션 배포 옵션을 살펴봅니다.

learn.microsoft.com

 

728x90