Skip to content

Commit 4bd76b2

Browse files
authored
Use dotnet to push packages to nuget (#2377)
1 parent ae0f1f7 commit 4bd76b2

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

Tools/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
nuget.exe
21
nunit.*
32
vswhere/
43
csharpasyncgenerator.commandline/

build-common/common.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@
4747
<property name="tools.dir" value="${root.dir}/Tools"/>
4848
</target>
4949

50-
<target name="common.download-nuget" depends="common.init">
51-
<get
52-
src="https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
53-
dest="${tools.dir}/nuget.exe"
54-
usetimestamp="true"
55-
/>
56-
</target>
57-
5850
<target name="common.tools-restore" depends="common.init">
5951
<exec workingdir="${root.dir}/Tools" program="dotnet" verbose="true">
6052
<arg line="restore ./packages.csproj --packages ." />

default.build

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
</target>
2222

2323
<target name="nuget.set-properties">
24-
<property name="nuget.nupackages.relative-dir" value="nuget_gallery" />
25-
<property name="nuget.nupackages.dir" value="${build.dir}/${nuget.nupackages.relative-dir}" />
24+
<property name="nuget.nupackages.dir" value="${build.dir}/nuget_gallery" />
2625
<property name="nuget.nupackages.pushbatfile" value="${nuget.nupackages.dir}/NuGetPush.bat" />
2726
</target>
2827

@@ -313,11 +312,9 @@
313312

314313
</target>
315314

316-
<target name="nugetpushbat" depends="init binaries common.download-nuget nuget.set-properties"
315+
<target name="nugetpushbat" depends="init binaries nuget.set-properties"
317316
description="Creates files for the release on nuget gallery.">
318317

319-
<copy file="${tools.dir}/NuGet.exe" todir="${nuget.nupackages.dir}"/>
320-
321318
<echo message="rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey' ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="false"/>
322319
<foreach item="File" property="filename">
323320
<in>
@@ -326,12 +323,12 @@
326323
</items>
327324
</in>
328325
<do>
329-
<echo message="nuget push -source https://api.nuget.org/v3/index.json ${path::get-file-name(filename)} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
326+
<echo message="dotnet nuget push -s https://api.nuget.org/v3/index.json ${path::get-file-name(filename)} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
330327
</do>
331328
</foreach>
332329
</target>
333330

334-
<target name="nugetpush" depends="init binaries common.download-nuget nuget.set-properties"
331+
<target name="nugetpush" depends="init binaries nuget.set-properties"
335332
description="Push packages on nuget gallery.">
336333
<!-- In order to use this task you have to be sure you have executed 'nuget SetApiKey' -->
337334
<foreach item="File" property="filename">
@@ -341,7 +338,8 @@
341338
</items>
342339
</in>
343340
<do>
344-
<exec basedir="${tools.dir}" workingdir="${nuget.nupackages.dir}" program="NuGet.exe">
341+
<exec basedir="${tools.dir}" workingdir="${nuget.nupackages.dir}" program="dotnet">
342+
<arg value="nuget" />
345343
<arg value="push" />
346344
<arg value="${filename}" />
347345
</exec>

0 commit comments

Comments
 (0)