0
votes

We switched to NuGet to manage our packets in Visual Studio 2017, everyathing works fine now but to push the packages you need to first create a nuspec, create a nupkg (NuGet Package) and then push it to our NuGet Server. All of this commands get some parameters of which some would stay the same and others need to get from the visual studio variables. Can you recommend any scripting language that would work for this or have any other solutions for this? Btw im a "newbie".

1

1 Answers

0
votes

Can you recommend any scripting language that would work for this or have any other solutions for this? Btw im a "newbie".

1.Since we can pack packages from xx.csproj, you can use command like nuget pack xx.csproj to create nuget packages. After that, you can use nuget push command to publish them. To push several nuget packages the same time use command like nuget push path\*.nupkg -source .... You can get some help from this link. Note if you've had the same package with same version in server,it won't automatically overwrite it. (And you can include them in a batch file like this)

2.You can try CreateNewNuGetPackageFromProjectAfterEachBuild package, install this package to your project, and it will create packages automatically for you after each build. So you don't need to manually pack them by command.(Works for my C# .net fx project).

3.For .net core projects, if you right-click the project in Solution Explorer, you can find the Pack button. After build your project successfully in VS, use the pack option will automatically package your assembly.

4.Also, assuming you're in a solution with many class library projects and you want to pack them, you can follow this document.For .net framework projects using packagereference format, add the NuGet.Build.Tasks.Pack package to the project dependencies. After that, you can use command like msbuild -t:pack xx.sln to pack all projects whose GeneratePackageOnBuild property is true.

Most of above are about how to pack packages easily. And after you get the output xx.nupkgs, nuget push *.nupkg -Source... can help you do the publish job.