简体   繁体   中英

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!

您可以通过在<PropertyGroup>进行设置来覆盖包输出目录:

<PackageOutputPath>..\some-folder</PackageOutputPath>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM