Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.

Commit

Permalink
updated NuGet package to support multiple platforms and proper uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
pblasucci committed Dec 6, 2013
1 parent 2825f86 commit 1444cd2
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 12 deletions.
36 changes: 28 additions & 8 deletions nuget/Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,33 @@

param($installPath, $toolsPath, $package, $project)

# get reference to native library
$libzmq = $project.ProjectItems.Item("libzmq.dll")
# build path to appropriate version of native library
$libzmqPath = $toolsPath + "\zeromq\"
if ($project.ConfigurationManager.ActiveConfiguration.PlatformName -eq "x86")
{
# use 32-bit native library
$libzmqPath = $libzmqPath + "x86\libzmq.dll"
}
else
{
# use 64-bit native library
$libzmqPath = $libzmqPath + "x64\libzmq.dll"
}

# set Build Action to None
$buildAction = $libzmq.Properties.Item("BuildAction")
$buildAction.Value = 0
$libzmqFile = $project.ProjectItems.AddFromFileCopy($libzmqPath)
if ($libzmqFile -ne $null)
{
# BuildAction syntax varies by project type
if ($project.Type -eq "F#")
{
$libzmqFile.Properties.Item("BuildAction").Value =
([Microsoft.VisualStudio.FSharp.ProjectSystem.BuildAction]::None)
}
else
{
$libzmqFile.Properties.Item("BuildAction").Value = 0 # None
}

# set Copy to Output Directy to Copy if newer
$copyToOutput = $libzmq.Properties.Item("CopyToOutputDirectory")
$copyToOutput.Value = 2
# CopyToOuptutDirectory is the same across project types
$libzmqFile.Properties.Item("CopyToOutputDirectory").Value = 1 # CopyAlways
}
29 changes: 29 additions & 0 deletions nuget/Uninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -------------------------------------------------------------------------
# This file is part of fszmq.
#
# fszmq is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# fszmq is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with fszmq. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (c) 2011-2013 Paulmichael Blasucci
# -------------------------------------------------------------------------

param($installPath, $toolsPath, $package, $project)

# get native library
$libzmq = $project.ProjectItems.Item("libzmq.dll")

if ($libzmq -ne $null)
{
# remove file
$libzmq.Delete()
}
11 changes: 7 additions & 4 deletions nuget/fszmq.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ Copyright (c) 2011-2013 Paulmichael Blasucci
</frameworkAssemblies>
</metadata>
<files>
<file src="../bin/fszmq.dll" target="lib\net45\fszmq.dll" />
<file src="../bin/fszmq.xml" target="lib\net45\fszmq.xml" />
<file src="../bin/zeromq/x86/libzmq.dll" target="content\libzmq.dll" />
<file src="Install.ps1" target="tools\Install.ps1" />
<file src="..\bin\fszmq.dll" target="lib\net40\fszmq.dll"/>
<file src="..\bin\fszmq.xml" target="lib\net40\fszmq.xml"/>
<file src="..\bin\fszmq.dll" target="lib\net45\fszmq.dll"/>
<file src="..\bin\fszmq.xml" target="lib\net45\fszmq.xml"/>
<file src="..\bin\zeromq\**\*.dll" target="tools\zeromq" />
<file src="Install.ps1" target="tools\Install.ps1" />
<file src="Uninstall.ps1" target="tools\Uninstall.ps1"/>
</files>
</package>

0 comments on commit 1444cd2

Please sign in to comment.