问题描述
我有一个 .core 解决方案,其中需要包含一些项目,据我了解,实践是在 .core 中使用 Nuget.对于我在 Properties->Package 下的那些项目,选中了Generate package on build".问题是 nuget-package 放在 inDebug... 有没有办法定义一个覆盖属性,以便它可以放在其他地方?
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 inDebug... 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:
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 后触发了打包命令……另一个问题是宏中使用的参数不是由系统设置的,它们在运行时只是空字符串.
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.
我还尝试从命令提示符运行,因为在带有 .core 和 Nuget 的 Visual Studio 2017 中感觉如此错误.从命令提示符(nuget pack)运行时,我得到非信息性信息:无法将 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"
我可以做些什么来将我的所有 nuget 包放在另一个目录中,而不是 Visual Studio 2017 使用的默认设置...我可以以某种方式覆盖此设置吗?
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>
中设置来覆盖包输出目录:
You can override the package output directory by setting this inside a <PropertyGroup>
:
<PackageOutputPath>..some-folder</PackageOutputPath>
这篇关于Nuget Pack 命令,在 Visual Studio 2017 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!