<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nuget 彙整 - 泰克哪裡去</title>
	<atom:link href="https://tech.uccu.website/tag/nuget/feed" rel="self" type="application/rss+xml" />
	<link>https://tech.uccu.website/tag/nuget</link>
	<description>一個科技相關的隨手記錄網站</description>
	<lastBuildDate>Sat, 17 Sep 2022 20:47:14 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
<site xmlns="com-wordpress:feed-additions:1">119574712</site>	<item>
		<title>【2021鐵人賽】Artifacts應用：讓外部合作夥伴也可以從Private nuget安裝Package</title>
		<link>https://tech.uccu.website/2021ironman-day16-set-private-nuget-permissions.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=2021ironman-day16-set-private-nuget-permissions</link>
					<comments>https://tech.uccu.website/2021ironman-day16-set-private-nuget-permissions.html#respond</comments>
		
		<dc:creator><![CDATA[鳴人]]></dc:creator>
		<pubDate>Tue, 28 Sep 2021 15:32:34 +0000</pubDate>
				<category><![CDATA[2021鐵人賽]]></category>
		<category><![CDATA[Azure DevOps]]></category>
		<category><![CDATA[iThome鐵人賽]]></category>
		<category><![CDATA[資訊科技]]></category>
		<category><![CDATA[2021ironman]]></category>
		<category><![CDATA[azure devops]]></category>
		<category><![CDATA[nuget]]></category>
		<guid isPermaLink="false">https://tech.uccu.website/?p=1046</guid>

					<description><![CDATA[<p>Azure DevOps Artifacts讓我們可以擁有自己的nuget套件庫，但是如果需要讓組織外的成員能夠存取的話，是否需要額外購買Basic的授權呢？實際上只要透過Azure AD邀請對方成為來賓身份，就可以設定存取權限了唷！</p>
<p>這篇文章 <a href="https://tech.uccu.website/2021ironman-day16-set-private-nuget-permissions.html">【2021鐵人賽】Artifacts應用：讓外部合作夥伴也可以從Private nuget安裝Package</a> 最早出現於 <a href="https://tech.uccu.website">泰克哪裡去</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>前面幾篇文章都在提Azure DevOps Artifacts，也就是如何利用這個服務來達成私有化的nuget套件庫。雖然私有的套件庫可以不需要將公司專案的package上傳到網路公開的nuget.org，但是如果是有部份外包的專案，或是有外部合作夥伴的時候，要如何讓他們也可以存取私有的套件庫呢？</p>



<p>前面的「<a href="https://tech.uccu.website/2021ironman-day11-artifact-intro.html" target="_blank" rel="noreferrer noopener">Azure DevOps Artifacts簡介</a>」文章中提到，Azure DevOps Artifacts feed有分為Organization範圍與Project範圍的feed，Project範圍的自然就是Azure DevOps中建立的Project裡面的成員才能存取，Organization的存取權限範圍則是比Project還大，在組織中的成員都可以存取，而在Create new feed對話框內的Visibility選項中更看到了Azure Active Directory關鍵字：</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="459" height="628" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/ec230d46-artifacts-createnewfeed.png?resize=459%2C628&#038;ssl=1" alt="" class="wp-image-1076" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/ec230d46-artifacts-createnewfeed.png?w=459&amp;ssl=1 459w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/ec230d46-artifacts-createnewfeed.png?resize=219%2C300&amp;ssl=1 219w" sizes="(max-width: 459px) 100vw, 459px" /></figure></div>



<p>看到Azure Active Directory(AAD)就好辦了，我們可以將外部的成員加入到AAD裡面作為來賓身份，之後就可以在Azure DevOps Artifact feed裡面去設定他的權限。(這邊可能需要擁有Azure Portal的部份功能權限的帳號才能操作)</p>



<p>首先進到<a href="https://portal.azure.com/#home" target="_blank" rel="noreferrer noopener">Azure Portal的畫面</a>，接著找到Azure Active Directory服務：</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" decoding="async" width="81" height="80" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/ba5050d1-aad-icon.png?resize=81%2C80&#038;ssl=1" alt="" class="wp-image-1055"/></figure></div>



<p>為了管理方便，可以先新增一個群組，之後再加入外部的使用者：</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" decoding="async" width="475" height="364" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/f07921b7-aad-adduserandgroup.png?resize=475%2C364&#038;ssl=1" alt="" class="wp-image-1058" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/f07921b7-aad-adduserandgroup.png?w=475&amp;ssl=1 475w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/f07921b7-aad-adduserandgroup.png?resize=300%2C230&amp;ssl=1 300w" sizes="(max-width: 475px) 100vw, 475px" /></figure></div>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="679" height="496" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/6cdb3ce2-aad-addgroup-nugetreader.png?resize=679%2C496&#038;ssl=1" alt="" class="wp-image-1061" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/6cdb3ce2-aad-addgroup-nugetreader.png?w=679&amp;ssl=1 679w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/6cdb3ce2-aad-addgroup-nugetreader.png?resize=300%2C219&amp;ssl=1 300w" sizes="auto, (max-width: 679px) 100vw, 679px" /></figure></div>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="718" height="786" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/71532b39-aad-adduser1.png?resize=718%2C786&#038;ssl=1" alt="" class="wp-image-1064" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/71532b39-aad-adduser1.png?w=718&amp;ssl=1 718w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/71532b39-aad-adduser1.png?resize=274%2C300&amp;ssl=1 274w" sizes="auto, (max-width: 718px) 100vw, 718px" /></figure></div>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="705" height="519" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/89ce69d8-aad-adduser2.png?resize=705%2C519&#038;ssl=1" alt="" class="wp-image-1067" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/89ce69d8-aad-adduser2.png?w=705&amp;ssl=1 705w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/89ce69d8-aad-adduser2.png?resize=300%2C221&amp;ssl=1 300w" sizes="auto, (max-width: 705px) 100vw, 705px" /></figure></div>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="560" height="889" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/21f50b87-aad-addusertogroup.png?resize=560%2C889&#038;ssl=1" alt="" class="wp-image-1070" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/21f50b87-aad-addusertogroup.png?w=560&amp;ssl=1 560w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/21f50b87-aad-addusertogroup.png?resize=189%2C300&amp;ssl=1 189w" sizes="auto, (max-width: 560px) 100vw, 560px" /></figure></div>



<p>從AAD建立完群組並且加入使用者之後，並不能直接在Artifact feed的Permissions裡面去選擇AAD的群組來加入，必須要在Project或Organization的Permissions設定中去新增一個Group(或用現有的Group)把上面建立的AAD Group(NugetReader)加入：</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="769" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/844c20f7-projsettings-addnewgroupforaadgroup-1024x769.png?resize=1024%2C769&#038;ssl=1" alt="" class="wp-image-1079" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/844c20f7-projsettings-addnewgroupforaadgroup.png?resize=1024%2C769&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/844c20f7-projsettings-addnewgroupforaadgroup.png?resize=300%2C225&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/844c20f7-projsettings-addnewgroupforaadgroup.png?resize=768%2C577&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/844c20f7-projsettings-addnewgroupforaadgroup.png?w=1032&amp;ssl=1 1032w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure></div>



<p>這裡為了方便區別，所以特別在Group名稱上使用不同的名字。在Project或Organization設定裡把AAD Group加入之後，再到Artifact feed的Permissions裡面把Project或Organization的Group加到Artifact feed裡面：</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="975" height="373" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/f848cd2f-artifacts-feedsettings-permissions-addexternalcoworkergroup.png?resize=975%2C373&#038;ssl=1" alt="" class="wp-image-1082" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/f848cd2f-artifacts-feedsettings-permissions-addexternalcoworkergroup.png?w=975&amp;ssl=1 975w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/f848cd2f-artifacts-feedsettings-permissions-addexternalcoworkergroup.png?resize=300%2C115&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/f848cd2f-artifacts-feedsettings-permissions-addexternalcoworkergroup.png?resize=768%2C294&amp;ssl=1 768w" sizes="auto, (max-width: 975px) 100vw, 975px" /></figure></div>



<p>完成之後就可以請對方試試看在VS裡面是否能夠搜尋得到nuget package了。當然，也要一併提供給對方feed連線的url，如同<a href="https://tech.uccu.website/2021ironman-day12-push-first-package-to-artifact-feed.html" target="_blank" rel="noreferrer noopener">前面文章</a>提到的(Connect to feed裡的提示)，請對方在VS的Package Manager Settings設定Package source之後，第一次瀏覽應該會出現登入畫面(別忘了先收Email完成確認邀請動作)：</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="630" height="684" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/1e6cd1bc-vs-loginprivatenuget.png?resize=630%2C684&#038;ssl=1" alt="" class="wp-image-1085" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/1e6cd1bc-vs-loginprivatenuget.png?w=630&amp;ssl=1 630w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/1e6cd1bc-vs-loginprivatenuget.png?resize=276%2C300&amp;ssl=1 276w" sizes="auto, (max-width: 630px) 100vw, 630px" /></figure></div>



<p>登入之後應該就可以成功看到Artifact feed上面的Package了：</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="692" height="176" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/7baea54a-vs-listprivatenugetpackages.png?resize=692%2C176&#038;ssl=1" alt="" class="wp-image-1088" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/7baea54a-vs-listprivatenugetpackages.png?w=692&amp;ssl=1 692w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/7baea54a-vs-listprivatenugetpackages.png?resize=300%2C76&amp;ssl=1 300w" sizes="auto, (max-width: 692px) 100vw, 692px" /></figure></div>
<p>這篇文章 <a href="https://tech.uccu.website/2021ironman-day16-set-private-nuget-permissions.html">【2021鐵人賽】Artifacts應用：讓外部合作夥伴也可以從Private nuget安裝Package</a> 最早出現於 <a href="https://tech.uccu.website">泰克哪裡去</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://tech.uccu.website/2021ironman-day16-set-private-nuget-permissions.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1046</post-id>	</item>
		<item>
		<title>【2021鐵人賽】Pipeline與Artifacts應用：Build nuget package上傳到Private nuget</title>
		<link>https://tech.uccu.website/2021ironman-day13-create-build-nuget-package-pipeline.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=2021ironman-day13-create-build-nuget-package-pipeline</link>
					<comments>https://tech.uccu.website/2021ironman-day13-create-build-nuget-package-pipeline.html#respond</comments>
		
		<dc:creator><![CDATA[鳴人]]></dc:creator>
		<pubDate>Sat, 25 Sep 2021 15:31:33 +0000</pubDate>
				<category><![CDATA[2021鐵人賽]]></category>
		<category><![CDATA[Azure DevOps]]></category>
		<category><![CDATA[iThome鐵人賽]]></category>
		<category><![CDATA[資訊科技]]></category>
		<category><![CDATA[2021ironman]]></category>
		<category><![CDATA[azure devops]]></category>
		<category><![CDATA[nuget]]></category>
		<guid isPermaLink="false">https://tech.uccu.website/?p=923</guid>

					<description><![CDATA[<p>這篇文章利用前面介紹過的建立共用的Build Pipeline內容為基底，以及前一篇文章中已經在C#專案中勾選Generate NuGet package on build屬性，編譯時會自動產生nupkg檔案，這裡再加上新的Task將nupkg檔案Push上去。</p>
<p>這篇文章 <a href="https://tech.uccu.website/2021ironman-day13-create-build-nuget-package-pipeline.html">【2021鐵人賽】Pipeline與Artifacts應用：Build nuget package上傳到Private nuget</a> 最早出現於 <a href="https://tech.uccu.website">泰克哪裡去</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p><a href="https://tech.uccu.website/2021ironman-day12-push-first-package-to-artifact-feed.html" target="_blank" rel="noreferrer noopener">前一篇</a>內容設定了C#專案裡的Generate NuGet package on build，讓專案編譯的時候自動產生nupkg檔案，接著手動使用cli工具將nupkg檔案push到Azure DevOps Artifacts，這篇就來看看如何將這些動作設計在Pipeline裡面吧！</p>



<p>這邊直接借用前面文章「<a href="https://tech.uccu.website/2021ironman-day10-create-a-common-use-build-pipeline.html" target="_blank" rel="noreferrer noopener">CI/CD從這裡：第2個Pipeline，建立共用的Build Pipeline</a>」裡的yaml內容開始，同樣建立新的Pipeline，選擇Starter範本，然後用前面文章的Yaml內容複製過來修改，前面文章的Yaml內容如下：</p>



<pre class="wp-block-prismatic-blocks"><code class="language-yaml"># Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- none

pool:
  vmImage: ubuntu-latest

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: &#039;build&#039;
    projects: &#039;$(ProjectName)/*.csproj&#039;
    arguments: &#039;-o $(Build.BinariesDirectory)&#039;
- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: &#039;$(Build.BinariesDirectory)&#039;
    includeRootFolder: false
    archiveType: &#039;zip&#039;
    archiveFile: &#039;$(Build.ArtifactStagingDirectory)/$(ProjectName)-$(Build.BuildId).zip&#039;
    replaceExistingArchive: true
- task: PublishPipelineArtifact@1
  inputs:
    targetPath: &#039;$(Build.ArtifactStagingDirectory)&#039;
    artifact: &#039;BuildOutputFiles&#039;
    publishLocation: &#039;pipeline&#039;</code></pre>



<p>在Yaml內容最下面空白的地方，同樣選擇.NET Core task，Command的選項則改為選擇nuget push，第二個Path to NuGet package(s) to publish的設定預設是從$(Build.ArtifactStagingDirectory)資料夾內去尋找nupkg檔案(如下圖中的預設值)，下面的Target feed location如果是有push到其它地方選擇第二個，但是我們是要push到自己的Artifact feed，所以可以直接從下面的選單下拉選擇即可：</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="344" height="494" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/8a20e656-tasksettings-dotnetcore-nugetpush.png?resize=344%2C494&#038;ssl=1" alt="" class="wp-image-929" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/8a20e656-tasksettings-dotnetcore-nugetpush.png?w=344&amp;ssl=1 344w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/8a20e656-tasksettings-dotnetcore-nugetpush.png?resize=209%2C300&amp;ssl=1 209w" sizes="auto, (max-width: 344px) 100vw, 344px" /></figure></div>



<p>不過因為我們第一個task已經設定build的時候輸出的位置是在$(Build.BinariesDirectory)，所以nupkg檔案也會在那裡，所以設定的內容要改一下，改成$(Build.BinariesDirectory)/*.nupkg，最後完成的全部Yaml內容如下：</p>



<pre class="wp-block-prismatic-blocks"><code class="language-yaml"># Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- none

pool:
  vmImage: ubuntu-latest

steps:
- task: DotNetCoreCLI@2
  displayName: Build C# Project
  inputs:
    command: &#039;build&#039;
    projects: &#039;$(ProjectName)/*.csproj&#039;
    arguments: &#039;-o $(Build.BinariesDirectory)&#039;
- task: ArchiveFiles@2
  displayName: Zip output files
  inputs:
    rootFolderOrFile: &#039;$(Build.BinariesDirectory)&#039;
    includeRootFolder: false
    archiveType: &#039;zip&#039;
    archiveFile: &#039;$(Build.ArtifactStagingDirectory)/$(ProjectName)-$(Build.BuildId).zip&#039;
    replaceExistingArchive: true
- task: PublishPipelineArtifact@1
  displayName: Publish files to pipeline artifacts
  inputs:
    targetPath: &#039;$(Build.ArtifactStagingDirectory)&#039;
    artifact: &#039;BuildOutputFiles&#039;
    publishLocation: &#039;pipeline&#039;
- task: DotNetCoreCLI@2
  displayName: Push Nuget package
  inputs:
    command: &#039;push&#039;
    packagesToPush: &#039;$(Build.BinariesDirectory)/*.nupkg&#039;
    nuGetFeedType: &#039;internal&#039;
    publishVstsFeed: &#039;15523482-96ea-4d9f-83bf-a57fc10e79ce&#039;</code></pre>



<p>因為Task變多了，所以我也在每個Task加上了displayName屬性，這個在前面的文章有提過，如果忘了可以往前面翻閱先前的文章內容喔！</p>



<p>另外，新建立的Pipeline也別忘了設定Variables，Yaml中的ProjectName需要設定，也是<a href="https://tech.uccu.website/2021ironman-day10-create-a-common-use-build-pipeline.html" target="_blank" rel="noreferrer noopener">前面的文章</a>有提過，其它的像是更改Pipeline名稱與Pipeline yaml檔名的這些動作就不再耗費篇幅重述了唷！</p>



<p>接著在執行Pipeline的時候會碰到下面兩個問題，其中一個是Organization層級的Artifacts feed權限設定的問題，從Push的Task log中會看到下圖紅框中的訊息，代號403：</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="272" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/e9194622-error-buildnugetpackage-push403-1024x272.png?resize=1024%2C272&#038;ssl=1" alt="" class="wp-image-932" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/e9194622-error-buildnugetpackage-push403.png?resize=1024%2C272&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/e9194622-error-buildnugetpackage-push403.png?resize=300%2C80&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/e9194622-error-buildnugetpackage-push403.png?resize=768%2C204&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/e9194622-error-buildnugetpackage-push403.png?w=1288&amp;ssl=1 1288w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure></div>



<p>這時候就需要去Artifact feed的Permissions設定中點選Allow project-scoped builds，將Project的Build Service加入(忘了從哪進入的請參考<a href="https://tech.uccu.website/2021ironman-day11-artifact-intro.html" target="_blank" rel="noreferrer noopener">前面的文章</a>)：</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="897" height="295" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/25a2bb9a-artifacts-feedsettings-permissions-allowprojectscopedbuilds.png?resize=897%2C295&#038;ssl=1" alt="" class="wp-image-935" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/25a2bb9a-artifacts-feedsettings-permissions-allowprojectscopedbuilds.png?w=897&amp;ssl=1 897w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/25a2bb9a-artifacts-feedsettings-permissions-allowprojectscopedbuilds.png?resize=300%2C99&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/25a2bb9a-artifacts-feedsettings-permissions-allowprojectscopedbuilds.png?resize=768%2C253&amp;ssl=1 768w" sizes="auto, (max-width: 897px) 100vw, 897px" /></figure></div>



<p>加入之後再重新執行一次Pipeline，這時候就會碰到下面的這個問題，同樣是Push的Task log中所列出紅框中代號409的錯誤訊息：</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="305" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/82583f70-error-buildnugetpackage-push409-1024x305.png?resize=1024%2C305&#038;ssl=1" alt="" class="wp-image-938" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/82583f70-error-buildnugetpackage-push409.png?resize=1024%2C305&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/82583f70-error-buildnugetpackage-push409.png?resize=300%2C89&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/82583f70-error-buildnugetpackage-push409.png?resize=768%2C229&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2021/09/82583f70-error-buildnugetpackage-push409.png?w=1226&amp;ssl=1 1226w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure></div>



<p>這個問題是因為Artifact feed中對於ModuleBase這個Package已經存在了相同的版本(此例為1.0.1)，相同的版本號並不會使用最新的去覆蓋先前的版本，因為這樣子沒有意義，雖然Package內容可能有更新了，但是相同的版本號對於使用者來說是沒有更新的。</p>



<p>可是…難不成每一次要執行Pipeline之前，都需要先將C#專案中的版本號手動更新之後Commit到Git Repo裡面再來執行這個Pipeline讓它去Push nuget package嗎？都要手動改版本號了，那我順便利用cli再把新的package push上去不就得了？</p>



<p>沒錯，要弄這個Pipeline就是不要這麼麻煩，所以這篇文章的錯誤只是為了引導後面的文章內容，接下來的文章將會說明如何在Pipeline中修改版本號。</p>
<p>這篇文章 <a href="https://tech.uccu.website/2021ironman-day13-create-build-nuget-package-pipeline.html">【2021鐵人賽】Pipeline與Artifacts應用：Build nuget package上傳到Private nuget</a> 最早出現於 <a href="https://tech.uccu.website">泰克哪裡去</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://tech.uccu.website/2021ironman-day13-create-build-nuget-package-pipeline.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">923</post-id>	</item>
	</channel>
</rss>
