├── .gitattributes ├── .gitignore ├── ReadMe.md ├── build ├── PublishToGallery.ps1 └── Update-ModuleManifest.ps1 └── src ├── SS.NuGet.Publish.Test ├── MockClass.cs └── SS.NuGet.Publish.Test.csproj ├── SS.NuGet.Publish.VisualStudio.AddIn ├── Commands │ ├── DynamicItemMenuCommand.cs │ └── NuGetPublishCfg.cs ├── Extensions.cs ├── Key.snk ├── Project.cs ├── ProjectType.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── NuGetPublishCfg.png │ └── NuGetPublishCfgPackage.ico ├── SS.NuGet.Publish.VisualStudio.AddIn.csproj ├── ServiceLocator.cs ├── VSCommandTable.vsct ├── VSPackage.cs ├── VSPackage.resx ├── Vsix.cs ├── app.config └── source.extension.vsixmanifest ├── SS.NuGet.Publish.VisualStudio ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── PublishPackagePageControl.Designer.cs ├── PublishPackagePageControl.cs ├── PublishPackagePageControl.resx ├── PublishPackagePageProvider.cs ├── SS.NuGet.Publish.VisualStudio.csproj └── app.config ├── SS.NuGet.Publish.sln └── SS.NuGet.Publish ├── SS.NuGet.Publish.csproj ├── SS.NuGet.Publish.props ├── SS.NuGet.Publish.targets └── nuget_256.png /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | 332 | SS.NuGet.Publish.VisualStudio.exe -------------------------------------------------------------------------------- /ReadMe.md: -------------------------------------------------------------------------------- 1 | # SS.NuGet.Publish 2 | 3 | Automate publishing a project's NuGet package during build process. 4 | 5 | [![Build status](https://ci.appveyor.com/api/projects/status/59u4d4pxlk4o4fhi/branch/master?svg=true)](https://ci.appveyor.com/project/SimplerSoftware/ss-nuget-publish/branch/master) 6 | 7 | ## Usage 8 | 9 | To use the package, you need to add the [SS.NuGet.Publish](https://www.nuget.org/packages/SS.NuGet.Publish/) NuGet package to your project. Then configure accordingly in the .csproj file. 10 | 11 | #### Project file properties 12 | * **NuGetPublishVersion** *(Optional)* 13 | - Version of Nuget.exe to use. Defaults to 6.8.0 14 | * **NuGetPublishPath** *(Optional)* 15 | - Path to cache the Nuget.exe locally. Defaults to *%UserProfile%\\.nuget\\{NuGetPublishVersion}\\* 16 | * **NuGetPublishType** *(Optional)* 17 | - Either *remote* or *local*. Will try to auto detect if NuGetPublishLocation is a url (begins with http), defaults to local if NuGetPublishLocation is not a url. 18 | * **NuGetPublishLocation** 19 | - Valid URL or path to publish the NuGet package to 20 | * **NuGetPublishSkipDuplicate** 21 | - Set to true to add the `-SkipDuplicate` command line option for nuget push command. 22 | 23 | ## How it works 24 | 25 | - If not already cached, it will download a copy of nuget.exe from https://dist.nuget.org/win-x86-commandline/v{NuGetPublishVersion}/nuget.exe into `NuGetPublishPath` 26 | - Publish 27 | - If `NuGetPublishType = remote` OR `NuGetPublishLocation` starts with http, it executes nuget.exe using *push* command to `NuGetPublishLocation` as the source 28 | - If `NuGetPublishType = local` OR `NuGetPublishLocation` does not start with http, it executes nuget.exe using *add* command to `NuGetPublishLocation` as the source 29 | - Manually setting `NuGetPublishType` disables the auto-detection of publishing type. 30 | 31 | > **Note:** 32 | > If `NuGetPublishLocation` is not defined, no publish is attempted. 33 | > If `NuGetPublishType` is set to remote, then `NuGetPublishLocation` **must** be a valid URL to a NuGet repo. 34 | > If `NuGetPublishType` is set to local, then `NuGetPublishLocation` **must** be a valid local folder or UNC path. 35 | > If you're publishing to a remote site, like NuGet.org, you will need to set your API Key prior to publishing. Follow the [instructions here](https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-setapikey) to learn how to accomplish this. 36 | 37 | ## Examples 38 | ```xml 39 | 40 | remote 41 | https://api.nuget.org/v3/index.json 42 | 43 | ``` 44 | ```xml 45 | 46 | 47 | D:\references\packages 48 | 49 | 50 | remote 51 | https://api.nuget.org/v3/index.json 52 | 53 | 54 | ``` 55 | -------------------------------------------------------------------------------- /build/PublishToGallery.ps1: -------------------------------------------------------------------------------- 1 | [cmdletbinding()] 2 | param( 3 | [Parameter()] 4 | $ApiKey, 5 | [Parameter(Mandatory)] 6 | $Module 7 | ) 8 | 9 | if (!$ApiKey -and (Test-Path "$PSScriptRoot\..\..\.Nuget.key")) { 10 | # For local testing/publishing 11 | $ApiKey = (Get-Content -Raw "$PSScriptRoot\..\..\.Nuget.key") 12 | } 13 | 14 | if ($ApiKey){ 15 | Publish-Module -Name $Module -NuGetApiKey $ApiKey 16 | } else { 17 | Write-Error "Nuget API key is missing, please create the file with one line that contains your API key for nuget or pass it in via the ApiKey parameter." 18 | } -------------------------------------------------------------------------------- /build/Update-ModuleManifest.ps1: -------------------------------------------------------------------------------- 1 | [cmdletbinding()] 2 | param( 3 | [Parameter(Mandatory)] 4 | $Version, 5 | [Parameter(Mandatory)] 6 | $ManifestPath 7 | ) 8 | 9 | Write-Host "Updating module manifest with version $Version" 10 | $date = Get-Date -Format MM/dd/yyyy 11 | $ModuleManifest = Get-Content $ManifestPath -Raw 12 | $ModuleManifest = $ModuleManifest -replace "(ModuleVersion\W*=)\W*'(.*)'", "`$1 '$Version'" 13 | $ModuleManifest = $ModuleManifest -replace "(Generated on:)\W*(.*)", "`$1 $date" 14 | $ModuleManifest | Out-File -LiteralPath $ManifestPath -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.Test/MockClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SS.NuGet.Publish.Test 4 | { 5 | public class MockClass 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.Test/SS.NuGet.Publish.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | MIT 6 | Simpler Software 7 | Simpler Software 8 | NuGet Publish Library Test 9 | Copyright © Simpler Software 2019 10 | nuget;publish;target;msbuild 11 | true 12 | This is nothing more than a test for the nuget package SS.NuGet.Publish 13 | 1.0.2311.01 14 | 1.0.2311.01 15 | {AA790F50-5208-41F5-89B2-D3733E12BE1D} 16 | 1.0.0-beta-02 17 | 18 | 19 | 20 | C:\Packages 21 | True 22 | False 23 | False 24 | False 25 | False 26 | True 27 | AssemblyVersion.None.Beta 28 | SettingsVersion 29 | None 30 | 31 | 32 | 33 | True 34 | False 35 | False 36 | False 37 | False 38 | True 39 | AssemblyVersion.IncrementWithAutoReset.None 40 | SettingsVersion 41 | None 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/Commands/DynamicItemMenuCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Shell; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.Design; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Microsoft.VisualStudio.Shell.Interop; 9 | 10 | namespace SS.NuGet.Publish.VisualStudio.AddIn.Commands 11 | { 12 | class DynamicItemMenuCommand : OleMenuCommand 13 | { 14 | private Predicate matches; 15 | 16 | public DynamicItemMenuCommand(CommandID rootId, Predicate matches, EventHandler invokeHandler, EventHandler beforeQueryStatusHandler) 17 | : base(invokeHandler, null /*changeHandler*/, beforeQueryStatusHandler, rootId) 18 | { 19 | this.matches = matches ?? throw new ArgumentNullException("matches"); 20 | } 21 | 22 | public override bool DynamicItemMatch(int cmdId) 23 | { 24 | // Call the supplied predicate to test whether the given cmdId is a match. 25 | // If it is, store the command id in MatchedCommandid 26 | // for use by any BeforeQueryStatus handlers, and then return that it is a match. 27 | // Otherwise clear any previously stored matched cmdId and return that it is not a match. 28 | if (this.matches(cmdId)) 29 | { 30 | this.MatchedCommandId = cmdId; 31 | return true; 32 | } 33 | 34 | this.MatchedCommandId = 0; 35 | return false; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/Commands/NuGetPublishCfg.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Globalization; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using Microsoft.VisualStudio.Shell; 8 | using Microsoft.VisualStudio.Shell.Interop; 9 | using Task = System.Threading.Tasks.Task; 10 | 11 | namespace SS.NuGet.Publish.VisualStudio.AddIn.Commands 12 | { 13 | /// 14 | /// Command handler 15 | /// 16 | internal sealed class NuGetPublishCfg 17 | { 18 | /// 19 | /// Command ID. 20 | /// 21 | public const int CommandId = 0x0100; 22 | 23 | /// 24 | /// Command menu group (command set GUID). 25 | /// 26 | public static readonly Guid CommandSet = new Guid("7d30d4d2-a73f-4bc5-93d4-21111ae37694"); 27 | 28 | /// 29 | /// VS Package that provides this command, not null. 30 | /// 31 | private readonly AsyncPackage package; 32 | 33 | /// 34 | /// Initializes a new instance of the class. 35 | /// Adds our command handlers for menu (commands must exist in the command table file) 36 | /// 37 | /// Owner package, not null. 38 | /// Command service to add command to, not null. 39 | private NuGetPublishCfg(AsyncPackage package, OleMenuCommandService commandService) 40 | { 41 | this.package = package ?? throw new ArgumentNullException(nameof(package)); 42 | commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); 43 | 44 | var menuCommandID = new CommandID(CommandSet, CommandId); 45 | var menuItem = new OleMenuCommand(Execute, null, OnBeforeQueryStatusDynamicItem, menuCommandID); 46 | //var menuItem = new DynamicItemMenuCommand(menuCommandID, IsValidDynamicItem, Execute, OnBeforeQueryStatusDynamicItem); 47 | commandService.AddCommand(menuItem); 48 | } 49 | 50 | /// 51 | /// Gets the instance of the command. 52 | /// 53 | public static NuGetPublishCfg Instance 54 | { 55 | get; 56 | private set; 57 | } 58 | 59 | /// 60 | /// Gets the service provider from the owner package. 61 | /// 62 | private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider 63 | { 64 | get 65 | { 66 | return this.package; 67 | } 68 | } 69 | 70 | /// 71 | /// Initializes the singleton instance of the command. 72 | /// 73 | /// Owner package, not null. 74 | public static async Task InitializeAsync(AsyncPackage package) 75 | { 76 | // Switch to the main thread - the call to AddCommand in NuGetPublishCfg's constructor requires 77 | // the UI thread. 78 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); 79 | 80 | OleMenuCommandService commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService; 81 | Instance = new NuGetPublishCfg(package, commandService); 82 | } 83 | 84 | /// 85 | /// This function is the callback used to execute the command when the menu item is clicked. 86 | /// See the constructor to see how the menu item is associated with this function using 87 | /// OleMenuCommandService service and MenuCommand class. 88 | /// 89 | /// Event sender. 90 | /// Event args. 91 | [SuppressMessage("Await.Warning", "CS4014:Await.Warning")] 92 | [SuppressMessage("Await.Warning", "VSTHRD110:Await.Warning")] 93 | private void Execute(object sender, EventArgs e) 94 | { 95 | ExecuteAsync(); 96 | } 97 | 98 | private async Task ExecuteAsync() 99 | { 100 | var project = await Project.GetActiveProjectAsync(); 101 | var projectType = await project.GetProjectTypeAsync(); 102 | if (projectType == ProjectType.Other) 103 | { 104 | VsShellUtilities.ShowMessageBox( 105 | package, 106 | "Extension currently works for Xamarin.Android, Xamarin.iOS and UWP projects", 107 | Vsix.Name, 108 | OLEMSGICON.OLEMSGICON_INFO, 109 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 110 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 111 | return; 112 | } 113 | 114 | string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); 115 | string title = "NuGet Publish Settings"; 116 | 117 | // Show a message box to prove we were here 118 | VsShellUtilities.ShowMessageBox( 119 | this.package, 120 | message, 121 | title, 122 | OLEMSGICON.OLEMSGICON_INFO, 123 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 124 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 125 | } 126 | 127 | private void OnBeforeQueryStatusDynamicItem(object sender, EventArgs args) 128 | { 129 | var pType = ThreadHelper.JoinableTaskFactory.Run(async delegate 130 | { 131 | var p = await Project.GetActiveProjectAsync(); 132 | return await p.GetProjectTypeAsync(); 133 | }); 134 | 135 | 136 | DynamicItemMenuCommand matchedCommand = (DynamicItemMenuCommand)sender; 137 | matchedCommand.Enabled = pType == ProjectType.CPS; 138 | //matchedCommand.Visible = pType == ProjectType.CPS; 139 | return; 140 | 141 | //// Find out whether the command ID is 0, which is the ID of the root item. 142 | //// If it is the root item, it matches the constructed DynamicItemMenuCommand, 143 | //// and IsValidDynamicItem won't be called. 144 | bool isRootItem = (matchedCommand.MatchedCommandId == 0); 145 | 146 | // The index is set to 1 rather than 0 because the Solution.Projects collection is 1-based. 147 | int indexForDisplay = (isRootItem ? 1 : (matchedCommand.MatchedCommandId - (int)NuGetPublishCfg.CommandId) + 1); 148 | 149 | //matchedCommand.Text = dte2.Solution.Projects.Item(indexForDisplay).Name; 150 | 151 | //Array startupProjects = (Array)dte2.Solution.SolutionBuild.StartupProjects; 152 | //string startupProject = System.IO.Path.GetFileNameWithoutExtension((string)startupProjects.GetValue(0)); 153 | 154 | //// Check the command if it isn't checked already selected 155 | //matchedCommand.Checked = (matchedCommand.Text == startupProject); 156 | 157 | //// Clear the ID because we are done with this item. 158 | //matchedCommand.MatchedCommandId = 0; 159 | } 160 | 161 | private bool IsValidDynamicItem(int commandId) 162 | { 163 | // The match is valid if the command ID is >= the id of our root dynamic start item 164 | // and the command ID minus the ID of our root dynamic start item 165 | // is less than or equal to the number of projects in the solution. 166 | return (commandId >= (int)NuGetPublishCfg.CommandId);// && ((commandId - (int)NuGetPublishCfg.CommandId) < dte2.Solution.Projects.Count); 167 | } 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/Extensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio; 2 | using Microsoft.VisualStudio.Shell; 3 | using Microsoft.VisualStudio.Shell.Interop; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace SS.NuGet.Publish.VisualStudio.AddIn 11 | { 12 | static class Extensions 13 | { 14 | public static void Ouptut(this string text) 15 | { 16 | if (string.IsNullOrEmpty(text)) 17 | return; 18 | 19 | var outputText = new StringBuilder(); 20 | outputText.Append(text); 21 | 22 | if (!text.EndsWith(Environment.NewLine)) 23 | outputText.Append(Environment.NewLine); 24 | 25 | if (!(Package.GetGlobalService(typeof(SVsOutputWindow)) is IVsOutputWindow outWindow)) 26 | return; 27 | var generalPaneGuid = VSConstants.GUID_OutWindowDebugPane; 28 | outWindow.GetPane(ref generalPaneGuid, out IVsOutputWindowPane generalPane); 29 | generalPane?.OutputString($"{outputText}"); 30 | generalPane?.Activate(); 31 | } 32 | public static Guid? GetGuidProperty(this IVsHierarchy hierarchy, uint itemId, int propId) 33 | { 34 | if (hierarchy == null) 35 | return null; 36 | 37 | if (hierarchy.GetGuidProperty(itemId, propId, out Guid guid) != 0) 38 | return null; 39 | 40 | return guid; 41 | } 42 | 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplerSoftware/SS.NuGet.Publish/597083fc610650c87d22ccfba1a6eda73f03b3dc/src/SS.NuGet.Publish.VisualStudio.AddIn/Key.snk -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/Project.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using Microsoft.VisualStudio; 3 | using Microsoft.VisualStudio.ProjectSystem; 4 | using Microsoft.VisualStudio.ProjectSystem.Properties; 5 | using Microsoft.VisualStudio.Shell; 6 | using Microsoft.VisualStudio.Shell.Flavor; 7 | using Microsoft.VisualStudio.Shell.Interop; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.IO; 11 | using System.Linq; 12 | using System.Text; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | 16 | namespace SS.NuGet.Publish.VisualStudio.AddIn 17 | { 18 | public class Project 19 | { 20 | private readonly EnvDTE.Project _vsProject; 21 | 22 | public Project(EnvDTE.Project project) 23 | { 24 | this._vsProject = project; 25 | } 26 | 27 | public string GetRootDirectory() 28 | { 29 | ThreadHelper.ThrowIfNotOnUIThread(); 30 | return Path.GetDirectoryName(this._vsProject.FileName); 31 | } 32 | 33 | public void AddFile(string filename, string type) 34 | { 35 | ThreadHelper.ThrowIfNotOnUIThread(); 36 | var file = this._vsProject.ProjectItems.AddFromFile(filename); 37 | file.Properties.Item("ItemType").Value = type; 38 | } 39 | 40 | public void Save() 41 | { 42 | ThreadHelper.ThrowIfNotOnUIThread(); 43 | this._vsProject.Save(); 44 | } 45 | 46 | public async Task GetProjectTypeAsync(CancellationToken cancellationToken = default(CancellationToken)) 47 | { 48 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 49 | var solution = await ServiceLocator.GetGlobalServiceAsync(cancellationToken); 50 | if (solution == null) return ProjectType.Other; 51 | var _Configuration = "Debug"; 52 | var _Platform = "Any CPU"; 53 | 54 | solution.GetProjectOfUniqueName(this._vsProject.UniqueName, out IVsHierarchy hierarchy); 55 | if (IsCpsProject(hierarchy)) 56 | { 57 | /* 58 | //Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject 59 | UnconfiguredProject unconfiguredProject = GetUnconfiguredProject(this._vsProject); // obtained from above 60 | //var configuredProject = await unconfiguredProject.GetSuggestedConfiguredProjectAsync(); 61 | //var pCfg = unconfiguredProject.LoadedConfiguredProjects.Where(c => c.ProjectConfiguration.Name == "Release|AnyCPU").SingleOrDefault().ProjectConfiguration; 62 | var d = System.Collections.Immutable.ImmutableDictionary.Empty; 63 | d = d.Add("Configuration", _Configuration); 64 | d = d.Add("Platform", _Platform); 65 | var configuredProject = await unconfiguredProject.LoadConfiguredProjectAsync($"{_Configuration}|{_Platform}", d); 66 | //Debug|AnyCPU 67 | //unconfiguredProject.LoadedConfiguredProjects.FirstOrDefault().Services.ProjectService.Services.ProjectLockService; 68 | IProjectLockService projectLockService = unconfiguredProject.ProjectService.Services.ProjectLockService; 69 | using (var access = await projectLockService.WriteLockAsync(cancellationToken)) 70 | { 71 | //configuredProject.Services. 72 | var project = await access.GetProjectAsync(configuredProject, cancellationToken); 73 | 74 | // Use the msbuild project, respecting the type of lock acquired. 75 | 76 | // If you're going to change the project in any way, 77 | // check it out from SCC first: 78 | await access.CheckoutAsync(configuredProject.UnconfiguredProject.FullPath); 79 | $"Imports: {project.Imports.Count}".Ouptut(); 80 | $"Targets: {project.Targets.Count}".Ouptut(); 81 | $"Properties: {project.Properties.Count}".Ouptut(); 82 | foreach (var prop in project.Properties.Where(p => p.Name.StartsWith("NuGetPublish"))) 83 | { 84 | $"{prop.Name}: [{prop.UnevaluatedValue}] = [{prop.EvaluatedValue}]".Ouptut(); 85 | $"\tIsEnvironmentProperty: [{prop.IsEnvironmentProperty}]".Ouptut(); 86 | $"\tIsGlobalProperty: [{prop.IsGlobalProperty}]".Ouptut(); 87 | $"\tIsImported: [{prop.IsImported}]".Ouptut(); 88 | $"\tIsReservedProperty: [{prop.IsReservedProperty}]".Ouptut(); 89 | $"\tPredecessor: [{prop.Predecessor == null}]".Ouptut(); 90 | } 91 | //project.SetProperty($"NuGetPublishLocation", @"D:\References\Packages\"); 92 | } 93 | VsHierarchy hierarchy1 = null; 94 | var sol = Package.GetGlobalService(typeof(SVsSolution)) as IVsSolution; 95 | sol.GetProjectOfUniqueName(project.UniqueName, out hierarchy1); 96 | 97 | IVsSolutionBuildManager bm = Package.GetGlobalService(typeof(IVsSolutionBuildManager)) as IVsSolutionBuildManager; 98 | 99 | IVsProjectCfg[] cfgs = new IVsProjectCfg[1]; 100 | bm.FindActiveProjectCfg(IntPtr.Zero, IntPtr.Zero, hierarchy1, cfgs); 101 | 102 | IVsCfg cfg = cfgs[0] as IVsCfg; 103 | */ 104 | return ProjectType.CPS; 105 | } 106 | //var proStor = hierarchy as IVsBuildPropertyStorage; 107 | //var result1 = proStor.GetPropertyValue("NuGetPublishVersion", $"{_Configuration}|{_Platform}", (int)_PersistStorageType.PST_PROJECT_FILE, out string propValue); 108 | //$"result1: {result1}".Ouptut(); 109 | //$"propValue: {propValue}".Ouptut(); 110 | //var result2 = proStor.SetPropertyValue("NuGetPublishLocation", $"{_Configuration}|{_Platform}", (int)_PersistStorageType.PST_PROJECT_FILE, @"D:\References\Packages\"); 111 | //$"result2: {result2}".Ouptut(); 112 | 113 | if (hierarchy == null) return ProjectType.Other; 114 | 115 | var ap = hierarchy as IVsAggregatableProjectCorrected; 116 | if (ap == null) return ProjectType.Other; 117 | 118 | string projectTypeGuids; 119 | ap.GetAggregateProjectTypeGuids(out projectTypeGuids); 120 | if (string.IsNullOrEmpty(projectTypeGuids)) return ProjectType.Other; 121 | 122 | // check if UWP project 123 | //if (projectTypeGuids.Contains("{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A}")) return ProjectType.UWP; 124 | // check if android project 125 | //if (projectTypeGuids.Contains("{EFBA0AD7-5A72-4C68-AF49-83D382785DCF}")) return ProjectType.XamarinAndroid; 126 | // check if iOS project 127 | //if (projectTypeGuids.Contains("{FEACFBD2-3405-455C-9665-78FE426C6842}")) return ProjectType.XamariniOS; 128 | 129 | return ProjectType.Other; 130 | } 131 | 132 | internal bool IsCpsProject(IVsHierarchy hierarchy) 133 | { 134 | Microsoft.Requires.NotNull(hierarchy, nameof(hierarchy)); 135 | return hierarchy.IsCapabilityMatch("CPS"); 136 | } 137 | private UnconfiguredProject GetUnconfiguredProject(IVsProject project) 138 | { 139 | ThreadHelper.ThrowIfNotOnUIThread(); 140 | IVsBrowseObjectContext context = project as IVsBrowseObjectContext; 141 | if (context == null) 142 | { 143 | // VC implements this on their DTE.Project.Object 144 | if (project is IVsHierarchy hierarchy) 145 | { 146 | if (ErrorHandler.Succeeded(hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID.VSHPROPID_ExtObject, out object extObject))) 147 | { 148 | if (extObject is EnvDTE.Project dteProject) 149 | { 150 | context = dteProject.Object as IVsBrowseObjectContext; 151 | } 152 | } 153 | } 154 | } 155 | 156 | return context?.UnconfiguredProject; 157 | } 158 | 159 | private UnconfiguredProject GetUnconfiguredProject(EnvDTE.Project project) 160 | { 161 | ThreadHelper.ThrowIfNotOnUIThread(); 162 | IVsBrowseObjectContext context = project as IVsBrowseObjectContext; 163 | if (context == null && project != null) 164 | { 165 | // VC implements this on their DTE.Project.Object 166 | context = project.Object as IVsBrowseObjectContext; 167 | } 168 | 169 | return context?.UnconfiguredProject; 170 | } 171 | 172 | public static async Task GetActiveProjectAsync(CancellationToken cancellationToken = default(CancellationToken)) 173 | { 174 | var dteService = await ServiceLocator.GetGlobalServiceAsync(cancellationToken); 175 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 176 | var vsProject = ((object[])dteService.ActiveSolutionProjects) 177 | .Select(x => { 178 | ThreadHelper.ThrowIfNotOnUIThread(nameof(GetActiveProjectAsync)); 179 | return ((EnvDTE.Project)x); 180 | }) 181 | .FirstOrDefault(); 182 | 183 | return vsProject == null ? null : new Project(vsProject); 184 | } 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/ProjectType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SS.NuGet.Publish.VisualStudio.AddIn 8 | { 9 | public enum ProjectType 10 | { 11 | Other = 0, 12 | CPS = 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SS.NuGet.Publish.VisualStudio.AddIn")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SS.NuGet.Publish.VisualStudio.AddIn")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.1904.58")] 33 | [assembly: AssemblyFileVersion("1.0.1904.58")] 34 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/Resources/NuGetPublishCfg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplerSoftware/SS.NuGet.Publish/597083fc610650c87d22ccfba1a6eda73f03b3dc/src/SS.NuGet.Publish.VisualStudio.AddIn/Resources/NuGetPublishCfg.png -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/Resources/NuGetPublishCfgPackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplerSoftware/SS.NuGet.Publish/597083fc610650c87d22ccfba1a6eda73f03b3dc/src/SS.NuGet.Publish.VisualStudio.AddIn/Resources/NuGetPublishCfgPackage.ico -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/SS.NuGet.Publish.VisualStudio.AddIn.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 16.0 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | 7 | 8 | 9 | 10 | 11 | 12 | Debug 13 | AnyCPU 14 | 2.0 15 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 16 | {78F35082-367D-4378-828A-1937E0274A7C} 17 | Library 18 | Properties 19 | SS.NuGet.Publish.VisualStudio.AddIn 20 | SS.NuGet.Publish.VisualStudio.AddIn 21 | v4.7.2 22 | true 23 | true 24 | true 25 | false 26 | false 27 | true 28 | true 29 | Program 30 | $(DevEnvDir)devenv.exe 31 | /rootsuffix Exp 32 | 33 | 34 | true 35 | full 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | 42 | 43 | pdbonly 44 | true 45 | bin\Release\ 46 | TRACE 47 | prompt 48 | 4 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Designer 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | VSPackage 76 | Designer 77 | 78 | 79 | 80 | 81 | Menus.ctmenu 82 | Designer 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 16.0.200 95 | 96 | 97 | 16.1.3133 98 | runtime; build; native; contentfiles; analyzers; buildtransitive 99 | all 100 | 101 | 102 | 103 | 104 | 111 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/ServiceLocator.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using Microsoft.VisualStudio.Shell; 3 | using Microsoft.VisualStudio.Shell.Interop; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Diagnostics; 7 | using System.Diagnostics.CodeAnalysis; 8 | using System.Linq; 9 | using System.Runtime.InteropServices; 10 | using System.Text; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | using VsServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider; 14 | 15 | namespace SS.NuGet.Publish.VisualStudio.AddIn 16 | { 17 | internal static class ServiceLocator 18 | { 19 | public static void InitializePackageServiceProvider(IServiceProvider provider) 20 | { 21 | ThreadHelper.ThrowIfNotOnUIThread(); 22 | PackageServiceProvider = provider ?? throw new ArgumentNullException(nameof(provider)); 23 | } 24 | 25 | public static IServiceProvider PackageServiceProvider { get; private set; } 26 | 27 | 28 | //public static TInterface GetGlobalService() where TInterface : class 29 | //{ 30 | // return ThreadHelper.JoinableTaskFactory.Run(GetGlobalServiceAsync); 31 | //} 32 | 33 | internal static async Task GetGlobalServiceAsync(CancellationToken cancellationToken = default(CancellationToken)) where TInterface : class 34 | { 35 | // VS Threading Rule #1 36 | // Access to ServiceProvider and a lot of casts are performed in this method, 37 | // and so this method can RPC into main thread. Switch to main thread explicitly, since method has STA requirement 38 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 39 | 40 | if (PackageServiceProvider != null) 41 | { 42 | var result = PackageServiceProvider.GetService(typeof(TService)); 43 | if (result is TInterface service) 44 | return service; 45 | } 46 | 47 | return Package.GetGlobalService(typeof(TService)) as TInterface; 48 | } 49 | 50 | private static async Task GetDTEServiceAsync(CancellationToken cancellationToken = default(CancellationToken)) where TService : class 51 | { 52 | #if DEBUG 53 | var access = ThreadHelper.CheckAccess(); 54 | Debug.Assert(access); 55 | #endif 56 | var dte = await GetGlobalServiceAsync(cancellationToken); 57 | return dte != null ? QueryService(dte, typeof(TService)) as TService : null; 58 | } 59 | 60 | private static async Task GetServiceProviderAsync(CancellationToken cancellationToken = default(CancellationToken)) 61 | { 62 | #if DEBUG 63 | var access = ThreadHelper.CheckAccess(); 64 | Debug.Assert(access); 65 | #endif 66 | var dte = await GetGlobalServiceAsync(cancellationToken); 67 | return GetServiceProviderFromDTE(dte); 68 | } 69 | 70 | private static object QueryService(_DTE dte, Type serviceType) 71 | { 72 | ThreadHelper.ThrowIfNotOnUIThread(); 73 | #if DEBUG 74 | var access = ThreadHelper.CheckAccess(); 75 | Debug.Assert(access); 76 | #endif 77 | Guid guidService = serviceType.GUID; 78 | Guid riid = guidService; 79 | var serviceProvider = dte as VsServiceProvider; 80 | 81 | IntPtr servicePtr; 82 | int hr = serviceProvider.QueryService(ref guidService, ref riid, out servicePtr); 83 | 84 | if (hr != 0/*NuGetVSConstants.S_OK*/) 85 | { 86 | // We didn't find the service so return null 87 | return null; 88 | } 89 | 90 | object service = null; 91 | 92 | if (servicePtr != IntPtr.Zero) 93 | { 94 | service = Marshal.GetObjectForIUnknown(servicePtr); 95 | Marshal.Release(servicePtr); 96 | } 97 | 98 | return service; 99 | } 100 | 101 | [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "The caller is responsible for disposing this")] 102 | private static IServiceProvider GetServiceProviderFromDTE(_DTE dte) 103 | { 104 | ThreadHelper.ThrowIfNotOnUIThread(); 105 | #if DEBUG 106 | var access = ThreadHelper.CheckAccess(); 107 | Debug.Assert(access); 108 | #endif 109 | IServiceProvider serviceProvider = new ServiceProvider(dte as VsServiceProvider); 110 | Debug.Assert(serviceProvider != null, "Service provider is null"); 111 | return serviceProvider; 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/VSCommandTable.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 33 | 34 | 38 | 39 | 40 | 42 | 43 | 50 | 60 | 61 | 62 | 63 | 64 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/VSPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Diagnostics; 4 | using System.Diagnostics.CodeAnalysis; 5 | using System.Globalization; 6 | using System.Runtime.InteropServices; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using Microsoft.VisualStudio; 10 | using Microsoft.VisualStudio.OLE.Interop; 11 | using Microsoft.VisualStudio.Shell; 12 | using Microsoft.VisualStudio.Shell.Interop; 13 | using Microsoft.Win32; 14 | using SS.NuGet.Publish.VisualStudio.AddIn.Commands; 15 | using Task = System.Threading.Tasks.Task; 16 | 17 | namespace SS.NuGet.Publish.VisualStudio.AddIn 18 | { 19 | /// 20 | /// This is the class that implements the package exposed by this assembly. 21 | /// 22 | /// 23 | /// 24 | /// The minimum requirement for a class to be considered a valid package for Visual Studio 25 | /// is to implement the IVsPackage interface and register itself with the shell. 26 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF) 27 | /// to do it: it derives from the Package class that provides the implementation of the 28 | /// IVsPackage interface and uses the registration attributes defined in the framework to 29 | /// register itself and its components with the shell. These attributes tell the pkgdef creation 30 | /// utility what data to put into .pkgdef file. 31 | /// 32 | /// 33 | /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file. 34 | /// 35 | /// 36 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 37 | [InstalledProductRegistration("#2110", "#2112", "1.0", IconResourceID = 2400)] // Info on this package for Help/About 38 | [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_string, PackageAutoLoadFlags.BackgroundLoad)] 39 | [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExists_string, PackageAutoLoadFlags.BackgroundLoad)] 40 | [ProvideMenuResource("Menus.ctmenu", 1)] 41 | [Guid(VSPackage.PackageGuidString)] 42 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 43 | public sealed class VSPackage : AsyncPackage 44 | { 45 | /// 46 | /// VSPackage GUID string. 47 | /// 48 | public const string PackageGuidString = "8a484bcd-7c5e-4cc1-aa50-7ba70733de2f"; 49 | 50 | /// 51 | /// Initializes a new instance of the class. 52 | /// 53 | public VSPackage() 54 | { 55 | // Inside this method you can place any initialization code that does not require 56 | // any Visual Studio service because at this point the package object is created but 57 | // not sited yet inside Visual Studio environment. The place to do all the other 58 | // initialization is the Initialize method. 59 | } 60 | 61 | #region Package Members 62 | /// 63 | /// Initialization of the package; this method is called right after the package is sited, so this is the place 64 | /// where you can put all the initialization code that rely on services provided by VisualStudio. 65 | /// 66 | /// A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down. 67 | /// A provider for progress updates. 68 | /// A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method. 69 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 70 | { 71 | // When initialized asynchronously, the current thread may be a background thread at this point. 72 | // Do any initialization that requires the UI thread after switching to the UI thread. 73 | await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 74 | 75 | await NuGetPublishCfg.InitializeAsync(this); 76 | } 77 | 78 | #endregion 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/VSPackage.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | NuGetPublishCfg Extension 122 | 123 | 124 | NuGetPublishCfg Visual Stuido Extension Detailed Info 125 | 126 | 127 | 128 | Resources\NuGetPublishCfgPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/Vsix.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SS.NuGet.Publish.VisualStudio.AddIn 8 | { 9 | static class Vsix 10 | { 11 | public const string Id = "SS.NuGet.Publish.VisualStudio.AddIn.7c3fe08a-1506-4d00-8e59-ca7b6fc6f62c"; 12 | public const string Name = "NuGet Publish VisualStudio AddIn"; 13 | public const string Description = @"UI dialogs that complement the SS.NuGet.Publish nuget package. Add the nuget package to your project to automate nuget publishing with each build."; 14 | public const string Language = "en-US"; 15 | public const string Version = "1.0.1904.18"; 16 | public const string Author = "Simpler Software"; 17 | public const string Tags = "nuget,publish,target,msbuild"; 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio.AddIn/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | NuGet Publish VisualStudio AddIn 6 | UI dialogs that complement the SS.NuGet.Publish nuget package. Add the nuget package to your project to automate nuget publishing with each build. 7 | nuget,publish,target,msbuild 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Win32; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace SS.NuGet.Publish.VisualStudio 10 | { 11 | class Program 12 | { 13 | static void Main(string[] args) 14 | { 15 | Register(typeof(PublishPackagePageProvider)); 16 | } 17 | 18 | static void Register(Type type) 19 | { 20 | string ProgID = type.FullName; 21 | string Version = type.Assembly.GetName().Version.ToString(); 22 | string GUIDstr = "{" + type.GUID.ToString() + "}"; 23 | string keyPath = @"Software\Classes\"; 24 | 25 | 26 | RegistryKey regularx86View = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32); 27 | 28 | RegistryKey regularx64View = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64); 29 | 30 | RegistryKey[] keys = {regularx86View.OpenSubKey(keyPath, RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.FullControl), 31 | regularx64View.OpenSubKey(keyPath, RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.FullControl)}; 32 | 33 | 34 | ProgIdAttribute[] attributes = (ProgIdAttribute[])type.GetCustomAttributes(typeof(ProgIdAttribute), false); 35 | 36 | if (attributes.Length > 0) 37 | ProgID = attributes[0].Value; 38 | 39 | foreach (RegistryKey RootKey in keys) 40 | { 41 | //[HKEY_CURRENT_USER\Software\Classes\Prog.ID] 42 | //@="Namespace.Class" 43 | 44 | RegistryKey keyProgID = RootKey.CreateSubKey(ProgID); 45 | keyProgID.SetValue(null, type.FullName); 46 | 47 | //[HKEY_CURRENT_USER\Software\Classes\Prog.ID\CLSID] 48 | //@="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" 49 | keyProgID.CreateSubKey(@"CLSID").SetValue(null, GUIDstr); 50 | 51 | 52 | //[HKEY_CURRENT_USER\Software\Classes\CLSID\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}] 53 | //@="Namespace.Class 54 | // 55 | RegistryKey keyCLSID = RootKey.OpenSubKey(@"CLSID", RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.FullControl).CreateSubKey(GUIDstr); 56 | keyCLSID.SetValue(null, type.FullName); 57 | 58 | 59 | //[HKEY_CURRENT_USER\Software\Classes\CLSID\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}\ProgId] 60 | //@="Prog.ID" 61 | keyCLSID.CreateSubKey("ProgId").SetValue(null, ProgID); 62 | 63 | 64 | //[HKEY_CURRENT_USER\Software\Classes\CLSID\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}\InprocServer32] 65 | //@="mscoree.dll" 66 | //"ThreadingModel"="Both" 67 | //"Class"="Namespace.Class" 68 | //"Assembly"="AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=71c72075855a359a" 69 | //"RuntimeVersion"="v4.0.30319" 70 | //"CodeBase"="file:///Drive:/Full/Image/Path/file.dll" 71 | RegistryKey InprocServer32 = keyCLSID.CreateSubKey("InprocServer32"); 72 | SetInprocServer(InprocServer32, type, false); 73 | 74 | //[HKEY_CURRENT_USER\Software\Classes\CLSID\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}\InprocServer32\1.0.0.0] 75 | //"Class"="Namespace.Class" 76 | //"Assembly"="AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=71c72075855a359a" 77 | //"RuntimeVersion"="v4.0.30319" 78 | //"CodeBase"="file:///Drive:/Full/Image/Path/file.dll" 79 | SetInprocServer(InprocServer32.CreateSubKey("Version"), type, true); 80 | 81 | //[HKEY_CURRENT_USER\Software\Classes\CLSID\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}\Implemented Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}] 82 | keyCLSID.CreateSubKey(@"Implemented Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}"); 83 | 84 | keyCLSID.Close(); 85 | } 86 | 87 | } 88 | 89 | static void SetInprocServer(RegistryKey key, Type type, bool versionNode) 90 | { 91 | 92 | if (!versionNode) 93 | { 94 | key.SetValue(null, "mscoree.dll"); 95 | key.SetValue("ThreadingModel", "Both"); 96 | } 97 | 98 | key.SetValue("Class", type.FullName); 99 | key.SetValue("Assembly", type.Assembly.FullName); 100 | key.SetValue("RuntimeVersion", type.Assembly.ImageRuntimeVersion); 101 | key.SetValue("CodeBase", type.Assembly.CodeBase); 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PublishPackagePageControl")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("PublishPackagePageControl")] 13 | [assembly: AssemblyCopyright("Copyright © Simpler Softwre 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1cba1375-2301-480a-8841-6891889ea8b6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.1904.47")] 36 | [assembly: AssemblyFileVersion("1.0.1904.47")] 37 | 38 | [assembly: AssemblyInformationalVersion("1.0.1904")] -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio/PublishPackagePageControl.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SS.NuGet.Publish.VisualStudio 2 | { 3 | partial class PublishPackagePageControl 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // PublishPackagePageControl 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.Name = "PublishPackagePageControl"; 38 | this.Size = new System.Drawing.Size(1048, 720); 39 | this.ResumeLayout(false); 40 | 41 | } 42 | 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio/PublishPackagePageControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Microsoft.VisualStudio.Editors.PropertyPages; 11 | 12 | namespace SS.NuGet.Publish.VisualStudio 13 | { 14 | public partial class PublishPackagePageControl : 15 | #if DESIGN_TIME 16 | PropPageUserControlBase 17 | #else 18 | UserControl 19 | #endif 20 | { 21 | public PublishPackagePageControl() 22 | { 23 | InitializeComponent(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio/PublishPackagePageControl.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio/PublishPackagePageProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Editors.PropertyPages; 2 | using Microsoft.VisualStudio.Shell; 3 | using SS.NuGet.Publish.VisualStudio; 4 | using System; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using System.Windows.Forms; 8 | 9 | namespace SS.NuGet.Publish 10 | { 11 | [ComVisible(true)] 12 | [Guid("AA790F50-5208-41F5-89B2-D3733E12BE1D")] 13 | [ProvideObject(typeof(PublishPackagePageProvider))] 14 | public class PublishPackagePageProvider : PropPageBase 15 | { 16 | protected override Type ControlType 17 | { 18 | get 19 | { 20 | return typeof(PublishPackagePageControl); 21 | } 22 | } 23 | 24 | protected override string Title 25 | { 26 | get { return "Publish Package"; } 27 | } 28 | 29 | protected override Control CreateControl() 30 | { 31 | return new PublishPackagePageControl(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio/SS.NuGet.Publish.VisualStudio.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1CBA1375-2301-480A-8841-6891889EA8B6} 8 | Exe 9 | SS.NuGet.Publish.VisualStudio 10 | SS.NuGet.Publish.VisualStudio 11 | v4.8 12 | 512 13 | true 14 | 15 | true 16 | 17 | 18 | win 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | UserControl 58 | 59 | 60 | PublishPackagePageControl.cs 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | PublishPackagePageControl.cs 71 | 72 | 73 | 74 | 75 | 15.0.6142705 76 | 77 | 78 | 16.1.3133 79 | runtime; build; native; contentfiles; analyzers; buildtransitive 80 | all 81 | 82 | 83 | 84 | 85 | xcopy /y "$(TargetPath)" "$(SolutionDir)SS.NuGet.Publish\tools\" 86 | 87 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.VisualStudio/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29020.237 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SS.NuGet.Publish", "SS.NuGet.Publish\SS.NuGet.Publish.csproj", "{6AF4B709-5099-456F-84B4-AA24EAA847B1}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {1CBA1375-2301-480A-8841-6891889EA8B6} = {1CBA1375-2301-480A-8841-6891889EA8B6} 9 | EndProjectSection 10 | EndProject 11 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SS.NuGet.Publish.Test", "SS.NuGet.Publish.Test\SS.NuGet.Publish.Test.csproj", "{33D444C6-0B38-4DF5-A09E-102467154CB8}" 12 | EndProject 13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SS.NuGet.Publish.VisualStudio", "SS.NuGet.Publish.VisualStudio\SS.NuGet.Publish.VisualStudio.csproj", "{1CBA1375-2301-480A-8841-6891889EA8B6}" 14 | EndProject 15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SS.NuGet.Publish.VisualStudio.AddIn", "SS.NuGet.Publish.VisualStudio.AddIn\SS.NuGet.Publish.VisualStudio.AddIn.csproj", "{78F35082-367D-4378-828A-1937E0274A7C}" 16 | EndProject 17 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{8D4C68B6-A189-4148-85FA-4BAA2B75371C}" 18 | EndProject 19 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{83CE8CD1-8372-4E24-AA5A-8995F6C515CB}" 20 | ProjectSection(SolutionItems) = preProject 21 | ..\ReadMe.md = ..\ReadMe.md 22 | EndProjectSection 23 | EndProject 24 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{DD2EC1CA-DA44-40EE-9C8E-F99CC27EABF9}" 25 | ProjectSection(SolutionItems) = preProject 26 | ..\build\PublishToGallery.ps1 = ..\build\PublishToGallery.ps1 27 | ..\build\Update-ModuleManifest.ps1 = ..\build\Update-ModuleManifest.ps1 28 | EndProjectSection 29 | EndProject 30 | Global 31 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 32 | Debug|Any CPU = Debug|Any CPU 33 | Release|Any CPU = Release|Any CPU 34 | EndGlobalSection 35 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 36 | {6AF4B709-5099-456F-84B4-AA24EAA847B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {6AF4B709-5099-456F-84B4-AA24EAA847B1}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {6AF4B709-5099-456F-84B4-AA24EAA847B1}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {6AF4B709-5099-456F-84B4-AA24EAA847B1}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {33D444C6-0B38-4DF5-A09E-102467154CB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {33D444C6-0B38-4DF5-A09E-102467154CB8}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {33D444C6-0B38-4DF5-A09E-102467154CB8}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {1CBA1375-2301-480A-8841-6891889EA8B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 44 | {1CBA1375-2301-480A-8841-6891889EA8B6}.Debug|Any CPU.Build.0 = Debug|Any CPU 45 | {1CBA1375-2301-480A-8841-6891889EA8B6}.Release|Any CPU.ActiveCfg = Release|Any CPU 46 | {1CBA1375-2301-480A-8841-6891889EA8B6}.Release|Any CPU.Build.0 = Release|Any CPU 47 | {78F35082-367D-4378-828A-1937E0274A7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 48 | {78F35082-367D-4378-828A-1937E0274A7C}.Debug|Any CPU.Build.0 = Debug|Any CPU 49 | {78F35082-367D-4378-828A-1937E0274A7C}.Release|Any CPU.ActiveCfg = Release|Any CPU 50 | EndGlobalSection 51 | GlobalSection(SolutionProperties) = preSolution 52 | HideSolutionNode = FALSE 53 | EndGlobalSection 54 | GlobalSection(NestedProjects) = preSolution 55 | {6AF4B709-5099-456F-84B4-AA24EAA847B1} = {8D4C68B6-A189-4148-85FA-4BAA2B75371C} 56 | {33D444C6-0B38-4DF5-A09E-102467154CB8} = {8D4C68B6-A189-4148-85FA-4BAA2B75371C} 57 | {1CBA1375-2301-480A-8841-6891889EA8B6} = {8D4C68B6-A189-4148-85FA-4BAA2B75371C} 58 | {78F35082-367D-4378-828A-1937E0274A7C} = {8D4C68B6-A189-4148-85FA-4BAA2B75371C} 59 | EndGlobalSection 60 | GlobalSection(ExtensibilityGlobals) = postSolution 61 | SolutionGuid = {582B6967-0DF2-4969-AAE3-954F1FFE4271} 62 | EndGlobalSection 63 | EndGlobal 64 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish/SS.NuGet.Publish.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | Automate publishing a project's nuget package during build process. 6 | 1.0.2311.02 7 | 1.0.2311.20 8 | MIT 9 | 1.0.2311-beta-02 10 | Simpler Software 11 | Simpler Software 12 | NuGet Publish MSBuild target 13 | NuGet Publish MSBuild target 14 | Copyright © Simpler Software 2019 15 | nuget;publish;target;msbuild 16 | nuget_256.png 17 | https://raw.githubusercontent.com/NuGet/Media/master/Images/MainLogo/256x256/nuget_256.png 18 | true 19 | false 20 | true 21 | https://github.com/SimplerSoftware/SS.NuGet.Publish 22 | GIT 23 | https://github.com/SimplerSoftware/SS.NuGet.Publish 24 | ReadMe.md 25 | 26 | 27 | 28 | True 29 | False 30 | False 31 | False 32 | False 33 | True 34 | AssemblyVersion.None.Beta 35 | SettingsVersion 36 | None 37 | 38 | 39 | 40 | C:\Packages 41 | true 42 | 43 | 44 | 45 | True 46 | False 47 | False 48 | False 49 | False 50 | True 51 | AssemblyVersion.None.None 52 | SettingsVersion 53 | None 54 | 1701;1702 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | build\;buildCrossTargeting\ 68 | true 69 | 70 | 71 | true 72 | build\;buildCrossTargeting\ 73 | 74 | 75 | 76 | 77 | 78 | all 79 | runtime; build; native; contentfiles; analyzers; buildtransitive 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 6.8.0 88 | $(UserProfile)\.nuget\$(NuGetPublishVersion)\ 89 | 90 | add 91 | push 92 | add 93 | push 94 | 95 | -SkipDuplicate 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish/SS.NuGet.Publish.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | {AA790F50-5208-41F5-89B2-D3733E12BE1D} 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish/SS.NuGet.Publish.targets: -------------------------------------------------------------------------------- 1 |  2 | 3 | {AA790F50-5208-41F5-89B2-D3733E12BE1D} 4 | 6.8.0 5 | $(UserProfile)\.nuget\$(NuGetPublishVersion)\ 6 | 7 | add 8 | push 9 | add 10 | push 11 | 12 | -SkipDuplicate 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/SS.NuGet.Publish/nuget_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplerSoftware/SS.NuGet.Publish/597083fc610650c87d22ccfba1a6eda73f03b3dc/src/SS.NuGet.Publish/nuget_256.png --------------------------------------------------------------------------------