Reputation: 17119
I made a native package which includes native DLLs. The package is just like SqlServerCompact.4.0.8852.1.nupkg.
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.
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
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.
My question is why the powershell script is not executed when installing packages from command line? And how to deal with it? Thanks!
Upvotes: 4
Views: 2085
Reputation: 47987
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.
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.
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.
Upvotes: 9