通过的NuGet命令行执行PowerShell脚本 [英] Execute powershell scripts through nuget command line

查看:1215
本文介绍了通过的NuGet命令行执行PowerShell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个机包,其中包括原生的DLL。包就像 SqlServerCompact.4.0.8852.1.nupkg

I made a native package which includes native DLLs. The package is just like SqlServerCompact.4.0.8852.1.nupkg.

当我通过GUI安装包管理的NuGet包......',一切都很好,并原生DLL被复制到调试/ Release文件夹。复制本机DLL是通过类似于SqlSerCompact一个脚本完成的。

When I install the package through GUI by 'Manage Nuget Packages ...', everything is fine and the native DLL is copied to Debug/Release folder. Copying the native Dlls is done by a script similar to that in SqlSerCompact.

和我有如下的蝙蝠文件自动包装过程 MyProject的

And I have the following .bat file to automate the packaging procedure of 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 (编译只需要净dll文件)。然而的NuGet安装不执行复制脚本中的相关性程序包 - 所以编译 MyProjectTest 是好的,但在执行的时候它的EXE有其调试/发布文件夹中没有原生的DLL。

The above script runs perfectly to get MyProject.nupkg (Compiling only needs .Net dlls). However nuget install does not execute the copy script in the dependency packages -- so compiling MyProjectTest is fine, but when executing its EXE there is no native DLL in its Debug/Release folder.

我的问题是,为什么在命令行安装软件包时不执行PowerShell脚本是什么吗?而如何处理呢?谢谢!

My question is why the powershell script is not executed when installing packages from command line? And how to deal with it? Thanks!

推荐答案

它不是由NuGet.exe支持。有关于这个codePLEX 一个讨论,并存在一定的问题,这些问题已被关闭,这提出了他们的问题跟踪系统。还有大卫Ebbo 有关的问题,支持博客文章此功能。

It is not supported by NuGet.exe. There is a discussion on codeplex about this and there are some issues, which have been closed, that were raised in their issue tracking system. There is also a blog post by David Ebbo about the problems with supporting this feature.

普遍的问题是,在PowerShell脚本可以使用Visual Studio的对象模型,这样一来就能从Visual Studio之外揭露这一点,并支持所有的方案是不平凡的。

The general problem is that within a PowerShell script you can use the Visual Studio object model so to be able to expose this from outside of Visual Studio and support all scenarios is non-trivial.

我看了看配套的<一个href="http://community.sharpdevelop.net/blogs/mattward/archive/2011/06/12/InstallingNuGetPackagesOutsideVisualStudio.aspx">running从外部Visual Studio的PowerShell脚本使用SharpDevelop的作为一个实验,看看什么是可能的。这是一个相当重量级的解决方案,因为它需要SharpDevelop的工作,而不只是NuGet.exe。

I looked at supporting the running of PowerShell scripts from outside Visual Studio by using SharpDevelop as an experiment to see what was possible. It is quite a heavyweight solution since it requires SharpDevelop to work and not just NuGet.exe.

这篇关于通过的NuGet命令行执行PowerShell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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