gpt4 book ai didi

.net - 通过nuget命令行执行powershell脚本

转载 作者:行者123 更新时间:2023-12-01 16:19:07 27 4
gpt4 key购买 nike

我制作了一个包含 native DLL 的 native 包。包裹就像SqlServerCompact.4.0.8852.1.nupkg .

当我通过“管理 Nuget 包...”通过 GUI 安装包时,一切正常, native DLL 被复制到调试/发布文件夹。复制 native Dll 是由类似于 SqlSerCompact 中的脚本完成的。

我有以下 .bat文件来自动化 MyProject 的打包过程:

..\..\tools\nuget\bin\NuGet.exe install MyProject\packages.config -o packages\
..\..\tools\nuget\bin\NuGet.exe install MyProjectTest\packages.config -o packages\
..\..\tools\nuget\bin\nuget update MyProject.sln
msbuild /m /p:Configuration=Release /p:Platform="x64" MyProject.sln
..\..\tools\nuget\bin\nuget pack MyProject.nuspec

上面的脚本完美运行得到 MyProject.nupkg (编译只需要 .Net dll)。然而 nuget install不执行依赖包中的复制脚本——所以编译 MyProjectTest很好,但是在执行其 EXE 时,其 Debug/Release 文件夹中没有 native DLL。

我的问题是为什么从命令行安装软件包时不执行 powershell 脚本?以及如何处理?谢谢!

最佳答案

NuGet.exe 不支持它。有一个discussion on codeplex关于这一点,有一些问题已经关闭,在他们的问题跟踪系统中提出。还有一个blog post by David Ebbo关于支持此功能的问题。

普遍的问题是,在 PowerShell 脚本中,您可以使用 Visual Studio 对象模型,以便能够从 Visual Studio 外部公开它并支持所有场景并非易事。

我看着支持running of PowerShell scripts from outside Visual Studio by using SharpDevelop作为一个实验,看看什么是可能的。这是一个相当重量级的解决方案,因为它需要 SharpDevelop 才能工作,而不仅仅是 NuGet.exe。

关于.net - 通过nuget命令行执行powershell脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15474452/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com