Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Publish/NuGetPublish.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<NoBuild>true</NoBuild>
Expand All @@ -20,7 +20,8 @@
<!-- Force Release Configuration build and check env variables / User.Directory.Build.props -->
<Target Name="_CheckConfiguration" BeforeTargets="CoreBuild">
<Error Condition="'$(Configuration)' != 'Release'" Text="You should build this project only in 'Release' configuration. Use `dotnet build -c Release`" />
<Error Condition="'$(DoNugetFeedApiKey)' == ''" Text="You should set 'DoNugetFeedApiKey' property in User.Directory.Build.props or in env variable" />
<Error Condition="'$(DoNugetFeedUserName)' == ''" Text="You should set 'DoNugetFeedUserName' property in User.Directory.Build.props or in env variable" />
<Error Condition="'$(DoNugetFeedPassword)' == ''" Text="You should set 'DoNugetFeedPassword' property in User.Directory.Build.props or in env variable" />
<Error Condition="'$(DoNugetFeedUrl)' == ''" Text="You should set 'DoNugetFeedUrl' property in User.Directory.Build.props or in env variable" />
</Target>

Expand Down Expand Up @@ -51,6 +52,11 @@
<!-- If package-lock.json has changed, perform an NPM install -->
<Target Name="PublishToNuget" AfterTargets="Pack" DependsOnTargets="Pack">
<Message Importance="high" Text="Publish nupkg %(NugetPublishInput.Identity) to server" />
<Exec Command="dotnet nuget push %(NugetPublishInput.Identity) --force-english-output --timeout 60 --api-key $(DoNugetFeedApiKey) --source $(DoNugetFeedUrl)" WorkingDirectory="$(SolutionDir)_Build\Release\packages" />
<!-- Create empty valid NuGet.Config file and add credentials there -->
<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" />
<Exec Command="dotnet nuget add source $(DoNugetFeedUrl) --username $(DoNugetFeedUserName) --password $(DoNugetFeedPassword) --store-password-in-clear-text --configfile NuGet.Config" WorkingDirectory="$(SolutionDir)_Build\Release\packages" />
<!-- Push packages using credentials from NuGet.Config file and then delete NuGet.Config -->
<Exec Command="dotnet nuget push %(NugetPublishInput.Identity) --force-english-output --timeout 60 --api-key az --source $(DoNugetFeedUrl)" WorkingDirectory="$(SolutionDir)_Build\Release\packages" />
<Delete Files="$(SolutionDir)_Build\Release\packages\NuGet.Config" />
</Target>
</Project>
3 changes: 2 additions & 1 deletion User.Directory.Build.props.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="latest">
<PropertyGroup Label="User defined variables">
<DoNugetFeedApiKey>Put key Here</DoNugetFeedApiKey>
<DoNugetFeedUserName>Put username here</DoNugetFeedUserName>
<DoNugetFeedPassword>Put password here</DoNugetFeedPassword>
<DoNugetFeedUrl>Put url here</DoNugetFeedUrl>
</PropertyGroup>
</Project>