Visual Studio 2017中的Nuget Pack命令 [英] Nuget Pack command, in Visual Studio 2017

查看:67
本文介绍了Visual Studio 2017中的Nuget Pack命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.core解决方案,其中需要包含一些项目,并且据我了解,使用Nuget的实践在.core中.对于那些项目,我在属性"->包装"下选中了在生成时生成软件包".问题在于nuget-package放在\ bin \ Debug \ ...下.是否有一种方法可以定义重写属性,以便可以将其放置在其他位置?

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?

我试图放入nuget.config:

I have tried to put in nuget.config:

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

没有运气.我也尝试在.csproj中输入pu:

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>

我尝试使用OnPostBuild将文件从其位置复制到另一个位置,但是似乎在postbuild之后触发了包命令...另一个问题是宏中使用的参数不是由系统设置的,它们在运行时只是emty字符串.

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.

我也曾尝试从命令promt运行,这是因为它在Visual Studio 2017中使用.core和Nuget时感觉很麻烦.从命令promt(nuget包)运行时,我得到的信息不多:无法将类型为System.String的对象转换为类型NuGet.Frameworks.NuGetFramework"

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"

与Visual Studio 2017使用的默认设置不同,我该怎么做才能将所有nuget程序包放在另一个目录中?我可以以某种方式覆盖此设置吗?

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?

谢谢!

推荐答案

您可以通过在< PropertyGroup>

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

这篇关于Visual Studio 2017中的Nuget Pack命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆