CI를 젠킨스로 하게 되면서 빌드 뿐만 아니라 배포까지 넣게 되었는데 VisualStudio 에서 배포 옵션으로 설정한 배포 웹페이지는 msbuild 로는 생성이 되지 않아서 자료를 찾던 중 커스텀하게 만들 수 있는 방법을 찾게 되었습니다.
원문: https://wallism.wordpress.com/2009/12/08/clickonce-creating-publish-page-from-msbuild/
간단하게 요약하면
1. 템플릿으로 사용할 html 을 만들어 프로젝트에 포함합니다. ( 프로젝트내 Publish 폴더를 만들어 포함했습니다. )
한글로 변환한 템플릿 첨부합니다.
2. .targets 파일을 만들어 프로젝트에 포함합니다. ( Publish.targets 이름으로 만들었습니다. )
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 | <Project ToolsVersion= "14.0" DefaultTargets= "Build" xmlns= "http://schemas.microsoft.com/developer/msbuild/2003" > <PropertyGroup> <PublishFilePath>$(MSBuildProjectDirectory)\$(PublishDir)index.html</PublishFilePath> </PropertyGroup> <ItemGroup> <Tokens Include= "PublisherName" > <ReplacementValue>$(PublisherName)</ReplacementValue> <Visible> false </Visible> </Tokens> <Tokens Include= "ProductName" > <ReplacementValue>$(ProductName)</ReplacementValue> <Visible> false </Visible> </Tokens> <Tokens Include= "ApplicationVersion" > <ReplacementValue>$(ApplicationVersion)</ReplacementValue> <Visible> false </Visible> </Tokens> <Tokens Include= "Prerequsites" > <ReplacementValue>@(BootstrapperPackage-> '<li>%(ProductName)</li>' , '%0D%0A' )</ReplacementValue> <Visible> false </Visible> </Tokens> <Tokens Include= "Username" > <ReplacementValue>$(Username)</ReplacementValue> <Visible> false </Visible> </Tokens> </ItemGroup> <Target Name= "AfterPublish" > <Time Format= "dd/MM/yyyy HH:mm" > <Output TaskParameter= "FormattedTime" PropertyName= "PublishTime" /> </Time> <!-- Finalise the publish.htm template file and copy it to the publish location --> <TemplateFile Template= "Publish\index.template.html" Tokens= "@(Tokens)" OutputFilename= "$(PublishFilePath)" /> <FileUpdate Files= "$(PublishFilePath)" Regex= "\${PublishTime}" ReplacementText= "$(PublishTime)" /> </Target> </Project> |
3. nuget 으로 MSBuildTasks를 설치합니다.
4. 프로젝트를 편집으로 바꿔서 만든 .targets 파일을 포함합니다. (맨 밑줄에 넣었습니다. )
1 | <Import Project= "Publish.targets" /> |
5. msbuild로 테스트 해보면 다음과 같이 생성됩니다.
msbuild /t:Publish /p:Configuration=Release
'Languages > C#' 카테고리의 다른 글
Jenkins를 통해 AWS 에 ClickOnce 배포 (0) | 2017.11.30 |
---|---|
ClickOnce Custom Bootstrap ( Visual C++ redistributable ) (2) | 2016.02.23 |
ClickOnce Custom BootStrapper (0) | 2015.12.01 |
[ C# ] Change Audio Device (0) | 2013.08.06 |
[ C# ] FTP (4) | 2013.02.26 |