├── .gitignore ├── ManagePackageSource ├── ManagePackageSource.nuspec └── tools │ ├── ManagePackageSources.psd1 │ ├── ManagePackageSources.psm1 │ └── init.ps1 ├── NuSpec ├── NuSpec.nuspec └── tools │ ├── NuSpec.psd1 │ ├── NuSpec.psm1 │ ├── NuSpecTemplate.xml │ ├── init.ps1 │ └── nuspec.xsd ├── README.md └── license.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | bin 3 | obj 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | # NuGet packages 9 | *.nupkg -------------------------------------------------------------------------------- /ManagePackageSource/ManagePackageSource.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0.1.0 5 | Maarten Balliauw,Xavier Decoster 6 | MyGet 7 | ManagePackageSource 8 | false 9 | Manage NuGet package sources from the NuGet PowerShell Console 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /ManagePackageSource/tools/ManagePackageSources.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | 3 | # Script module or binary module file associated with this manifest 4 | ModuleToProcess = 'ManagePackageSources.psm1' 5 | 6 | # Version number of this module. 7 | ModuleVersion = '0.1' 8 | 9 | # ID used to uniquely identify this module 10 | GUID = '0012ae2A-89e4-414c-81a6-31861bafb6f2' 11 | 12 | # Author of this module 13 | Author = 'Maarten Balliauw' 14 | 15 | # Company or vendor of this module 16 | CompanyName = '' 17 | 18 | # Copyright statement for this module 19 | Copyright = '(c) 2011 Maarten Balliauw. All rights reserved.' 20 | 21 | # Description of the functionality provided by this module 22 | Description = 'Manage NuGet package sources from the NuGet PowerShell Console' 23 | 24 | # Minimum version of the Windows PowerShell engine required by this module 25 | PowerShellVersion = '2.0' 26 | 27 | # Name of the Windows PowerShell host required by this module 28 | PowerShellHostName = 'Package Manager Host' 29 | 30 | # Minimum version of the Windows PowerShell host required by this module 31 | PowerShellHostVersion = '1.2' 32 | 33 | # Minimum version of the .NET Framework required by this module 34 | DotNetFrameworkVersion = '4.0' 35 | 36 | # Minimum version of the common language runtime (CLR) required by this module 37 | CLRVersion = '' 38 | 39 | # Processor architecture (None, X86, Amd64, IA64) required by this module 40 | ProcessorArchitecture = '' 41 | 42 | # Modules that must be imported into the global environment prior to importing this module 43 | RequiredModules = @() 44 | 45 | # Assemblies that must be loaded prior to importing this module 46 | RequiredAssemblies = @() 47 | 48 | # Script files (.ps1) that are run in the caller's environment prior to importing this module 49 | ScriptsToProcess = @() 50 | 51 | # Type files (.ps1xml) to be loaded when importing this module 52 | TypesToProcess = @() 53 | 54 | # Format files (.ps1xml) to be loaded when importing this module 55 | FormatsToProcess = @() 56 | 57 | # Modules to import as nested modules of the module specified in ModuleToProcess 58 | NestedModules = @('ManagePackageSources.psm1') 59 | 60 | # Functions to export from this module 61 | FunctionsToExport = '*' 62 | 63 | # Cmdlets to export from this module 64 | CmdletsToExport = '' 65 | 66 | # Variables to export from this module 67 | VariablesToExport = '' 68 | 69 | # Aliases to export from this module 70 | AliasesToExport = '' 71 | 72 | # List of all files packaged with this module 73 | FileList = @() 74 | 75 | # Private data to pass to the module specified in ModuleToProcess 76 | PrivateData = '' 77 | 78 | } -------------------------------------------------------------------------------- /ManagePackageSource/tools/ManagePackageSources.psm1: -------------------------------------------------------------------------------- 1 | function Get-PackageSource { 2 | param( 3 | [parameter(Mandatory = $false)] 4 | [string]$Name 5 | ) 6 | 7 | $configuration = Get-Content "$env:AppData\NuGet\NuGet.config" 8 | $configurationXml = [xml]$configuration 9 | 10 | if ($Name -ne $null -and $Name -ne "") { 11 | return $configurationXml.configuration.packageSources.add | where { $_.key -eq $Name} | Format-Table @{Label="Name"; Expression={$_.key}}, @{Label="Source"; Expression={$_.value}} 12 | } else { 13 | return $configurationXml.configuration.packageSources.add | Format-Table @{Label="Name"; Expression={$_.key}}, @{Label="Source"; Expression={$_.value}} 14 | } 15 | } 16 | 17 | function Add-PackageSource { 18 | param( 19 | [parameter(Mandatory = $true)] 20 | [string]$Name, 21 | [parameter(Mandatory = $true)] 22 | [string]$Source 23 | ) 24 | 25 | $configuration = Get-Content "$env:AppData\NuGet\NuGet.config" 26 | $configurationXml = [xml]$configuration 27 | 28 | $sourceToAdd = $configurationXml.createElement("add") 29 | $sourceToAdd.SetAttribute("key", $Name); 30 | $sourceToAdd.SetAttribute("value", $Source); 31 | 32 | $configurationXml.configuration.packageSources.appendChild($sourceToAdd) 33 | 34 | $configurationXml.save("$env:AppData\NuGet\NuGet.config"); 35 | 36 | return $Name 37 | } 38 | 39 | function Remove-PackageSource { 40 | param( 41 | [parameter(Mandatory = $true)] 42 | [string]$Name 43 | ) 44 | 45 | $configuration = Get-Content "$env:AppData\NuGet\NuGet.config" 46 | $configurationXml = [xml]$configuration 47 | 48 | $node = $configurationXml.SelectSingleNode("//packageSources/add[@key='$Name']") 49 | [Void]$node.ParentNode.RemoveChild($node) 50 | 51 | $configurationXml.save("$env:AppData\NuGet\NuGet.config"); 52 | } 53 | 54 | function Set-ActivePackageSource { 55 | param( 56 | [parameter(Mandatory = $true)] 57 | [string]$Name 58 | ) 59 | 60 | $configuration = Get-Content "$env:AppData\NuGet\NuGet.config" 61 | $configurationXml = [xml]$configuration 62 | 63 | $node = $configurationXml.SelectSingleNode("//packageSources/add[@key='$Name']").clone() 64 | 65 | $activeNode = $configurationXml.SelectSingleNode("//activePackageSource") 66 | $activeNode.innerXML = "" 67 | $activeNode.appendChild($node) 68 | 69 | $configurationXml.save("$env:AppData\NuGet\NuGet.config"); 70 | } 71 | 72 | Export-ModuleMember * -------------------------------------------------------------------------------- /ManagePackageSource/tools/init.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | $psd = (Join-Path $toolsPath ManagePackageSources.psd1) 4 | $psm = (Join-Path $toolsPath ManagePackageSources.psm1) 5 | 6 | # Check if the NuGet_profile.ps1 exists and register the ManagePackageSources.psd1 module 7 | if(!(Test-Path $profile)){ 8 | mkdir -force (Split-Path $profile) 9 | New-Item $profile -Type file -Value "Import-Module ManagePackageSources -DisableNameChecking" 10 | } 11 | else{ 12 | Add-Content -Path $profile -Value "`r`nImport-Module ManagePackageSources -DisableNameChecking" 13 | } 14 | 15 | # Copy the ManagePackageSources.psd1 and ManagePackageSources.psm1 files to the profile directory 16 | $profileDirectory = Split-Path $profile -parent 17 | $profileModulesDirectory = (Join-Path $profileDirectory "Modules") 18 | $managePackageSourcesModuleDir = (Join-Path $profileModulesDirectory "ManagePackageSources") 19 | if(!(Test-Path $managePackageSourcesModuleDir)){ 20 | mkdir -force $managePackageSourcesModuleDir 21 | } 22 | copy $psd (Join-Path $managePackageSourcesModuleDir "ManagePackageSources.psd1") 23 | copy $psm (Join-Path $managePackageSourcesModuleDir "ManagePackageSources.psm1") 24 | 25 | # Reload NuGet PowerShell profile 26 | . $profile 27 | 28 | Write-Host "" 29 | Write-Host "*************************************************************************************" 30 | Write-Host "Congratulations! The following additional commands have been installed into your" 31 | Write-Host "NuGet PowerShell Profile and are now always available in this console:" 32 | Write-Host "- Get-PackageSource" 33 | Write-Host "- Add-PackageSource" 34 | Write-Host "- Remove-PackageSource" 35 | Write-Host "- Set-ActivePackageSource" 36 | Write-Host "*************************************************************************************" 37 | Write-Host "" -------------------------------------------------------------------------------- /NuSpec/NuSpec.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NuSpec 5 | 3.0.0 6 | Xavier Decoster 7 | MyGet 8 | https://github.com/myget/NuGetPackages/blob/master/license.txt 9 | https://github.com/myget/NuGetPackages 10 | false 11 | Powershell cmdlet that makes working with NuSpec files easier! 12 | Support for NuGet v2.7 Package Restore 13 | 14 | -------------------------------------------------------------------------------- /NuSpec/tools/NuSpec.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | 3 | # Script module or binary module file associated with this manifest 4 | ModuleToProcess = 'NuSpec.psm1' 5 | 6 | # Version number of this module. 7 | ModuleVersion = '2.0' 8 | 9 | # ID used to uniquely identify this module 10 | GUID = '6FA48925-78C1-43CB-9243-5FDB52F76434' 11 | 12 | # Author of this module 13 | Author = 'Xavier Decoster' 14 | 15 | # Company or vendor of this module 16 | CompanyName = 'MyGet' 17 | 18 | # Copyright statement for this module 19 | Copyright = '(c) 2012 MyGet. All rights reserved.' 20 | 21 | # Description of the functionality provided by this module 22 | Description = 'This module provides a powershell cmdlet that makes working with nuspec files easier' 23 | 24 | # Minimum version of the Windows PowerShell engine required by this module 25 | PowerShellVersion = '2.0' 26 | 27 | # Name of the Windows PowerShell host required by this module 28 | PowerShellHostName = 'Package Manager Host' 29 | 30 | # Minimum version of the Windows PowerShell host required by this module 31 | PowerShellHostVersion = '1.2' 32 | 33 | # Minimum version of the .NET Framework required by this module 34 | DotNetFrameworkVersion = '4.0' 35 | 36 | # Minimum version of the common language runtime (CLR) required by this module 37 | CLRVersion = '' 38 | 39 | # Processor architecture (None, X86, Amd64, IA64) required by this module 40 | ProcessorArchitecture = '' 41 | 42 | # Modules that must be imported into the global environment prior to importing this module 43 | RequiredModules = @() 44 | 45 | # Assemblies that must be loaded prior to importing this module 46 | RequiredAssemblies = @() 47 | 48 | # Script files (.ps1) that are run in the caller's environment prior to importing this module 49 | ScriptsToProcess = @() 50 | 51 | # Type files (.ps1xml) to be loaded when importing this module 52 | TypesToProcess = @() 53 | 54 | # Format files (.ps1xml) to be loaded when importing this module 55 | FormatsToProcess = @() 56 | 57 | # Modules to import as nested modules of the module specified in ModuleToProcess 58 | NestedModules = @('NuSpec.psm1') 59 | 60 | # Functions to export from this module 61 | FunctionsToExport = '*' 62 | 63 | # Cmdlets to export from this module 64 | CmdletsToExport = '' 65 | 66 | # Variables to export from this module 67 | VariablesToExport = '' 68 | 69 | # Aliases to export from this module 70 | AliasesToExport = '' 71 | 72 | # List of all files packaged with this module 73 | FileList = @() 74 | 75 | # Private data to pass to the module specified in ModuleToProcess 76 | PrivateData = '' 77 | 78 | } -------------------------------------------------------------------------------- /NuSpec/tools/NuSpec.psm1: -------------------------------------------------------------------------------- 1 | function Get-SolutionDir { 2 | if($dte.Solution -and $dte.Solution.IsOpen) { 3 | return Split-Path $dte.Solution.Properties.Item("Path").Value 4 | } 5 | else { 6 | throw "Solution not avaliable" 7 | } 8 | } 9 | 10 | function Resolve-ProjectName { 11 | param( 12 | [parameter(ValueFromPipelineByPropertyName = $true)] 13 | [string[]]$ProjectName 14 | ) 15 | 16 | if($ProjectName) { 17 | $projects = Get-Project $ProjectName 18 | } 19 | else { 20 | # All projects by default 21 | $projects = Get-Project -All 22 | } 23 | 24 | $projects 25 | } 26 | 27 | function Get-MSBuildProject { 28 | param( 29 | [parameter(ValueFromPipelineByPropertyName = $true)] 30 | [string[]]$ProjectName 31 | ) 32 | Process { 33 | (Resolve-ProjectName $ProjectName) | % { 34 | $path = $_.FullName 35 | @([Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($path))[0] 36 | } 37 | } 38 | } 39 | 40 | function Set-MSBuildProperty { 41 | param( 42 | [parameter(Position = 0, Mandatory = $true)] 43 | $PropertyName, 44 | [parameter(Position = 1, Mandatory = $true)] 45 | $PropertyValue, 46 | [parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] 47 | [string[]]$ProjectName 48 | ) 49 | Process { 50 | (Resolve-ProjectName $ProjectName) | %{ 51 | $buildProject = $_ | Get-MSBuildProject 52 | $buildProject.SetProperty($PropertyName, $PropertyValue) | Out-Null 53 | $_.Save() 54 | } 55 | } 56 | } 57 | 58 | function Get-MSBuildProperty { 59 | param( 60 | [parameter(Position = 0, Mandatory = $true)] 61 | $PropertyName, 62 | [parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] 63 | [string]$ProjectName 64 | ) 65 | 66 | $buildProject = Get-MSBuildProject $ProjectName 67 | $buildProject.GetProperty($PropertyName) 68 | } 69 | 70 | function Install-NuSpec { 71 | param( 72 | [parameter(ValueFromPipelineByPropertyName = $true)] 73 | [string[]]$ProjectName, 74 | [switch]$EnableIntelliSense, 75 | [string]$TemplatePath 76 | ) 77 | 78 | Process { 79 | 80 | $projects = (Resolve-ProjectName $ProjectName) 81 | 82 | if(!$projects) { 83 | Write-Error "Unable to locate project. Make sure it isn't unloaded." 84 | return 85 | } 86 | 87 | $profileDirectory = Split-Path $profile -parent 88 | $profileModulesDirectory = (Join-Path $profileDirectory "Modules") 89 | $moduleDir = (Join-Path $profileModulesDirectory "NuSpec") 90 | 91 | if($EnableIntelliSense){ 92 | Enable-NuSpecIntelliSense 93 | } 94 | 95 | # Add NuSpec file for project(s) 96 | $projects | %{ 97 | $project = $_ 98 | 99 | # Set the nuspec target path 100 | $projectFile = Get-Item $project.FullName 101 | $projectDir = [System.IO.Path]::GetDirectoryName($projectFile) 102 | $projectNuspec = "$($project.Name).nuspec" 103 | $projectNuspecPath = Join-Path $projectDir $projectNuspec 104 | 105 | # Get the nuspec template source path 106 | if($TemplatePath) { 107 | $nuspecTemplatePath = $TemplatePath 108 | } 109 | else { 110 | $nuspecTemplatePath = Join-Path $moduleDir NuSpecTemplate.xml 111 | } 112 | 113 | # Copy the templated nuspec to the project nuspec if it doesn't exist 114 | if(!(Test-Path $projectNuspecPath)) { 115 | Copy-Item $nuspecTemplatePath $projectNuspecPath 116 | } 117 | else { 118 | Write-Warning "Failed to install nuspec '$projectNuspec' into '$($project.Name)' because the file already exists." 119 | } 120 | 121 | try { 122 | # Add nuspec file to the project 123 | $project.ProjectItems.AddFromFile($projectNuspecPath) | Out-Null 124 | $project.Save() 125 | 126 | Set-MSBuildProperty NuSpecFile $projectNuspec $project.Name 127 | 128 | "Updated '$($project.Name)' to use nuspec '$projectNuspec'" 129 | } 130 | catch { 131 | Write-Warning "Failed to install nuspec '$projectNuspec' into '$($project.Name)'" 132 | } 133 | } 134 | } 135 | } 136 | 137 | function Enable-NuSpecIntelliSense { 138 | Process { 139 | $profileDirectory = Split-Path $profile -parent 140 | $profileModulesDirectory = (Join-Path $profileDirectory "Modules") 141 | $moduleDir = (Join-Path $profileModulesDirectory "NuSpec") 142 | 143 | $solutionDir = Get-SolutionDir 144 | $solution = Get-Interface $dte.Solution ([EnvDTE80.Solution2]) 145 | 146 | # Set up solution folder "Solution Items" 147 | $solutionItemsProject = $dte.Solution.Projects | Where-Object { $_.ProjectName -eq "Solution Items" } 148 | if(!($solutionItemsProject)) { 149 | $solutionItemsProject = $solution.AddSolutionFolder("Solution Items") 150 | } 151 | 152 | # Copy the XSD in the solution directory 153 | try { 154 | $xsdInstallPath = Join-Path $solutionDir 'nuspec.xsd' 155 | $xsdToolsPath = Join-Path $moduleDir 'nuspec.xsd' 156 | 157 | if(!(Test-Path $xsdInstallPath)) { 158 | Copy-Item $xsdToolsPath $xsdInstallPath 159 | } 160 | 161 | $alreadyAdded = $solutionItemsProject.ProjectItems | Where-Object { $_.Name -eq 'nuspec.xsd' } 162 | if(!($alreadyAdded)) { 163 | $solutionItemsProject.ProjectItems.AddFromFile($xsdInstallPath) | Out-Null 164 | } 165 | } 166 | catch { 167 | Write-Warning "Failed to install nuspec.xsd into 'Solution Items'" 168 | } 169 | $solution.SaveAs($solution.FullName) 170 | } 171 | } 172 | 173 | # Statement completion for project names 174 | 'Install-NuSpec', 'Enable-NuSpecIntelliSense' | %{ 175 | Register-TabExpansion $_ @{ 176 | ProjectName = { Get-Project -All | Select -ExpandProperty Name } 177 | } 178 | } 179 | 180 | Export-ModuleMember Install-NuSpec, Enable-NuSpecIntelliSense -------------------------------------------------------------------------------- /NuSpec/tools/NuSpecTemplate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $version$ 5 | $author$ 6 | 7 | $id$ 8 | 9 | <requireLicenseAcceptance>false</requireLicenseAcceptance> 10 | <description>$description$</description> 11 | </metadata> 12 | <files /> 13 | </package> 14 | -------------------------------------------------------------------------------- /NuSpec/tools/init.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | # Configure 4 | $moduleName = "NuSpec" 5 | 6 | # Derived variables 7 | $psdFileName = "$moduleName.psd1" 8 | $psmFileName = "$moduleName.psm1" 9 | $psd = (Join-Path $toolsPath $psdFileName) 10 | $psm = (Join-Path $toolsPath $psmFileName) 11 | 12 | # Check if the NuGet_profile.ps1 exists and register the NuSpec.psd1 module 13 | if(!(Test-Path $profile)){ 14 | mkdir -force (Split-Path $profile) 15 | New-Item $profile -Type file -Value "Import-Module $moduleName -DisableNameChecking" 16 | } 17 | else { 18 | if(!(Get-Content $profile | Select-String "Import-Module $moduleName" -quiet)){ 19 | Add-Content -Path $profile -Value "`r`nImport-Module $moduleName -DisableNameChecking" 20 | } 21 | } 22 | 23 | # Copy the files to the module in the profile directory 24 | $profileDirectory = Split-Path $profile -parent 25 | $profileModulesDirectory = (Join-Path $profileDirectory "Modules") 26 | $moduleDir = (Join-Path $profileModulesDirectory $moduleName) 27 | if(Test-Path $moduleDir){ 28 | # If you install this package and the dir exists, then you're upgrading... 29 | Remove-Item -Recurse -Force $moduleDir 30 | } 31 | if(!(Test-Path $moduleDir)){ 32 | mkdir -force $moduleDir 33 | } 34 | copy $psd (Join-Path $moduleDir $psdFileName) 35 | copy $psm (Join-Path $moduleDir $psmFileName) 36 | 37 | # Copy additional files 38 | copy "$toolsPath\*.xsd" $moduleDir 39 | copy "$toolsPath\*.xml" $moduleDir 40 | 41 | # Reload NuGet PowerShell profile 42 | . $profile 43 | 44 | Write-Host "" 45 | Write-Host "*************************************************************************************" 46 | Write-Host " INSTRUCTIONS" 47 | Write-Host "*************************************************************************************" 48 | Write-Host " To create a NuSpec for a project use the Install-NuSpec command" 49 | Write-Host " By default, the target project selected in the NuGet Package Manager Console is used" 50 | Write-Host "" 51 | Write-Host " Additional options:" 52 | Write-Host " -ProjectName <projectA|projectB> [An array of projectnames; use TAB-completion]" 53 | Write-Host " -Template <templatePath> [Choose a custom nuspec template]" 54 | Write-Host " -EnableIntelliSense [using the latest (unofficial) nuspec.xsd]" 55 | Write-Host "" 56 | Write-Host " For for information, see https://github.com/myget/NuGetPackages" 57 | Write-Host "*************************************************************************************" 58 | Write-Host "" -------------------------------------------------------------------------------- /NuSpec/tools/nuspec.xsd: -------------------------------------------------------------------------------- 1 | 2 | <?xml version="1.0" encoding="utf-8"?> 3 | <xs:schema id="nuspec" 4 | elementFormDefault="unqualified" 5 | xmlns:xs="http://www.w3.org/2001/XMLSchema" 6 | version="3.3" 7 | > 8 | <xs:element name="package"> 9 | <xs:annotation> 10 | <xs:documentation source="http://docs.nuget.org/Create/Nuspec-Reference" xml:lang="en">The root element of a package definition</xs:documentation> 11 | </xs:annotation> 12 | <xs:complexType> 13 | <xs:sequence> 14 | <xs:element name="metadata" 15 | maxOccurs="1" 16 | minOccurs="1"> 17 | <xs:annotation> 18 | <xs:documentation xml:lang="en">Information about how the package should behave when installed</xs:documentation> 19 | </xs:annotation> 20 | <xs:complexType> 21 | <xs:all> 22 | <xs:element name="id" 23 | maxOccurs="1" 24 | minOccurs="1" 25 | type="requiredString_type"> 26 | <xs:annotation> 27 | <xs:documentation xml:lang="en">REQUIRED - Unique identifier for the package</xs:documentation> 28 | </xs:annotation> 29 | </xs:element> 30 | <xs:element name="version" 31 | maxOccurs="1" 32 | minOccurs="1" 33 | type="version_type"> 34 | <xs:annotation> 35 | <xs:documentation xml:lang="en">REQUIRED - Version number of the package</xs:documentation> 36 | </xs:annotation> 37 | </xs:element> 38 | <xs:element name="title" 39 | maxOccurs="1" 40 | minOccurs="0" 41 | type="xs:string"> 42 | <xs:annotation> 43 | <xs:documentation xml:lang="en">Human-friendly name of the package displayed in NuGet clients</xs:documentation> 44 | </xs:annotation> 45 | </xs:element> 46 | <xs:element name="authors" 47 | maxOccurs="1" 48 | minOccurs="1" 49 | type="xs:string"> 50 | <xs:annotation> 51 | <xs:documentation xml:lang="en">REQUIRED - Comma-separated list of authors of the package code</xs:documentation> 52 | </xs:annotation> 53 | </xs:element> 54 | <xs:element name="owners" 55 | maxOccurs="1" 56 | minOccurs="0" 57 | type="xs:string"> 58 | <xs:annotation> 59 | <xs:documentation xml:lang="en">Comma-separated list of the owners of the package - ignored by NuGet.org</xs:documentation> 60 | </xs:annotation> 61 | </xs:element> 62 | <xs:element name="description" 63 | maxOccurs="1" 64 | minOccurs="1" 65 | type="xs:string"> 66 | <xs:annotation> 67 | <xs:documentation xml:lang="en">A long description of the package to show in NuGet clients</xs:documentation> 68 | </xs:annotation> 69 | </xs:element> 70 | <xs:element name="releaseNotes" 71 | maxOccurs="1" 72 | minOccurs="0" 73 | type="xs:string"> 74 | <xs:annotation> 75 | <xs:documentation xml:lang="en">A description of the changes made in each release of the package</xs:documentation> 76 | </xs:annotation> 77 | </xs:element> 78 | <xs:element name="summary" 79 | maxOccurs="1" 80 | minOccurs="0" 81 | type="xs:string"> 82 | <xs:annotation> 83 | <xs:documentation xml:lang="en">A short description of the package to show in NuGet clients</xs:documentation> 84 | </xs:annotation> 85 | </xs:element> 86 | <xs:element name="language" 87 | maxOccurs="1" 88 | minOccurs="0" 89 | type="xs:string" 90 | default="en-US"> 91 | <xs:annotation> 92 | <xs:documentation xml:lang="en">The locale ID for the package, such as en-US</xs:documentation> 93 | </xs:annotation> 94 | </xs:element> 95 | <xs:element name="projectUrl" 96 | maxOccurs="1" 97 | minOccurs="0" 98 | type="xs:anyURI"> 99 | <xs:annotation> 100 | <xs:documentation xml:lang="en">A URL to learn more about the package - the package project's home page</xs:documentation> 101 | </xs:annotation> 102 | </xs:element> 103 | <xs:element name="iconUrl" 104 | maxOccurs="1" 105 | minOccurs="0" 106 | type="xs:anyURI"> 107 | <xs:annotation> 108 | <xs:documentation xml:lang="en">A URL for an image to use in NuGet clients. Should be a 64x64 PNG with a transparent background</xs:documentation> 109 | </xs:annotation> 110 | </xs:element> 111 | <xs:element name="licenseUrl" 112 | maxOccurs="1" 113 | minOccurs="0" 114 | type="xs:anyURI"> 115 | <xs:annotation> 116 | <xs:documentation xml:lang="en">A URL for a license to the package</xs:documentation> 117 | </xs:annotation> 118 | </xs:element> 119 | <xs:element name="copyright" 120 | maxOccurs="1" 121 | minOccurs="0" 122 | type="xs:string"> 123 | <xs:annotation> 124 | <xs:documentation xml:lang="en">Copyright details for the package</xs:documentation> 125 | </xs:annotation> 126 | </xs:element> 127 | <xs:element name="requireLicenseAcceptance" 128 | maxOccurs="1" 129 | minOccurs="0" 130 | type="xs:boolean" 131 | default="false"> 132 | <xs:annotation> 133 | <xs:documentation xml:lang="en">Boolean - does the client need to ensure the package license is accepted before it is installed? Default: false</xs:documentation> 134 | </xs:annotation> 135 | </xs:element> 136 | <xs:element name="dependencies" 137 | maxOccurs="1" 138 | minOccurs="0"> 139 | <xs:annotation> 140 | <xs:documentation xml:lang="en">Packages that this package depends upon</xs:documentation> 141 | </xs:annotation> 142 | <xs:complexType> 143 | <xs:choice minOccurs="1" maxOccurs="1"> 144 | <xs:element name="group" 145 | minOccurs="0" 146 | maxOccurs="unbounded"> 147 | <xs:annotation> 148 | <xs:documentation xml:lang="en">A collection of packages to be installed as a group</xs:documentation> 149 | </xs:annotation> 150 | <xs:complexType> 151 | <xs:sequence> 152 | <xs:element name="dependency" 153 | type="dependency_type" 154 | minOccurs="0" 155 | maxOccurs="unbounded" /> 156 | </xs:sequence> 157 | <xs:attribute name="targetFramework" 158 | use="optional" 159 | type="xs:string"> 160 | <xs:annotation> 161 | <xs:documentation>If the project target framework matches this value, then this group of packages will be installed. An empty value serves as a fall-back</xs:documentation> 162 | </xs:annotation> 163 | </xs:attribute> 164 | </xs:complexType> 165 | </xs:element> 166 | <xs:element name="dependency" 167 | type="dependency_type" 168 | minOccurs="1" 169 | maxOccurs="unbounded" /> 170 | </xs:choice> 171 | </xs:complexType> 172 | </xs:element> 173 | 174 | <xs:element name="references" 175 | maxOccurs="1" 176 | minOccurs="0"> 177 | <xs:annotation> 178 | <xs:documentation xml:lang="en">Names of assemblies (not the path) under the lib folder that are added as project references. Default: all assemblies are added</xs:documentation> 179 | </xs:annotation> 180 | <xs:complexType> 181 | <xs:sequence> 182 | <xs:element name="reference" 183 | minOccurs="0" 184 | maxOccurs="unbounded"> 185 | <xs:complexType> 186 | <xs:attribute name="file" 187 | type="xs:string" 188 | use="required"> 189 | <xs:annotation> 190 | <xs:documentation xml:lang="en">Name of the file to include</xs:documentation> 191 | </xs:annotation> 192 | </xs:attribute> 193 | </xs:complexType> 194 | </xs:element> 195 | </xs:sequence> 196 | </xs:complexType> 197 | </xs:element> 198 | 199 | <xs:element name="tags" 200 | maxOccurs="1" 201 | minOccurs="0" 202 | type="xs:string"> 203 | <xs:annotation> 204 | <xs:documentation xml:lang="en">A space delimited list of tags and keywords that describe the package for use by NuGet repositories providing search capabilties</xs:documentation> 205 | </xs:annotation> 206 | </xs:element> 207 | <xs:element name="frameworkAssemblies" 208 | maxOccurs="1" 209 | minOccurs="0"> 210 | <xs:complexType> 211 | <xs:sequence> 212 | <xs:element name="frameworkAssembly" 213 | minOccurs="0" 214 | maxOccurs="unbounded"> 215 | <xs:annotation> 216 | <xs:documentation xml:lang="en">.NET framework assemblies that this package requires</xs:documentation> 217 | </xs:annotation> 218 | <xs:complexType> 219 | <xs:attribute name="assemblyName" 220 | type="xs:string" 221 | use="required"> 222 | <xs:annotation> 223 | <xs:documentation xml:lang="en">REQUIRED - A fully qualified assembly name</xs:documentation> 224 | </xs:annotation> 225 | </xs:attribute> 226 | <xs:attribute name="targetFramework" 227 | type="xs:string" 228 | use="optional"> 229 | <xs:annotation> 230 | <xs:documentation xml:lang="en">Specific target framework this reference applies to. Default: all frameworks</xs:documentation> 231 | </xs:annotation> 232 | </xs:attribute> 233 | </xs:complexType> 234 | </xs:element> 235 | 236 | <xs:element name="contentFiles" 237 | minOccurs="0" 238 | maxOccurs="1"> 239 | <xs:annotation> 240 | <xs:documentation xml:lang="en">Directions for how to include files as content in the package</xs:documentation> 241 | </xs:annotation> 242 | <xs:complexType> 243 | <xs:sequence> 244 | <xs:element name="files" 245 | minOccurs="1" 246 | maxOccurs="unbounded"> 247 | <xs:annotation> 248 | <xs:documentation xml:lang="en">Defines a collection of files to be acted on by NuGet</xs:documentation> 249 | </xs:annotation> 250 | <xs:complexType> 251 | <xs:attribute name="include" 252 | use="required" 253 | type="folder_type"> 254 | <xs:annotation> 255 | <xs:documentation xml:lang="en">Location of the files under /contentFiles to act on</xs:documentation> 256 | </xs:annotation> 257 | </xs:attribute> 258 | <xs:attribute name="exclude" 259 | use="optional" 260 | type="xs:string"> 261 | <xs:annotation> 262 | <xs:documentation xml:lang="en">A path, optionally with wild cards, to exclude matching files from</xs:documentation> 263 | </xs:annotation> 264 | </xs:attribute> 265 | <xs:attribute name="buildAction" 266 | use="optional" 267 | default="Compile" 268 | type="buildAction_type"> 269 | <xs:annotation> 270 | <xs:documentation xml:lang="en">The action MSBuild should take on the files</xs:documentation> 271 | </xs:annotation> 272 | </xs:attribute> 273 | <xs:attribute name="copyToOutput" 274 | use="optional" 275 | default="false" 276 | type="xs:boolean"> 277 | <xs:annotation> 278 | <xs:documentation xml:lang="en">If true, then copy these files to the output folder</xs:documentation> 279 | </xs:annotation> 280 | </xs:attribute> 281 | <xs:attribute name="flatten" 282 | use="optional" 283 | default="false" 284 | type="xs:boolean"> 285 | <xs:annotation> 286 | <xs:documentation xml:lang="en">If files are copied to the output folder, when true the full folder structure is reproduced in output</xs:documentation> 287 | </xs:annotation> 288 | </xs:attribute> 289 | </xs:complexType> 290 | </xs:element> 291 | </xs:sequence> 292 | </xs:complexType> 293 | </xs:element> 294 | </xs:sequence> 295 | </xs:complexType> 296 | </xs:element> 297 | </xs:all> 298 | <xs:attribute name="minClientVersion" type="xs:decimal" use="optional"> 299 | <xs:annotation> 300 | <xs:documentation xml:lang="en">The minimum NuGet client version needed to install this package.</xs:documentation> 301 | </xs:annotation> 302 | </xs:attribute> 303 | </xs:complexType> 304 | </xs:element> 305 | <xs:element name="files" 306 | minOccurs="0" 307 | maxOccurs="1" 308 | nillable="true"> 309 | <xs:annotation> 310 | <xs:documentation xml:lang="en">If declared, these are the only files to include in the package</xs:documentation> 311 | </xs:annotation> 312 | <xs:complexType> 313 | <xs:sequence> 314 | <xs:element name="file" 315 | minOccurs="0" 316 | maxOccurs="unbounded"> 317 | <xs:complexType> 318 | <xs:attribute name="src" 319 | use="required" 320 | type="xs:string"> 321 | <xs:annotation> 322 | <xs:documentation>REQUIRED - The location of the file or files to include relative to the NuSpec file</xs:documentation> 323 | </xs:annotation> 324 | </xs:attribute> 325 | <xs:attribute name="target" 326 | use="optional" 327 | type="xs:string"> 328 | <xs:annotation> 329 | <xs:documentation xml:lang="en">Relative path to the directory within the package where the files will be placed</xs:documentation> 330 | </xs:annotation> 331 | </xs:attribute> 332 | 333 | <xs:attribute name="exclude" 334 | use="optional" 335 | type="xs:string"> 336 | <xs:annotation> 337 | <xs:documentation xml:lang="en">The file or files to exclude within the src location</xs:documentation> 338 | </xs:annotation> 339 | </xs:attribute> 340 | </xs:complexType> 341 | </xs:element> 342 | </xs:sequence> 343 | </xs:complexType> 344 | </xs:element> 345 | </xs:sequence> 346 | </xs:complexType> 347 | </xs:element> 348 | 349 | <xs:simpleType name="requiredString_type"> 350 | <xs:restriction base="xs:string"> 351 | <xs:minLength value="1" /> 352 | </xs:restriction> 353 | </xs:simpleType> 354 | 355 | <xs:simpleType name="version_type"> 356 | <xs:restriction base="xs:string"> 357 | <xs:pattern value="\d+\.\d+\.\d+(.\d+)?-?[a-zA-Z0-9]*" /> 358 | </xs:restriction> 359 | </xs:simpleType> 360 | 361 | <xs:complexType name="dependency_type"> 362 | <xs:attribute name="id" 363 | type="xs:string" 364 | use="required"> 365 | <xs:annotation> 366 | <xs:documentation xml:lang="en">The unique identifier of the package to reference</xs:documentation> 367 | </xs:annotation> 368 | </xs:attribute> 369 | <xs:attribute name="version" 370 | type="version_type" 371 | use="optional"> 372 | <xs:annotation> 373 | <xs:documentation xml:lang="en">The version numbers of the package to reference - a range can be specified</xs:documentation> 374 | </xs:annotation> 375 | </xs:attribute> 376 | </xs:complexType> 377 | 378 | <xs:simpleType name="folder_type"> 379 | <xs:restriction base="xs:string"> 380 | <xs:pattern value="^vb|fs|cs\/[^/]+\/.+"></xs:pattern> 381 | </xs:restriction> 382 | </xs:simpleType> 383 | 384 | <xs:simpleType name="buildAction_type"> 385 | <xs:restriction base="xs:string"> 386 | <xs:enumeration value="None"> 387 | <xs:annotation> 388 | <xs:documentation xml:lang="en">No action should be taken by MSBuild</xs:documentation> 389 | </xs:annotation> 390 | </xs:enumeration> 391 | <xs:enumeration value="Compile"> 392 | <xs:annotation> 393 | <xs:documentation xml:lang="en">These files should be compiled</xs:documentation> 394 | </xs:annotation> 395 | </xs:enumeration> 396 | <xs:enumeration value="Content"> 397 | <xs:annotation> 398 | <xs:documentation xml:lang="en">These files should be treated as content</xs:documentation> 399 | </xs:annotation> 400 | </xs:enumeration> 401 | <xs:enumeration value="EmbeddedResource"> 402 | <xs:annotation> 403 | <xs:documentation xml:lang="en">Treat these files an embedded resource</xs:documentation> 404 | </xs:annotation> 405 | </xs:enumeration> 406 | </xs:restriction> 407 | </xs:simpleType> 408 | </xs:schema> 409 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NuGetPackages 2 | 3 | Our collection of home-made NuGet packages :) 4 | 5 | ## NuSpec 6 | 7 | Simply run Install-Package NuSpec (once for the solution, doesn't matter which project) to get a set of extra cmdlets available in the NuGet Package Manager Console. 8 | 9 | Available cmdlets: *Install-NuSpec*, *Enable-NuSpecIntelliSense* 10 | 11 | ### Creating the package and auto-build 12 | 13 | Install-NuSpec <ProjectName> [-EnableIntelliSense] [-TemplatePath] 14 | 15 | Adds a tokenized .nuspec file to the target project(s). 16 | Use the <code>-EnableIntelliSense</code> swicth to add the nuspec.xsd to your Solution Items to provide IntelliSense. 17 | 18 | ### Done? Remove the dependency... 19 | 20 | There's not much value in keeping the NuSpec package dependency around after setting up this automation, so feel free to simply remove it using *Uninstall-Package NuSpec*. 21 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 10 | 11 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 12 | 13 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. 14 | 15 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 16 | 17 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 18 | 19 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. 20 | 21 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). 22 | 23 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. 24 | 25 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." 26 | 27 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 28 | 29 | 2. Grant of Copyright License. 30 | 31 | Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 32 | 33 | 3. Grant of Patent License. 34 | 35 | Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 36 | 37 | 4. Redistribution. 38 | 39 | You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: 40 | 41 | 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and 42 | 43 | 2. You must cause any modified files to carry prominent notices stating that You changed the files; and 44 | 45 | 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and 46 | 47 | 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. 48 | 49 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 50 | 51 | 5. Submission of Contributions. 52 | 53 | Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 54 | 55 | 6. Trademarks. 56 | 57 | This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 58 | 59 | 7. Disclaimer of Warranty. 60 | 61 | Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 62 | 63 | 8. Limitation of Liability. 64 | 65 | In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 66 | 67 | 9. Accepting Warranty or Additional Liability. 68 | 69 | While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. --------------------------------------------------------------------------------