Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget Pack command, in Visual Studio 2017

I have a .core solution where some projects need to be included and as I understand the praxis is in .core to use Nuget. For those projects I have under Properties->Package checked "Generate package on build". The problem is that nuget-package is put under \bin\Debug\... Is there a way to define an overrideing property so it can be put some else where?

I have tried to put in nuget.config:

<configuration>
  <config>
    <add key="repositorypath" value="some path" />
  </config>
</configuration>

with no luck. I have also tried to pu in .csproj:

    <PropertyGroup>
       <TargetFramework>netcoreapp1.1</TargetFramework>
       <PreBuildEvent></PreBuildEvent>
       <PostBuildEvent></PostBuildEvent>
       <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
       <PackageOutputDir> some path </PackageOutputDir>
    </PropertyGroup>

I have tried to use OnPostBuild to copy files from its location to another but package command seems to be triggered after postbuild... another problem is that parameters used in macros is not set by system they are just emty strings at runtime.

I have also tried to run from command promt due to It feels so buggy in Visual Studio 2017 with .core and Nuget. When running from command promt (nuget pack) I get non informative info as: "Unable to convert an object of type System.String to type NuGet.Frameworks.NuGetFramework"

What can I do to put all my nuget packages in another catalogue than default setting as Visual Studio 2017 is using... Can I override this setting somehow?

Thanks!

like image 854
user3154653 Avatar asked Jan 30 '23 21:01

user3154653


1 Answers

You can override the package output directory by setting this inside a <PropertyGroup>:

<PackageOutputPath>..\some-folder</PackageOutputPath>
like image 75
Martin Ullrich Avatar answered Feb 02 '23 09:02

Martin Ullrich