Skip to content

Commit a71049c

Browse files
avimraAlexUstinov
authored andcommitted
Create/overwrite NuGet.Config file before publishing and delete after this.
1 parent f4ca51b commit a71049c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Publish/NuGetPublish.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@
5252
<!-- If package-lock.json has changed, perform an NPM install -->
5353
<Target Name="PublishToNuget" AfterTargets="Pack" DependsOnTargets="Pack">
5454
<Message Importance="high" Text="Publish nupkg %(NugetPublishInput.Identity) to server" />
55-
<Exec Command="dotnet nuget add source $(DoNugetFeedUrl) --username $(DoNugetFeedUserName) --password $(DoNugetFeedPassword) --store-password-in-clear-text" WorkingDirectory="$(SolutionDir)_Build\Release\packages" />
55+
<!-- Create empty valid NuGet.Config file and add credentials there -->
56+
<WriteLinesToFile File="$(SolutionDir)_Build\Release\packages\NuGet.Config" Lines="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;configuration&gt;&lt;/configuration&gt;" Overwrite="True" />
57+
<Exec Command="dotnet nuget add source $(DoNugetFeedUrl) --username $(DoNugetFeedUserName) --password $(DoNugetFeedPassword) --store-password-in-clear-text --configfile NuGet.Config" WorkingDirectory="$(SolutionDir)_Build\Release\packages" />
58+
<!-- Push packages using credentials from NuGet.Config file and then delete NuGet.Config -->
5659
<Exec Command="dotnet nuget push %(NugetPublishInput.Identity) --force-english-output --timeout 60 --api-key az --source $(DoNugetFeedUrl)" WorkingDirectory="$(SolutionDir)_Build\Release\packages" />
60+
<Delete Files="$(SolutionDir)_Build\Release\packages\NuGet.Config" />
5761
</Target>
5862
</Project>

0 commit comments

Comments
 (0)