.Net Core 2.0 "Nuget on build package" with Post-build events

New .NET Core 2.0 projects provide an easy and convenient way to create a Nuget package from a project. Just check the "Create Nuget on build" box and it will be executed. enter image description here It works fine, but I have a problem with events after the build. I want to copy all the packages from the solution after each build to a specific folder. Therefore, I use the "Post-Build Event Command Line Command" with a script:

xcopy "$(ProjectDir)$(OutDir)..*.nupkg" "$(SolutionDir)..\WebServicePracticesNuget\" /Y /I

, . , Nuget . , script () , . - . , - x " . :

ping 127.0.0.1 -n 4 > NUL

(~ 95%), , "" . Post-build script. VS. .

, : - ? , ? .

+4
2

GeneratePackageOnBuild Pack target Build, post build NuGet. VS 15.3+ Target . AfterTargets AfterTargets="Pack" , .net. .

PackageOutputPath msbuild, dotnet pack --output.

xcopy , msbuild .

, Directory.Build.props ( ) :

<Project>
  <PropertyGroup>
    <PackageOutputPath>$(MSBuildThisFileDirectory)nupkgs</PackageOutputPath>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
  </PropertyGroup>
</Project>

, .nupkg nupkgs Directory.Build.props. , ( sdk, .net standard/.net), VS ,

+5
+2

Source: https://habr.com/ru/post/1690071/


All Articles