Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

(시리즈 글이 5개 있습니다.)
개발 환경 구성: 543. 애저듣보잡 - Github Workflow/Actions 소개
; https://www.sysnet.pe.kr/2/0/12541

개발 환경 구성: 545. github workflow/actions에서 빌드시 snk 파일 다루는 방법 - Encrypted secrets
; https://www.sysnet.pe.kr/2/0/12546

개발 환경 구성: 546. github workflow/actions에서 nuget 패키지 등록하는 방법
; https://www.sysnet.pe.kr/2/0/12548

개발 환경 구성: 547. github workflow/actions에서 Visual Studio Marketplace 패키지 등록하는 방법
; https://www.sysnet.pe.kr/2/0/12552

개발 환경 구성: 623. Visual Studio 2022 빌드 환경을 위한 github Actions 설정
; https://www.sysnet.pe.kr/2/0/12904




github workflow/actions에서 Visual Studio Marketplace 패키지 등록하는 방법

지난 글에 이어,

github workflow/actions에서 nuget 패키지 등록하는 방법
; https://www.sysnet.pe.kr/2/0/12548

이번에는 https://marketplace.visualstudio.com/에 패키지를 배포하는 방법에 대해 살펴보겠습니다.

이를 위한 action과,

VsixPublisher Github Action
; https://github.com/marketplace/actions/vsix-publisher

자세한 사용법을 이미 웹 상에서 찾을 수 있습니다.

Github Actions for Visual Studio Extension developers
; https://cezarypiatek.github.io/post/develop-vsextension-with-github-actions/#how-to-publish-extension-to-the-marketplace

마켓플레이스 등록을 위해 당연히 PAT(Personal Access Token)가 필요한데 https://dev.azure.com을 들어가 로그인하면 다음과 같이 토큰을 구하는 메뉴를 선택할 수 있습니다.

[그림 출처: https://code.visualstudio.com/api/working-with-extensions/publishing-extension]
vs_pat_token_1.png

해당 토큰의 Expiration은 기본값이 30일인데, 최대 1년까지 설정할 수 있으므로 편의상 변경해주고 권한은 "Marketplace"의 "Manage"를 설정해 줍니다. (처음 출력되는 기본 Scope 목록에는 "Marketplace"가 없으므로 하단의 "Show all scopes" 링크를 눌러야 합니다.)

vs_pat_token_2.png

이렇게 해서 생성한 token 값을 github repo의 Settings를 통해 "Encrypted secrets"에 등록해 줍니다. (여기서는 VSGALLERY_API_KEY 이름으로 등록했다고 가정합니다.)

자, 그럼 끝났군요. ^^ 다음과 같은 action 스크립트만 yml에 추가하는 것으로 마무리할 수 있습니다.

- name: Publish extension to Marketplace
  uses: cezarypiatek/VsixPublisherAction@0.2
  with:
    extension-file: ./XmlCodeGenerator/bin/${{env.BUILD_CONFIGURATION}}/XmlCodeGenerator.vsix
    publish-manifest-file: ./XmlCodeGenerator/publishManifest.json
    personal-access-code: ${{ secrets.VSGALLERY_API_KEY }}        

만약 기존에 vsix 파일을 marketplace.visualstudio.com을 이용해 수동으로 직접 등록했다면 아마도 publishManifest.json 파일을 한 번도 작성한 적이 없을 것입니다. 제 경우에는 대충 아래의 문서에 따라,

publishManifest file
; https://docs.microsoft.com/en-us/visualstudio/extensibility/walkthrough-publishing-a-visual-studio-extension-via-command-line?view=vs-2019#publishmanifest-file

다음과 같이 작성했습니다.

{
    "$schema": "http://json.schemastore.org/vsix-publish",
    "categories": [
        "coding"
    ],
    "identity": {
        "internalName": "XmlCodeGenerator"
    },
    "overview": "overview.md",
    "priceCategory": "free",
    "publisher": "SeongTaeJeong",
    "private": false,
    "qna": true,
    "repo": "https://github.com/stjeong/XmlCodeGenerator"
}

아무튼, 이렇게까지 준비를 마쳤으면 정상적으로 vsix가 등록될 것입니다. 실제 사용 예를 다음의 yml 파일에 적용했으니 참고하시고,

XmlCodeGenerator/.github/workflows/git-releases.yml
; https://github.com/stjeong/XmlCodeGenerator/blob/master/.github/workflows/git-releases.yml

이 와중에 경험한 오류 유형도 도움이 되실 것입니다. ^^

VsixPublisher를 이용한 등록 시 다양한 오류 유형 해결책
; https://www.sysnet.pe.kr/2/0/12549




유의할 점이 하나 있다면, Personal Access Token의 만료가 (최대) 1년 단위이기 때문에 매해 secrets.VSGALLERY_API_KEY를 갱신시켜줘야 합니다. 그런데 재미있는 것은 nuget api key와는 달리 Azure Devops의 PAT는 날짜 만료를 편집하는 것이 가능하기 때문에 만료로 인해 secrets.VSGALLERY_API_KEY까지 업데이트하기 보다는 PAT 관리 화면에서 해당 키를 "Edit" 화면으로 들어가 미리 만료 기간을 뒤로 미루는 식으로 편집해 두는 것이 더 편리합니다. (물론, 이런 것은 보안 정책 상 권장하는 방법이 아닐 수 있습니다.)

또한, nuget 패키지 등록과는 달리 cezarypiatek/VsixPublisherAction은 이미 같은 버전의 패키지가 marketplace.visualstudio.com에 등록되어 있다면 기존 버전을 엎어서 등록하는 방식으로 동작한다는 점!




참고로, "VS Code" 확장을 배포하는 action도 있습니다.

Publish VS Code Extension ? GitHub Action
; https://github.com/marketplace/actions/publish-vs-code-extension

이것을 사용해 "Visual Studio" 확장을 배포하려고 시도하면,

- name: Publish to Visual Studio Marketplace
  uses: HaaLeo/publish-vscode-extension@v0
  with:
    pat: ${{ secrets.VSGALLERY_API_KEY }}
    registryUrl: https://marketplace.visualstudio.com
    extensionFile: ./XmlCodeGenerator/bin/${{env.BUILD_CONFIGURATION}}/XmlCodeGenerator.vsix
    packagePath: ''

manifest를 찾을 수 없다는 오류 메시지가 발생합니다.

Run HaaLeo/publish-vscode-extension@v0
  with:
    pat: ***
    registryUrl: https://marketplace.visualstudio.com
    extensionFile: ./XmlCodeGenerator/bin/Release/XmlCodeGenerator.vsix
    yarn: false
    dryRun: false
  env:
    SOLUTION_FILE_PATH: .
    BUILD_CONFIGURATION: Release
Specifically, running GitHub Action HaaLeo/publish-vscode-extension@v0.3.1.
Package the Extension
  The extension was already packaged. Skip packaging.
Publish the Extension
Error: Error: Manifest not found
    at ZipFile.onEnd (D:\a\_actions\HaaLeo\publish-vscode-extension\v0\dist\index.js:73671:35)
    at Object.onceWrapper (events.js:299:28)
    at ZipFile.emit (events.js:210:5)
    at Immediate.<anonymous> (D:\a\_actions\HaaLeo\publish-vscode-extension\v0\dist\index.js:6726:12)
    at processImmediate (internal/timers.js:439:21)

왜냐하면, VSCode 확장의 manifest 파일은 package.json이고 Visual Studio 확장의 manifest 파일은 (스키마도 약간 다른) publishManifest.json이기 때문에 저런 오류가 발생하는 것입니다. 해본 것은 아니지만, 아마도 package.json을 따로 만들어 준다 해도 VSCode와 Visual Studio는 갤러리 차원에서 구분이 될 것이므로 publish-vscode-extension action을 사용할 수는 없을 것입니다.




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 6/27/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 31  32  33  34  35  [36]  37  38  39  40  41  42  43  44  45  ...
NoWriterDateCnt.TitleFile(s)
12739정성태7/28/20217361오류 유형: 746. Azure Active Directory - IDW10106: The 'ClientId' option must be provided.
12738정성태7/28/20217963오류 유형: 745. Azure Active Directory - Client credential flows must have a scope value with /.default suffixed to the resource identifier (application ID URI).
12737정성태7/28/20216918오류 유형: 744. Azure Active Directory - The resource principal named api://...[client_id]... was not found in the tenant
12736정성태7/28/20217468오류 유형: 743. Active Azure Directory에서 "API permissions"의 권한 설정이 "Not granted for ..."로 나오는 문제
12735정성태7/27/20217983.NET Framework: 1081. C# - Azure AD 인증을 지원하는 데스크톱 애플리케이션 예제(Windows Forms) [2]파일 다운로드1
12734정성태7/26/202123942스크립트: 20. 특정 단어로 시작하거나/끝나는 문자열을 포함/제외하는 정규 표현식 - Look-around
12733정성태7/23/202111214.NET Framework: 1081. Self-Contained/SingleFile 유형의 .NET Core/5+ 실행 파일을 임베딩한다면? [1]파일 다운로드2
12732정성태7/23/20216530오류 유형: 742. SharePoint - The super user account utilized by the cache is not configured.
12731정성태7/23/20217724개발 환경 구성: 584. Add Internal URLs 화면에서 "Save" 버튼이 비활성화 된 경우
12730정성태7/23/20219237개발 환경 구성: 583. Visual Studio Code - Go 코드에서 입력을 받는 경우
12729정성태7/22/20218193.NET Framework: 1080. xUnit 단위 테스트에 메서드/클래스 수준의 문맥 제공 - Fixture
12728정성태7/22/20217643.NET Framework: 1079. MSTestv2 단위 테스트에 메서드/클래스/어셈블리 수준의 문맥 제공
12727정성태7/21/20218651.NET Framework: 1078. C# 단위 테스트 - MSTestv2/NUnit의 Assert.Inconclusive 사용법(?) [1]
12726정성태7/21/20218469VS.NET IDE: 169. 비주얼 스튜디오 - 단위 테스트 선택 시 MSTestv2 외의 xUnit, NUnit 사용법 [1]
12725정성태7/21/20217165오류 유형: 741. Failed to find the "go" binary in either GOROOT() or PATH
12724정성태7/21/20219912개발 환경 구성: 582. 윈도우 환경에서 Visual Studio Code + Go (Zip) 개발 환경 [1]
12723정성태7/21/20217540오류 유형: 740. SharePoint - Alternate access mappings have not been configured 경고
12722정성태7/20/20217351오류 유형: 739. MSVCR110.dll이 없어 exe 실행이 안 되는 경우
12721정성태7/20/20217959오류 유형: 738. The trust relationship between this workstation and the primary domain failed. - 세 번째 이야기
12720정성태7/19/20217329Linux: 43. .NET Core/5+ 응용 프로그램의 Ubuntu (Debian) 패키지 준비
12719정성태7/19/20216509오류 유형: 737. SharePoint 설치 시 "0x800710D8 The object identifier does not represent a valid object." 오류 발생
12718정성태7/19/20217085개발 환경 구성: 581. Windows에서 WSL로 파일 복사 시 root 소유권으로 적용되는 문제파일 다운로드1
12717정성태7/18/20217040Windows: 195. robocopy에서 파일의 ADS(Alternate Data Stream) 정보 복사를 제외하는 방법
12716정성태7/17/20217867개발 환경 구성: 580. msbuild의 Exec Task에 robocopy를 사용하는 방법파일 다운로드1
12715정성태7/17/20219503오류 유형: 736. Windows - MySQL zip 파일 버전의 "mysqld --skip-grant-tables" 실행 시 비정상 종료 [1]
12714정성태7/16/20218280오류 유형: 735. VCRUNTIME140.dll, MSVCP140.dll, VCRUNTIME140.dll, VCRUNTIME140_1.dll이 없어 exe 실행이 안 되는 경우
... 31  32  33  34  35  [36]  37  38  39  40  41  42  43  44  45  ...