ClickOnce 배포시 Bootstrap에서 필요한 버전의 Visual C++ Redistributable 을 추가하기 위한 방법입니다.
설치된 Visual Studio 버전의 Bootstrapper\Packages 폴더안에 새로운 폴더를 생성합니다.
vs2015 기준 ( C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages )
Visual C++ redistributable 2012을 추가해보겠습니다.
기존 vcredist_x86 폴더를 복사 후 이름을 변경합니다.
product.xml 파일을 수정합니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | <? xml version = "1.0" encoding = "utf-8" ?> < Product ProductCode = "Microsoft.Visual.C++.11.0.x86" > <!-- Defines list of files to be copied on build --> < PackageFiles > < PackageFile Name = "vcredist_x86.exe" HomeSite = "VCRedistExe" /> </ PackageFiles > < InstallChecks > < MsiProductCheck Property = "VCRedistInstalled" Product = "{196BB40D-1578-3D01-B289-BEFC77A11A1E}" /> </ InstallChecks > <!-- Defines how to invoke the setup for the Visual C++ 11.0 redist --> <!-- TODO: Needs EstrimatedTempSpace, LogFile, and an update of EstimatedDiskSpace --> < Commands Reboot = "Defer" > < Command PackageFile = "vcredist_x86.exe" Arguments = ' /q:a ' > <!-- These checks determine whether the package is to be installed --> < InstallConditions > < BypassIf Property = "VCRedistInstalled" Compare = "ValueGreaterThanOrEqualTo" Value = "3" /> <!-- Block install if user does not have admin privileges --> < FailIf Property = "AdminUser" Compare = "ValueEqualTo" Value = "false" String = "AdminRequired" /> <!-- Block install on Win95 --> < FailIf Property = "Version9X" Compare = "VersionLessThan" Value = "4.10" String = "InvalidPlatformWin9x" /> <!-- Block install on NT 4 or less --> < FailIf Property = "VersionNT" Compare = "VersionLessThan" Value = "5.00" String = "InvalidPlatformWinNT" /> </ InstallConditions > < ExitCodes > < ExitCode Value = "0" Result = "Success" /> < ExitCode Value = "3010" Result = "SuccessReboot" /> < DefaultExitCode Result = "Fail" FormatMessageFromSystem = "true" String = "GeneralFailure" /> </ ExitCodes > </ Command > </ Commands > </ Product > |
InstallConditions 에서 설치 조건을 설정할 수 있습니다.
XP 일경우 조건들을 수정하거나 주석 처리해주세요.
en 폴더 안의 package.xml 파일을 수정합니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <? xml version = "1.0" encoding = "utf-8" ?> < Package Name = "DisplayName" Culture = "Culture" > <!-- Defines a localizable string table for error messages--> < Strings > < String Name = "DisplayName" >Visual C++ 2012 Runtime Libraries (x86)</ String > < String Name = "Culture" >en</ String > < String Name = "AdminRequired" >You do not have the permissions required to install Visual C++ 2012 Runtime Libraries (x86). Please contact your administrator.</ String > < String Name = "InvalidPlatformWin9x" >Installation of Visual C++ 2012 Runtime Libraries (x86) is not supported on Windows 95. Contact your application vendor.</ String > < String Name = "InvalidPlatformWinNT" >Installation of Visual C++ 2012 Runtime Libraries (x86) is not supported on Windows NT 4.0. Contact your application vendor.</ String > < String Name = "GeneralFailure" >A failure occurred attempting to install Visual C++ 2012 Runtime Libraries (x86).</ String > </ Strings > </ Package > |
설치할 프로그램을 웹에서 다운 받거나 로컬에 지정할 수 있습니다.
1. 웹에서 다운 받을 경우
VCRedistExe 의 경로를 다운 받을 주소로 변경합니다.
<String Name="VCRedistExe">http://go.microsoft.com/fwlink/?LinkID=247126&clcid=0x409</String>
<String Name="VCRedistExe">http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe</String>
다음 주소에서 각 버전의 주소를 확인할 수 있습니다.
https://npackd.appspot.com/p/com.microsoft.VisualCPPRedistributable/11.0.61030
2. 로컬 파일을 사용할 경우
product.xml 파일과 같은 위치에 해당 버전의 redistributable 파일을 다운받아 놓습니다.
product.xml 의 HomeSite를 삭제합니다.
<PackageFile Name="vcredist_x86.exe" HomeSite="VCRedistExe"/>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Visual C++ 2012 Redistributable (x86) 은 설치 여부 확인이 제대로 되지 않아서 계속 설치하는 문제가 발생하여많은 시도끝에
해결된 방안을 추가합니다.
MsiProductCheck 대신 RegistryCheck 를 사용하여 설치된 레지스트리 값을 비교하여 설치여부를 판단했습니다.
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Dependencies\{33d1fd90-4274-48a1-9bc1-97e33d9c2d6f}
product.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | <? xml version = "1.0" encoding = "utf-8" ?> < Product xmlns = "http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode = "Microsoft.Visual.C++.11.0.x86" > <!-- Defines list of files to be copied on build --> < PackageFiles CopyAllPackageFiles = "false" > < PackageFile Name = "vcredist_x86.exe" HomeSite = "VCRedistExe" Hash = "96b377a27ac5445328cbaae210fc4f0aaa750d3f" /> </ PackageFiles > < InstallChecks > <!--<MsiProductCheck Property="VCRedistInstalled"/>--> < RegistryCheck Property = "VCRedistInstalled" Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Dependencies\{33d1fd90-4274-48a1-9bc1-97e33d9c2d6f}" Value = "Version" /> </ InstallChecks > <!-- Defines how to invoke the setup for the Visual C++ 11.0 redist --> <!-- TODO: Needs EstrimatedTempSpace, LogFile, and an update of EstimatedDiskSpace --> < Commands Reboot = "Defer" > < Command PackageFile = "vcredist_x86.exe" Arguments = ' /q:a ' > <!-- These checks determine whether the package is to be installed --> < InstallConditions > < BypassIf Property = "VCRedistInstalled" Compare = "ValueEqualTo" Value = "11.0.61030.0" /> <!-- Block install if user does not have admin privileges --> < FailIf Property = "AdminUser" Compare = "ValueEqualTo" Value = "false" String = "AdminRequired" /> <!-- Block install on Win95 --> < FailIf Property = "Version9X" Compare = "VersionLessThan" Value = "4.10" String = "InvalidPlatformWin9x" /> <!-- Block install on NT 4 or less --> < FailIf Property = "VersionNT" Compare = "VersionLessThan" Value = "5.1.2" String = "InvalidPlatformWinNT" /> </ InstallConditions > < ExitCodes > < ExitCode Value = "0" Result = "Success" /> < ExitCode Value = "3010" Result = "SuccessReboot" /> < DefaultExitCode Result = "Fail" FormatMessageFromSystem = "true" String = "GeneralFailure" /> </ ExitCodes > </ Command > </ Commands > </ Product > |
package.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <? xml version = "1.0" encoding = "utf-8" ?> < Package Name = "DisplayName" Culture = "Culture" > <!-- Defines a localizable string table for error messages--> < Strings > < String Name = "DisplayName" >Visual C++ 2012 Runtime Libraries (x86)</ String > < String Name = "Culture" >en</ String > < String Name = "AdminRequired" >You do not have the permissions required to install Visual C++ 2012 Runtime Libraries (x86). Please contact your administrator.</ String > < String Name = "InvalidPlatformWin9x" >Installation of Visual C++ 2012 Runtime Libraries (x86) is not supported on Windows 95. Contact your application vendor.</ String > < String Name = "InvalidPlatformWinNT" >Installation of Visual C++ 2012 Runtime Libraries (x86) is not supported on Windows NT 4.0. Contact your application vendor.</ String > < String Name = "GeneralFailure" >A failure occurred attempting to install Visual C++ 2012 Runtime Libraries (x86).</ String > < String Name = "VCRedistExe" >http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe</ String > </ Strings > </ Package > |
reference: https://msdn.microsoft.com/ko-kr/library/ms229432.aspx
'Languages > C#' 카테고리의 다른 글
Jenkins를 통해 AWS 에 ClickOnce 배포 (0) | 2017.11.30 |
---|---|
ClickOnce Custom Publish Page (0) | 2016.12.09 |
ClickOnce Custom BootStrapper (0) | 2015.12.01 |
[ C# ] Change Audio Device (0) | 2013.08.06 |
[ C# ] FTP (4) | 2013.02.26 |