The new .NET Core 2.0 projects provide and easy and convenient way to create Nuget Package from the project output. Just click on the "Generate Nuget package on build" check box and it is done. It works fine but I have an issue with Post-build events. I want to copy all of the packages from a solution after each build to a specific folder. So I use the "Post-build event command line" with a script:
xcopy "$(ProjectDir)$(OutDir)..*.nupkg" "$(SolutionDir)..\WebServicePracticesNuget\" /Y /I
And sometimes it works fine sometimes not at all. So far my investigation concluded that the Nuget package creation is not part of the build process itself. So the script (sometimes) will triggered before the package was generated and it is unpredictable. My solution is to add some delay. Unfortunately "timeout x" is not working with Post-build events. So I used the fallback option:
ping 127.0.0.1 -n 4 > NUL
Which makes it almost reliable (~95%) but I think it is "poor man's" solution. And looks ridiculous in a Post-build event script. I have already reported this issue to the VS team. But not much comments or solution so far.
So my question is: does anybody have the same issue? Or any idea for a better solution then I have now? Thanks.
NET Core project. After you install a NuGet package, you can then make a reference to it in your code with the using <namespace> statement, where <namespace> is the name of package you're using. After you've made a reference, you can then call the package through its API.
nuspec file is an XML manifest that contains package metadata. This manifest is used both to build the package and to provide information to consumers. The manifest is always included in a package. In this topic: General form and schema.
You can configure msbuild task order inside the project file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With