├── .gitignore
├── LICENSE.txt
├── README.md
├── release_notes.txt
├── screenshots
├── 1.0
│ ├── deploy-window.PNG
│ └── solution-menu.png
├── 1.x
│ ├── batch-assembly-info.PNG
│ ├── deploy-1.PNG
│ ├── deploy-2.PNG
│ ├── deploy-3.PNG
│ ├── project-menu.png
│ └── sln_menu.png
├── 17.x
│ ├── deploy_context_menu.png
│ ├── migrate_nuspec.png
│ ├── nuget_manifest.png
│ ├── pack_push.png
│ └── upgrade_classic_projects.png
└── 2.x
│ ├── AssemblyInfoCommandMenu.png
│ ├── AssemblyInfoDialog.png
│ ├── DeployCommandMenu.png
│ ├── DeployDialog.png
│ ├── DirectoryBuildPropsCommandMenu.png
│ ├── NuspecCommandMenu.png
│ └── PackageMetadataDialog.png
└── src
├── Commands
├── AssemblyInfoEditCommand.cs
├── DeployPackageCommand.cs
└── MigrateNuspecToProjectCommand.cs
├── Common.cs
├── Config
└── NuPackConfig.cs
├── Controls
├── ControlExtensions.cs
├── PackOptionsControl.Designer.cs
├── PackOptionsControl.cs
├── PackOptionsControl.resx
├── PackageMetadataControl.Designer.cs
├── PackageMetadataControl.cs
└── PackageMetadataControl.resx
├── Extensions
├── NuGetExtensions.cs
├── ServiceProviderExtensions.cs
└── SolutionDataCache.cs
├── Forms
├── AssemblyInfoForm.Designer.cs
├── AssemblyInfoForm.cs
├── AssemblyInfoForm.resx
├── DeployWizard.Designer.cs
├── DeployWizard.cs
├── DeployWizard.resx
├── LoadingForm.cs
├── LoadingForm.designer.cs
└── LoadingForm.resx
├── LICENSE.txt
├── Models
├── ManifestMetadataViewModel.cs
├── PackArgs.cs
└── PushArgs.cs
├── NuPack.csproj
├── NuPack.sln
├── NuPackPackage.cs
├── NuPackPackage.vsct
├── NuPackPackage1.cs
├── Properties
└── AssemblyInfo.cs
├── Resource.Designer.cs
├── Resource.resx
├── Resources
├── AssemblyInfoFile.png
├── Close.png
├── HelpIndexFile.png
├── PackageDeployment.png
├── PackageProperty.png
├── attribute.png
├── exchange.png
├── folder.png
├── licenses.json
├── loading32.gif
├── logo.ico
├── nuget.ico
├── reload32.png
└── zip.ico
├── Util
├── CmdUtil.cs
├── DirectoryBuildUtil.cs
├── LicenseReader.cs
├── NuGetConfigReader.cs
├── Validation.cs
├── VersionUtil.cs
└── XmlTextFormatter.cs
├── release_notes.txt
├── screenshots.png
└── source.extension.vsixmanifest
/.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/main/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # ASP.NET Scaffolding
66 | ScaffoldingReadMe.txt
67 |
68 | # StyleCop
69 | StyleCopReport.xml
70 |
71 | # Files built by Visual Studio
72 | *_i.c
73 | *_p.c
74 | *_h.h
75 | *.ilk
76 | *.meta
77 | *.obj
78 | *.iobj
79 | *.pch
80 | *.pdb
81 | *.ipdb
82 | *.pgc
83 | *.pgd
84 | *.rsp
85 | # but not Directory.Build.rsp, as it configures directory-level build defaults
86 | !Directory.Build.rsp
87 | *.sbr
88 | *.tlb
89 | *.tli
90 | *.tlh
91 | *.tmp
92 | *.tmp_proj
93 | *_wpftmp.csproj
94 | *.log
95 | *.tlog
96 | *.vspscc
97 | *.vssscc
98 | .builds
99 | *.pidb
100 | *.svclog
101 | *.scc
102 |
103 | # Chutzpah Test files
104 | _Chutzpah*
105 |
106 | # Visual C++ cache files
107 | ipch/
108 | *.aps
109 | *.ncb
110 | *.opendb
111 | *.opensdf
112 | *.sdf
113 | *.cachefile
114 | *.VC.db
115 | *.VC.VC.opendb
116 |
117 | # Visual Studio profiler
118 | *.psess
119 | *.vsp
120 | *.vspx
121 | *.sap
122 |
123 | # Visual Studio Trace Files
124 | *.e2e
125 |
126 | # TFS 2012 Local Workspace
127 | $tf/
128 |
129 | # Guidance Automation Toolkit
130 | *.gpState
131 |
132 | # ReSharper is a .NET coding add-in
133 | _ReSharper*/
134 | *.[Rr]e[Ss]harper
135 | *.DotSettings.user
136 |
137 | # TeamCity is a build add-in
138 | _TeamCity*
139 |
140 | # DotCover is a Code Coverage Tool
141 | *.dotCover
142 |
143 | # AxoCover is a Code Coverage Tool
144 | .axoCover/*
145 | !.axoCover/settings.json
146 |
147 | # Coverlet is a free, cross platform Code Coverage Tool
148 | coverage*.json
149 | coverage*.xml
150 | coverage*.info
151 |
152 | # Visual Studio code coverage results
153 | *.coverage
154 | *.coveragexml
155 |
156 | # NCrunch
157 | _NCrunch_*
158 | .*crunch*.local.xml
159 | nCrunchTemp_*
160 |
161 | # MightyMoose
162 | *.mm.*
163 | AutoTest.Net/
164 |
165 | # Web workbench (sass)
166 | .sass-cache/
167 |
168 | # Installshield output folder
169 | [Ee]xpress/
170 |
171 | # DocProject is a documentation generator add-in
172 | DocProject/buildhelp/
173 | DocProject/Help/*.HxT
174 | DocProject/Help/*.HxC
175 | DocProject/Help/*.hhc
176 | DocProject/Help/*.hhk
177 | DocProject/Help/*.hhp
178 | DocProject/Help/Html2
179 | DocProject/Help/html
180 |
181 | # Click-Once directory
182 | publish/
183 |
184 | # Publish Web Output
185 | *.[Pp]ublish.xml
186 | *.azurePubxml
187 | # Note: Comment the next line if you want to checkin your web deploy settings,
188 | # but database connection strings (with potential passwords) will be unencrypted
189 | *.pubxml
190 | *.publishproj
191 |
192 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
193 | # checkin your Azure Web App publish settings, but sensitive information contained
194 | # in these scripts will be unencrypted
195 | PublishScripts/
196 |
197 | # NuGet Packages
198 | *.nupkg
199 | # NuGet Symbol Packages
200 | *.snupkg
201 | # The packages folder can be ignored because of Package Restore
202 | **/[Pp]ackages/*
203 | # except build/, which is used as an MSBuild target.
204 | !**/[Pp]ackages/build/
205 | # Uncomment if necessary however generally it will be regenerated when needed
206 | #!**/[Pp]ackages/repositories.config
207 | # NuGet v3's project.json files produces more ignorable files
208 | *.nuget.props
209 | *.nuget.targets
210 |
211 | # Microsoft Azure Build Output
212 | csx/
213 | *.build.csdef
214 |
215 | # Microsoft Azure Emulator
216 | ecf/
217 | rcf/
218 |
219 | # Windows Store app package directories and files
220 | AppPackages/
221 | BundleArtifacts/
222 | Package.StoreAssociation.xml
223 | _pkginfo.txt
224 | *.appx
225 | *.appxbundle
226 | *.appxupload
227 |
228 | # Visual Studio cache files
229 | # files ending in .cache can be ignored
230 | *.[Cc]ache
231 | # but keep track of directories ending in .cache
232 | !?*.[Cc]ache/
233 |
234 | # Others
235 | ClientBin/
236 | ~$*
237 | *~
238 | *.dbmdl
239 | *.dbproj.schemaview
240 | *.jfm
241 | *.pfx
242 | *.publishsettings
243 | orleans.codegen.cs
244 |
245 | # Including strong name files can present a security risk
246 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
247 | #*.snk
248 |
249 | # Since there are multiple workflows, uncomment next line to ignore bower_components
250 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
251 | #bower_components/
252 |
253 | # RIA/Silverlight projects
254 | Generated_Code/
255 |
256 | # Backup & report files from converting an old project file
257 | # to a newer Visual Studio version. Backup files are not needed,
258 | # because we have git ;-)
259 | _UpgradeReport_Files/
260 | Backup*/
261 | UpgradeLog*.XML
262 | UpgradeLog*.htm
263 | ServiceFabricBackup/
264 | *.rptproj.bak
265 |
266 | # SQL Server files
267 | *.mdf
268 | *.ldf
269 | *.ndf
270 |
271 | # Business Intelligence projects
272 | *.rdl.data
273 | *.bim.layout
274 | *.bim_*.settings
275 | *.rptproj.rsuser
276 | *- [Bb]ackup.rdl
277 | *- [Bb]ackup ([0-9]).rdl
278 | *- [Bb]ackup ([0-9][0-9]).rdl
279 |
280 | # Microsoft Fakes
281 | FakesAssemblies/
282 |
283 | # GhostDoc plugin setting file
284 | *.GhostDoc.xml
285 |
286 | # Node.js Tools for Visual Studio
287 | .ntvs_analysis.dat
288 | node_modules/
289 |
290 | # Visual Studio 6 build log
291 | *.plg
292 |
293 | # Visual Studio 6 workspace options file
294 | *.opt
295 |
296 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
297 | *.vbw
298 |
299 | # Visual Studio 6 auto-generated project file (contains which files were open etc.)
300 | *.vbp
301 |
302 | # Visual Studio 6 workspace and project file (working project files containing files to include in project)
303 | *.dsw
304 | *.dsp
305 |
306 | # Visual Studio 6 technical files
307 | *.ncb
308 | *.aps
309 |
310 | # Visual Studio LightSwitch build output
311 | **/*.HTMLClient/GeneratedArtifacts
312 | **/*.DesktopClient/GeneratedArtifacts
313 | **/*.DesktopClient/ModelManifest.xml
314 | **/*.Server/GeneratedArtifacts
315 | **/*.Server/ModelManifest.xml
316 | _Pvt_Extensions
317 |
318 | # Paket dependency manager
319 | .paket/paket.exe
320 | paket-files/
321 |
322 | # FAKE - F# Make
323 | .fake/
324 |
325 | # CodeRush personal settings
326 | .cr/personal
327 |
328 | # Python Tools for Visual Studio (PTVS)
329 | __pycache__/
330 | *.pyc
331 |
332 | # Cake - Uncomment if you are using it
333 | # tools/**
334 | # !tools/packages.config
335 |
336 | # Tabs Studio
337 | *.tss
338 |
339 | # Telerik's JustMock configuration file
340 | *.jmconfig
341 |
342 | # BizTalk build output
343 | *.btp.cs
344 | *.btm.cs
345 | *.odx.cs
346 | *.xsd.cs
347 |
348 | # OpenCover UI analysis results
349 | OpenCover/
350 |
351 | # Azure Stream Analytics local run output
352 | ASALocalRun/
353 |
354 | # MSBuild Binary and Structured Log
355 | *.binlog
356 |
357 | # NVidia Nsight GPU debugger configuration file
358 | *.nvuser
359 |
360 | # MFractors (Xamarin productivity tool) working folder
361 | .mfractor/
362 |
363 | # Local History for Visual Studio
364 | .localhistory/
365 |
366 | # Visual Studio History (VSHistory) files
367 | .vshistory/
368 |
369 | # BeatPulse healthcheck temp database
370 | healthchecksdb
371 |
372 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
373 | MigrationBackup/
374 |
375 | # Ionide (cross platform F# VS Code tools) working folder
376 | .ionide/
377 |
378 | # Fody - auto-generated XML schema
379 | FodyWeavers.xsd
380 |
381 | # VS Code files for those working on multiple tools
382 | .vscode/*
383 | !.vscode/settings.json
384 | !.vscode/tasks.json
385 | !.vscode/launch.json
386 | !.vscode/extensions.json
387 | *.code-workspace
388 |
389 | # Local History for Visual Studio Code
390 | .history/
391 |
392 | # Windows Installer files from build outputs
393 | *.cab
394 | *.msi
395 | *.msix
396 | *.msm
397 | *.msp
398 |
399 | # JetBrains Rider
400 | *.sln.iml
401 |
402 | # =========================
403 | # Windows detritus
404 | # =========================
405 |
406 | # Windows image file caches
407 | Thumbs.db
408 | ehthumbs.db
409 |
410 | # Folder config file
411 | Desktop.ini
412 |
413 | # Recycle Bin used on file shares
414 | $RECYCLE.BIN/
415 |
416 | # Mac desktop service store files
417 | .DS_Store
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NuPack
2 | Visual Studio extension for building and publishing NuGet packages.
3 |
4 | ### Features of NuPack 2022
5 | * It's a clean version just support SDK-based projects.Use dotnet CLI as default build tool instead of NuGet.exe.
6 | * Migrate package.nuspec to Package Properties.
7 | * DONOT keep source URLs or API keys any more but symbols servers, use the sources in NuGet.Config as default.
8 |
9 | ### Screen shots
10 | 
11 | 
12 | 
13 |
14 | ### Migration for Classic projects
15 | * Use `Upgrade` command in project context menu to migrate your classic projects to SDK-based projects.
16 | 
17 | * Use `Migrate package.nuspec to Package Properties` command of this extend to migrate your package.nuspec to Package Properties.
18 | 
19 |
20 | ### Release notes
21 |
22 | [Release notes](https://raw.githubusercontent.com/cnsharp/nupack/master/release_notes.txt)
23 |
24 | ### Download
25 | * [VS 2022](https://marketplace.visualstudio.com/items?itemName=CnSharpStudio.NuPack2022)
26 | * [VS 2019 and Previous](https://marketplace.visualstudio.com/items?itemName=CnSharpStudio.NuPack)
27 |
28 | ### Fork on Github
29 | [https://github.com/cnsharp/nupack](https://github.com/cnsharp/nupack)
30 |
--------------------------------------------------------------------------------
/release_notes.txt:
--------------------------------------------------------------------------------
1 | ### V17.0 1/15/2025
2 | * Support VS2022
3 | * - Remove features for classic project.
4 |
5 | ### V3.0 4/18/2019
6 | * Support VS2019.
7 |
8 | ### V2.1.1 9/5/2018
9 | * A dependency bug fix.
10 |
11 | ### V2.1.0 7/30/2018
12 | * Add universal app platform (UAP) projects support.
13 |
14 | ### V2.0.6 6/1/2018
15 | * Support nuget source path with spaces.
16 | [#21](https://github.com/cnsharp/nupack/issues/21)
17 |
18 | ### V2.0.5 5/9/2018
19 | * Fix double slash bug in nuget push statement about .NET Standard/Core projects.
20 | [#19](https://github.com/cnsharp/nupack/issues/19)
21 |
22 | ### V2.0.4 5/9/2018
23 | * Fix double slash bug in nuget push statement.
24 | [#19](https://github.com/cnsharp/nupack/issues/19)
25 | * Derived from AsyncPackage instead of Package to improve performance.
26 |
27 | ### V2.0.3 5/7/2018
28 | * Refersh cache when adding/removing project
29 |
30 | ### V2.0.2 5/3/2018
31 | * Restrict project types to .csproj/.vbproj/.fsproj,in case of some other types may make extension crash.
32 | [#17](https://github.com/cnsharp/nupack/issues/17)
33 | * Fix the bug when Package Output directory is a network path.
34 | [#20](https://github.com/cnsharp/nupack/issues/20)
35 |
36 | ### V2.0.1 4/23/2018
37 | * Add auto increment version number feature.
38 |
39 | ### V2.0 4/21/2018
40 | * Add SDK-based project support by msbuild command.
41 | * Support CommonAssemblyInfo on classic projects.
42 | * Add Directory.Build.props to support common package info of SDK-based projects,like company/authors/etc.
43 |
44 | ### V1.6.3 1/11/2018
45 | * + add -ForceEnglishOutput option
46 |
47 | ### V1.6.2 8/10/2017
48 | * Fix the bug of DevelopmentDependency property of Package.
49 | [#7](https://github.com/cnsharp/nupack/issues/7)
50 |
51 | ### V1.6.1 8/2/2017
52 | * NuGet V2 login support.
53 | [#5](https://github.com/cnsharp/nupack/issues/5)
54 |
55 | ### V1.6 7/22/2017
56 | [#1](https://github.com/cnsharp/nupack/issues/1)
57 | update CnSharp.VisualStudio.TFS package to 1.1.2 to include 'Microsoft.TeamFoundation.Common' dll.
58 | [#2](https://github.com/cnsharp/nupack/issues/2)
59 | support spaces in Nuget.exe path
60 | [#3](https://github.com/cnsharp/nupack/issues/3)
61 | support developmentDependency
62 |
63 | ### V1.5.1 6/22/2017
64 | * + add -IncludeReferencedProjects option
65 |
66 | ### V1.5 3/9/2017
67 | * + VS 2017 support.
68 |
69 | ### V1.4.4 11/10/2016
70 | * Fix a bug when sync version to other .nuspec file in the solution.
71 |
72 | ### V1.4.3 11/8/2016
73 | * Fix a bug of assembly info modification.
74 |
75 | ### V1.4.2 10/27/2016
76 | * Dependency merge bug fix.
77 |
78 | ### V1.4.1 10/20/2016
79 | * TFS check out bug fix(some .dll missed).
80 |
81 | ### V1.4 8/4/2016
82 | * + Sync version to .nuspec file in solution projects which depend on it when a package's version has changed.
83 | * .nuspec merge bug fix when dependencies in multiple groups
84 | * Encode whitespaces in XML
85 |
86 | ### V1.3.2 7/26/2016
87 | * + Add feature which supports to remember NuGet API key.
88 |
89 | ### V1.3.1 7/20/2016
90 | * Fix a bug of merge dependency in separated groups.
91 |
92 | ### V1.3 6/23/2016
93 | * + Add VB project support.
94 |
95 | ### V1.2 6/4/2016
96 | * Improve deploy wizard.
97 | * Merge dependencies from packages.config automatically where .nuspec file created.
98 |
99 | ### V1.1.1 5/24/2016
100 | * + Merge dependencies from packages.config into .nuspec automatically.
101 | * Improve replacement pattern for assemblyinfo.cs under multi language charset.
102 |
103 | ### V1.1 5/17/2016
104 | * + Add nuspec dependency management.
105 | * + Add NuGet.exe path and output directory settings.
106 | * + Display NuGet command output message in Output Pane in VS.
107 | * Adjust context menu positions.
108 | * Some nuspec bug fixed.
109 | * Some assemblyinfo.cs replacement bug fixed.
110 |
111 | ### V1.0 3/13/2016
112 | * + Initial version with basic features.
--------------------------------------------------------------------------------
/screenshots/1.0/deploy-window.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/1.0/deploy-window.PNG
--------------------------------------------------------------------------------
/screenshots/1.0/solution-menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/1.0/solution-menu.png
--------------------------------------------------------------------------------
/screenshots/1.x/batch-assembly-info.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/1.x/batch-assembly-info.PNG
--------------------------------------------------------------------------------
/screenshots/1.x/deploy-1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/1.x/deploy-1.PNG
--------------------------------------------------------------------------------
/screenshots/1.x/deploy-2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/1.x/deploy-2.PNG
--------------------------------------------------------------------------------
/screenshots/1.x/deploy-3.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/1.x/deploy-3.PNG
--------------------------------------------------------------------------------
/screenshots/1.x/project-menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/1.x/project-menu.png
--------------------------------------------------------------------------------
/screenshots/1.x/sln_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/1.x/sln_menu.png
--------------------------------------------------------------------------------
/screenshots/17.x/deploy_context_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/17.x/deploy_context_menu.png
--------------------------------------------------------------------------------
/screenshots/17.x/migrate_nuspec.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/17.x/migrate_nuspec.png
--------------------------------------------------------------------------------
/screenshots/17.x/nuget_manifest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/17.x/nuget_manifest.png
--------------------------------------------------------------------------------
/screenshots/17.x/pack_push.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/17.x/pack_push.png
--------------------------------------------------------------------------------
/screenshots/17.x/upgrade_classic_projects.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/17.x/upgrade_classic_projects.png
--------------------------------------------------------------------------------
/screenshots/2.x/AssemblyInfoCommandMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/2.x/AssemblyInfoCommandMenu.png
--------------------------------------------------------------------------------
/screenshots/2.x/AssemblyInfoDialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/2.x/AssemblyInfoDialog.png
--------------------------------------------------------------------------------
/screenshots/2.x/DeployCommandMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/2.x/DeployCommandMenu.png
--------------------------------------------------------------------------------
/screenshots/2.x/DeployDialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/2.x/DeployDialog.png
--------------------------------------------------------------------------------
/screenshots/2.x/DirectoryBuildPropsCommandMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/2.x/DirectoryBuildPropsCommandMenu.png
--------------------------------------------------------------------------------
/screenshots/2.x/NuspecCommandMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/2.x/NuspecCommandMenu.png
--------------------------------------------------------------------------------
/screenshots/2.x/PackageMetadataDialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/screenshots/2.x/PackageMetadataDialog.png
--------------------------------------------------------------------------------
/src/Commands/AssemblyInfoEditCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.Design;
3 | using System.Linq;
4 | using CnSharp.VisualStudio.Extensions;
5 | using CnSharp.VisualStudio.NuPack.Extensions;
6 | using CnSharp.VisualStudio.NuPack.Forms;
7 | using Microsoft.VisualStudio.Shell;
8 | using Task = System.Threading.Tasks.Task;
9 |
10 | namespace CnSharp.VisualStudio.NuPack.Commands
11 | {
12 | ///
13 | /// Command handler
14 | ///
15 | internal sealed class AssemblyInfoEditCommand
16 | {
17 | ///
18 | /// Command ID.
19 | ///
20 | public const int CommandId = 0x0100;
21 |
22 | ///
23 | /// Command menu group (command set GUID).
24 | ///
25 | public static readonly Guid CommandSet = new Guid("2dff605d-c360-4f36-9f5e-1b117fcd71f4");
26 |
27 | ///
28 | /// VS Package that provides this command, not null.
29 | ///
30 | private readonly AsyncPackage package;
31 |
32 | ///
33 | /// Initializes a new instance of the class.
34 | /// Adds our command handlers for menu (commands must exist in the command table file)
35 | ///
36 | /// Owner package, not null.
37 | /// Command service to add command to, not null.
38 | private AssemblyInfoEditCommand(AsyncPackage package, OleMenuCommandService commandService)
39 | {
40 | this.package = package ?? throw new ArgumentNullException(nameof(package));
41 | commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));
42 |
43 | var menuCommandID = new CommandID(CommandSet, CommandId);
44 | var menuItem = new MenuCommand(Execute, menuCommandID);
45 | commandService.AddCommand(menuItem);
46 | }
47 |
48 | ///
49 | /// Gets the instance of the command.
50 | ///
51 | public static AssemblyInfoEditCommand Instance
52 | {
53 | get;
54 | private set;
55 | }
56 |
57 | ///
58 | /// Gets the service provider from the owner package.
59 | ///
60 | private IAsyncServiceProvider ServiceProvider
61 | {
62 | get
63 | {
64 | return package;
65 | }
66 | }
67 |
68 | ///
69 | /// Initializes the singleton instance of the command.
70 | ///
71 | /// Owner package, not null.
72 | public static async Task InitializeAsync(AsyncPackage package)
73 | {
74 | // Switch to the main thread - the call to AddCommand in AssemblyInfoEditCommand's constructor requires
75 | // the UI thread.
76 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
77 |
78 | OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
79 | Instance = new AssemblyInfoEditCommand(package, commandService);
80 | }
81 |
82 | ///
83 | /// This function is the callback used to execute the command when the menu item is clicked.
84 | /// See the constructor to see how the menu item is associated with this function using
85 | /// OleMenuCommandService service and MenuCommand class.
86 | ///
87 | /// Event sender.
88 | /// Event args.
89 | private void Execute(object sender, EventArgs e)
90 | {
91 | ThreadHelper.ThrowIfNotOnUIThread();
92 | var dte = Host.Instance.Dte2;
93 | try
94 | {
95 | var sln = dte.Solution;
96 | var sp = SolutionDataCache.Instance.GetSolutionProperties(sln.FileName);
97 | var allProjects = sp.Projects;
98 | if (!allProjects.Any())
99 | {
100 | package.ShowError("No project is opening.", Common.ProductName);
101 | return;
102 | }
103 |
104 | var projectsWithAssemblyInfo = allProjects.Where(p => p.HasAssemblyInfo()).ToList();
105 | if (!projectsWithAssemblyInfo.Any())
106 | {
107 | package.ShowError("No project with AssemblyInfo found.", Common.ProductName);
108 | return;
109 | }
110 | new AssemblyInfoForm(projectsWithAssemblyInfo).ShowDialog();
111 | }
112 | catch (Exception exception)
113 | {
114 | package.ShowError(exception.Message, Common.ProductName);
115 | }
116 | }
117 | }
118 | }
--------------------------------------------------------------------------------
/src/Commands/DeployPackageCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.Design;
3 | using System.Windows.Forms;
4 | using CnSharp.VisualStudio.Extensions;
5 | using CnSharp.VisualStudio.NuPack.Forms;
6 | using Microsoft.VisualStudio.Shell;
7 | using Task = System.Threading.Tasks.Task;
8 |
9 | namespace CnSharp.VisualStudio.NuPack.Commands
10 | {
11 | ///
12 | /// Command handler
13 | ///
14 | internal sealed class DeployPackageCommand
15 | {
16 | ///
17 | /// Command ID.
18 | ///
19 | public const int CommandId = PackageIds.cmdidDeployPackageCommand;
20 |
21 | ///
22 | /// Command menu group (command set GUID).
23 | ///
24 | public static readonly Guid CommandSet = PackageGuids.guidDeployPackageCmdSet;
25 |
26 | ///
27 | /// VS Package that provides this command, not null.
28 | ///
29 | private readonly AsyncPackage package;
30 |
31 | ///
32 | /// Initializes a new instance of the class.
33 | /// Adds our command handlers for menu (commands must exist in the command table file)
34 | ///
35 | /// Owner package, not null.
36 | /// Command service to add command to, not null.
37 | private DeployPackageCommand(AsyncPackage package, OleMenuCommandService commandService)
38 | {
39 | this.package = package ?? throw new ArgumentNullException(nameof(package));
40 | commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));
41 |
42 | var menuCommandID = new CommandID(CommandSet, CommandId);
43 | var menuItem = new MenuCommand(this.Execute, menuCommandID);
44 | commandService.AddCommand(menuItem);
45 | }
46 |
47 | ///
48 | /// Gets the instance of the command.
49 | ///
50 | public static DeployPackageCommand Instance
51 | {
52 | get;
53 | private set;
54 | }
55 |
56 | ///
57 | /// Gets the service provider from the owner package.
58 | ///
59 | private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider
60 | {
61 | get
62 | {
63 | return this.package;
64 | }
65 | }
66 |
67 | ///
68 | /// Initializes the singleton instance of the command.
69 | ///
70 | /// Owner package, not null.
71 | public static async Task InitializeAsync(AsyncPackage package)
72 | {
73 | // Switch to the main thread - the call to AddCommand in DeployPackageCommand's constructor requires
74 | // the UI thread.
75 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
76 |
77 | OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
78 | Instance = new DeployPackageCommand(package, commandService);
79 | }
80 |
81 | ///
82 | /// This function is the callback used to execute the command when the menu item is clicked.
83 | /// See the constructor to see how the menu item is associated with this function using
84 | /// OleMenuCommandService service and MenuCommand class.
85 | ///
86 | /// Event sender.
87 | /// Event args.
88 | private void Execute(object sender, EventArgs e)
89 | {
90 | ThreadHelper.ThrowIfNotOnUIThread();
91 |
92 | var dte = Host.Instance.Dte2;
93 | var form = new DeployWizard(dte, package);
94 | form.StartPosition = FormStartPosition.CenterScreen;
95 | if(form.ShowDialog() == DialogResult.OK)
96 | form.SaveAndBuild();
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/src/Commands/MigrateNuspecToProjectCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.Design;
3 | using System.IO;
4 | using CnSharp.VisualStudio.Extensions;
5 | using CnSharp.VisualStudio.NuPack.Extensions;
6 | using Microsoft.VisualStudio.Shell;
7 | using Task = System.Threading.Tasks.Task;
8 |
9 | namespace CnSharp.VisualStudio.NuPack.Commands
10 | {
11 | ///
12 | /// Command handler
13 | ///
14 | internal sealed class MigrateNuspecToProjectCommand
15 | {
16 | ///
17 | /// Command ID.
18 | ///
19 | public const int CommandId = PackageIds.cmdidMigrateNuspecToProjectCommand;
20 |
21 | ///
22 | /// Command menu group (command set GUID).
23 | ///
24 | public static readonly Guid CommandSet = PackageGuids.guidMigrateNuspecToProjectCmdSet;
25 |
26 | ///
27 | /// VS Package that provides this command, not null.
28 | ///
29 | private readonly AsyncPackage package;
30 |
31 | ///
32 | /// Initializes a new instance of the class.
33 | /// Adds our command handlers for menu (commands must exist in the command table file)
34 | ///
35 | /// Owner package, not null.
36 | /// Command service to add command to, not null.
37 | private MigrateNuspecToProjectCommand(AsyncPackage package, OleMenuCommandService commandService)
38 | {
39 | this.package = package ?? throw new ArgumentNullException(nameof(package));
40 | commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));
41 |
42 | var menuCommandID = new CommandID(CommandSet, CommandId);
43 | var menuItem = new OleMenuCommand(this.Execute, menuCommandID);
44 | commandService.AddCommand(menuItem);
45 | }
46 |
47 |
48 |
49 | ///
50 | /// Gets the instance of the command.
51 | ///
52 | public static MigrateNuspecToProjectCommand Instance
53 | {
54 | get;
55 | private set;
56 | }
57 |
58 | ///
59 | /// Gets the service provider from the owner package.
60 | ///
61 | private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider
62 | {
63 | get
64 | {
65 | return this.package;
66 | }
67 | }
68 |
69 | ///
70 | /// Initializes the singleton instance of the command.
71 | ///
72 | /// Owner package, not null.
73 | public static async Task InitializeAsync(AsyncPackage package)
74 | {
75 | // Switch to the main thread - the call to AddCommand in MigrateNuspecToProjectCommand's constructor requires
76 | // the UI thread.
77 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
78 |
79 | OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
80 | Instance = new MigrateNuspecToProjectCommand(package, commandService);
81 | }
82 |
83 | ///
84 | /// This function is the callback used to execute the command when the menu item is clicked.
85 | /// See the constructor to see how the menu item is associated with this function using
86 | /// OleMenuCommandService service and MenuCommand class.
87 | ///
88 | /// Event sender.
89 | /// Event args.
90 | private void Execute(object sender, EventArgs e)
91 | {
92 | var dte = Host.Instance.Dte2;
93 | var project = dte.GetActiveProject();
94 | var nuspecFile = project.GetNuSpecFilePath();
95 | if (!File.Exists(nuspecFile))
96 | {
97 | return;
98 | }
99 |
100 | var metadata = NuGetExtensions.LoadFromNuspecFile(nuspecFile);
101 | var ppp = project.GetPackageProjectProperties();
102 | metadata.SyncToPackageProjectProperties(ppp);
103 | project.SavePackageProjectProperties(ppp);
104 | package.ShowInfo("Migration completed.Please review the project file and then you can remove the .nuspec file manually later.",Common.ProductName);
105 | }
106 | }
107 | }
--------------------------------------------------------------------------------
/src/Common.cs:
--------------------------------------------------------------------------------
1 | using System.Management;
2 |
3 | namespace CnSharp.VisualStudio.NuPack
4 | {
5 | public class Common
6 | {
7 | public const string ProductName = "NuPack";
8 |
9 | public static readonly string[] SupportedProjectTypes = { ".csproj", ".vbproj",".fsproj" };
10 |
11 | public static string GetOrganization()
12 | {
13 | var c = new ManagementClass("Win32_OperatingSystem");
14 | foreach (var o in c.GetInstances())
15 | {
16 | //Console.WriteLine("Registered User: {0}, Organization: {1}", o["RegisteredUser"], o["Organization"]);
17 | if (!string.IsNullOrWhiteSpace(o["Organization"]?.ToString()))
18 | return o["Organization"].ToString();
19 | }
20 | return null;
21 | //return (string)Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "");
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/Config/NuPackConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using CnSharp.VisualStudio.Extensions.Util;
5 | using CnSharp.VisualStudio.NuPack.Models;
6 |
7 | namespace CnSharp.VisualStudio.NuPack.Config
8 | {
9 | public class NuPackConfig
10 | {
11 | public PackArgs PackArgs { get; set; } = new PackArgs();
12 |
13 | public List SymbolServers { get; set; } = new List();
14 | }
15 |
16 | public class NuPackConfigHelper
17 | {
18 | private const string ConfigFileRelativePath = ".nupack\\config.xml";
19 | private string _configFilePath;
20 |
21 | public NuPackConfigHelper(string projectDir)
22 | {
23 | _configFilePath = Path.Combine(projectDir , ConfigFileRelativePath);
24 | }
25 |
26 | public NuPackConfig Read()
27 | {
28 | if (!File.Exists(_configFilePath))
29 | {
30 | return null;
31 | }
32 |
33 | return XmlSerializerHelper.LoadObjectFromXml(_configFilePath);
34 | }
35 |
36 | public void Save(NuPackConfig config)
37 | {
38 | if (config == null)
39 | {
40 | throw new ArgumentNullException(nameof(config));
41 | }
42 |
43 | var fi = new FileInfo(_configFilePath);
44 | if (!fi.Directory.Exists)
45 | {
46 | fi.Directory.Create();
47 | fi.Directory.Attributes |= FileAttributes.Hidden;
48 | }
49 | XmlSerializerHelper.SaveObjectToXml(config, _configFilePath);
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/src/Controls/ControlExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 |
6 | namespace CnSharp.VisualStudio.NuPack.Controls
7 | {
8 | public static class ControlExtensions
9 | {
10 | public static void SetPlaceHolder(this TextBox textBox, string placeholder, Color foreColor)
11 | {
12 | textBox.Text = placeholder;
13 | textBox.ForeColor = foreColor;
14 | textBox.GotFocus += (sender, args) =>
15 | {
16 | if (textBox.Text == placeholder)
17 | {
18 | textBox.Text = string.Empty;
19 | textBox.ForeColor = SystemColors.WindowText;
20 | }
21 | };
22 | textBox.LostFocus += (sender, args) =>
23 | {
24 | if (string.IsNullOrWhiteSpace(textBox.Text))
25 | {
26 | textBox.Text = placeholder;
27 | textBox.ForeColor = foreColor;
28 | }
29 | };
30 | }
31 |
32 | public static void AttachPlaceHolder(this Control textBox, string placeholder, Color foreColor)
33 | {
34 | var label = new Label
35 | {
36 | AutoSize = true,
37 | Text = placeholder,
38 | ForeColor = foreColor,
39 | BackColor = textBox.BackColor,
40 | Font = new Font(textBox.Font.FontFamily, textBox.Font.Size)
41 | };
42 | label.Location = new Point(textBox.Location.X + 4,
43 | textBox.Location.Y + (textBox.ClientSize.Height - label.Font.Height) / 2 + 2);
44 | label.Click += (sender, args) =>
45 | {
46 | label.Hide();
47 | textBox.Focus();
48 | };
49 | textBox.Parent.Controls.Add(label);
50 | label.BringToFront();
51 | textBox.GotFocus += (sender, args) =>
52 | {
53 | label.Hide();
54 | };
55 | textBox.LostFocus += (sender, args) =>
56 | {
57 | if (string.IsNullOrWhiteSpace(textBox.Text))
58 | {
59 | label.Show();
60 | }
61 | };
62 | }
63 |
64 | public static Control AttachCloseButton(this ComboBox comboBox)
65 | {
66 | var button = new PictureBox
67 | {
68 | Size = new Size(comboBox.ClientSize.Height - 8, comboBox.ClientSize.Height - 8),
69 | Image = Resource.close,
70 | BackColor = comboBox.BackColor,
71 | BorderStyle = BorderStyle.None,
72 | TabStop = false,
73 | Cursor = Cursors.Default,
74 | Text = "X"
75 | };
76 | button.Location = new Point(comboBox.ClientSize.Width - button.Width - 2, 4);
77 | button.Click += (sender, args) => comboBox.SelectedIndex = -1;
78 | comboBox.Controls.Add(button);
79 | return button;
80 | }
81 |
82 | public static void AttachHelpButton(this Control control, EventHandler eventHandler)
83 | {
84 | var button = InitHelpButton(control);
85 | button.Click += eventHandler;
86 | control.Parent.Controls.Add(button);
87 | }
88 |
89 | public static void AttachHelpButton(this Control control, string url)
90 | {
91 | var button = InitHelpButton(control);
92 | if(!string.IsNullOrWhiteSpace(url))
93 | button.Click += (sender, args) => Process.Start(url);
94 | control.Parent.Controls.Add(button);
95 | }
96 |
97 | private static PictureBox InitHelpButton(Control control)
98 | {
99 | return new PictureBox
100 | {
101 | Size = new Size(16,16),
102 | Image = Resource.HelpIndexFile,
103 | BorderStyle = BorderStyle.None,
104 | TabStop = false,
105 | Cursor = Cursors.Hand,
106 | Text = "?",
107 | Location = new Point(control.Right + 1, control.Top)
108 | };
109 | }
110 | }
111 | }
--------------------------------------------------------------------------------
/src/Controls/PackOptionsControl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace CnSharp.VisualStudio.NuPack.Controls
2 | {
3 | partial class PackOptionsControl
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.label10 = new System.Windows.Forms.Label();
32 | this.textBoxOutputDir = new System.Windows.Forms.TextBox();
33 | this.btnOpenOutputDir = new System.Windows.Forms.Button();
34 | this.checkBoxIncludeSymbols = new System.Windows.Forms.CheckBox();
35 | this.checkBoxIncludeSource = new System.Windows.Forms.CheckBox();
36 | this.checkBoxNoDependencies = new System.Windows.Forms.CheckBox();
37 | this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
38 | this.label1 = new System.Windows.Forms.Label();
39 | this.sourceBox = new System.Windows.Forms.ComboBox();
40 | this.label2 = new System.Windows.Forms.Label();
41 | this.textBoxApiKey = new System.Windows.Forms.TextBox();
42 | this.label5 = new System.Windows.Forms.Label();
43 | this.textBoxSymbolServerApiKey = new System.Windows.Forms.TextBox();
44 | this.label3 = new System.Windows.Forms.Label();
45 | this.groupBox1 = new System.Windows.Forms.GroupBox();
46 | this.checkBoxNoBuild = new System.Windows.Forms.CheckBox();
47 | this.groupBox2 = new System.Windows.Forms.GroupBox();
48 | this.symbolServerBox = new System.Windows.Forms.ComboBox();
49 | this.groupBox1.SuspendLayout();
50 | this.groupBox2.SuspendLayout();
51 | this.SuspendLayout();
52 | //
53 | // label10
54 | //
55 | this.label10.AutoSize = true;
56 | this.label10.Location = new System.Drawing.Point(6, 17);
57 | this.label10.Name = "label10";
58 | this.label10.Size = new System.Drawing.Size(173, 12);
59 | this.label10.TabIndex = 21;
60 | this.label10.Text = "Package Output directory:(*)";
61 | //
62 | // textBoxOutputDir
63 | //
64 | this.textBoxOutputDir.Location = new System.Drawing.Point(132, 53);
65 | this.textBoxOutputDir.Name = "textBoxOutputDir";
66 | this.textBoxOutputDir.Size = new System.Drawing.Size(537, 21);
67 | this.textBoxOutputDir.TabIndex = 0;
68 | this.textBoxOutputDir.Validating += new System.ComponentModel.CancelEventHandler(this.textBoxOutputDir_Validating);
69 | this.textBoxOutputDir.Validated += new System.EventHandler(this.textBoxOutputDir_Validated);
70 | //
71 | // btnOpenOutputDir
72 | //
73 | this.btnOpenOutputDir.FlatAppearance.BorderSize = 0;
74 | this.btnOpenOutputDir.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
75 | this.btnOpenOutputDir.Image = global::CnSharp.VisualStudio.NuPack.Resource.folder;
76 | this.btnOpenOutputDir.Location = new System.Drawing.Point(675, 53);
77 | this.btnOpenOutputDir.Name = "btnOpenOutputDir";
78 | this.btnOpenOutputDir.Size = new System.Drawing.Size(23, 23);
79 | this.btnOpenOutputDir.TabIndex = 1;
80 | this.btnOpenOutputDir.UseVisualStyleBackColor = true;
81 | this.btnOpenOutputDir.Click += new System.EventHandler(this.btnOpenOutputDir_Click);
82 | //
83 | // checkBoxIncludeSymbols
84 | //
85 | this.checkBoxIncludeSymbols.AutoSize = true;
86 | this.checkBoxIncludeSymbols.Location = new System.Drawing.Point(132, 90);
87 | this.checkBoxIncludeSymbols.Name = "checkBoxIncludeSymbols";
88 | this.checkBoxIncludeSymbols.Size = new System.Drawing.Size(126, 16);
89 | this.checkBoxIncludeSymbols.TabIndex = 2;
90 | this.checkBoxIncludeSymbols.Text = "--include-symbols";
91 | this.checkBoxIncludeSymbols.UseVisualStyleBackColor = true;
92 | this.checkBoxIncludeSymbols.CheckedChanged += new System.EventHandler(this.checkBoxIncludeSymbols_CheckedChanged);
93 | //
94 | // checkBoxIncludeSource
95 | //
96 | this.checkBoxIncludeSource.AutoSize = true;
97 | this.checkBoxIncludeSource.Location = new System.Drawing.Point(308, 90);
98 | this.checkBoxIncludeSource.Name = "checkBoxIncludeSource";
99 | this.checkBoxIncludeSource.Size = new System.Drawing.Size(120, 16);
100 | this.checkBoxIncludeSource.TabIndex = 3;
101 | this.checkBoxIncludeSource.Text = "--include-source";
102 | this.checkBoxIncludeSource.UseVisualStyleBackColor = true;
103 | //
104 | // checkBoxNoDependencies
105 | //
106 | this.checkBoxNoDependencies.AutoSize = true;
107 | this.checkBoxNoDependencies.Location = new System.Drawing.Point(308, 118);
108 | this.checkBoxNoDependencies.Name = "checkBoxNoDependencies";
109 | this.checkBoxNoDependencies.Size = new System.Drawing.Size(126, 16);
110 | this.checkBoxNoDependencies.TabIndex = 5;
111 | this.checkBoxNoDependencies.Text = "--no-dependencies";
112 | this.checkBoxNoDependencies.UseVisualStyleBackColor = true;
113 | //
114 | // label1
115 | //
116 | this.label1.AutoSize = true;
117 | this.label1.Location = new System.Drawing.Point(25, 39);
118 | this.label1.Name = "label1";
119 | this.label1.Size = new System.Drawing.Size(83, 12);
120 | this.label1.TabIndex = 36;
121 | this.label1.Text = "NuGet Server:";
122 | //
123 | // sourceBox
124 | //
125 | this.sourceBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
126 | this.sourceBox.FormattingEnabled = true;
127 | this.sourceBox.Location = new System.Drawing.Point(132, 36);
128 | this.sourceBox.Name = "sourceBox";
129 | this.sourceBox.Size = new System.Drawing.Size(559, 20);
130 | this.sourceBox.TabIndex = 0;
131 | this.sourceBox.SelectedIndexChanged += new System.EventHandler(this.sourceBox_SelectedIndexChanged);
132 | //
133 | // label2
134 | //
135 | this.label2.AutoSize = true;
136 | this.label2.Location = new System.Drawing.Point(25, 72);
137 | this.label2.Name = "label2";
138 | this.label2.Size = new System.Drawing.Size(53, 12);
139 | this.label2.TabIndex = 101;
140 | this.label2.Text = "API Key:";
141 | //
142 | // textBoxApiKey
143 | //
144 | this.textBoxApiKey.Location = new System.Drawing.Point(132, 72);
145 | this.textBoxApiKey.Name = "textBoxApiKey";
146 | this.textBoxApiKey.Size = new System.Drawing.Size(559, 21);
147 | this.textBoxApiKey.TabIndex = 1;
148 | //
149 | // label5
150 | //
151 | this.label5.AutoSize = true;
152 | this.label5.Location = new System.Drawing.Point(25, 114);
153 | this.label5.Name = "label5";
154 | this.label5.Size = new System.Drawing.Size(89, 12);
155 | this.label5.TabIndex = 103;
156 | this.label5.Text = "Symbol Server:";
157 | //
158 | // textBoxSymbolServerApiKey
159 | //
160 | this.textBoxSymbolServerApiKey.Location = new System.Drawing.Point(132, 153);
161 | this.textBoxSymbolServerApiKey.Name = "textBoxSymbolServerApiKey";
162 | this.textBoxSymbolServerApiKey.Size = new System.Drawing.Size(559, 21);
163 | this.textBoxSymbolServerApiKey.TabIndex = 3;
164 | //
165 | // label3
166 | //
167 | this.label3.AutoSize = true;
168 | this.label3.Location = new System.Drawing.Point(25, 156);
169 | this.label3.Name = "label3";
170 | this.label3.Size = new System.Drawing.Size(53, 12);
171 | this.label3.TabIndex = 106;
172 | this.label3.Text = "API Key:";
173 | //
174 | // groupBox1
175 | //
176 | this.groupBox1.Controls.Add(this.checkBoxNoBuild);
177 | this.groupBox1.Controls.Add(this.label10);
178 | this.groupBox1.Controls.Add(this.textBoxOutputDir);
179 | this.groupBox1.Controls.Add(this.btnOpenOutputDir);
180 | this.groupBox1.Controls.Add(this.checkBoxIncludeSymbols);
181 | this.groupBox1.Controls.Add(this.checkBoxIncludeSource);
182 | this.groupBox1.Controls.Add(this.checkBoxNoDependencies);
183 | this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
184 | this.groupBox1.Location = new System.Drawing.Point(0, 0);
185 | this.groupBox1.Name = "groupBox1";
186 | this.groupBox1.Size = new System.Drawing.Size(728, 151);
187 | this.groupBox1.TabIndex = 107;
188 | this.groupBox1.TabStop = false;
189 | this.groupBox1.Text = "Pack Options";
190 | //
191 | // checkBoxNoBuild
192 | //
193 | this.checkBoxNoBuild.AutoSize = true;
194 | this.checkBoxNoBuild.Location = new System.Drawing.Point(132, 118);
195 | this.checkBoxNoBuild.Name = "checkBoxNoBuild";
196 | this.checkBoxNoBuild.Size = new System.Drawing.Size(84, 16);
197 | this.checkBoxNoBuild.TabIndex = 4;
198 | this.checkBoxNoBuild.Text = "--no-build";
199 | this.checkBoxNoBuild.UseVisualStyleBackColor = true;
200 | //
201 | // groupBox2
202 | //
203 | this.groupBox2.Controls.Add(this.symbolServerBox);
204 | this.groupBox2.Controls.Add(this.sourceBox);
205 | this.groupBox2.Controls.Add(this.label1);
206 | this.groupBox2.Controls.Add(this.label3);
207 | this.groupBox2.Controls.Add(this.textBoxApiKey);
208 | this.groupBox2.Controls.Add(this.textBoxSymbolServerApiKey);
209 | this.groupBox2.Controls.Add(this.label2);
210 | this.groupBox2.Controls.Add(this.label5);
211 | this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
212 | this.groupBox2.Location = new System.Drawing.Point(0, 151);
213 | this.groupBox2.Name = "groupBox2";
214 | this.groupBox2.Size = new System.Drawing.Size(728, 188);
215 | this.groupBox2.TabIndex = 108;
216 | this.groupBox2.TabStop = false;
217 | this.groupBox2.Text = "Deploy Options";
218 | //
219 | // symbolServerBox
220 | //
221 | this.symbolServerBox.FormattingEnabled = true;
222 | this.symbolServerBox.Location = new System.Drawing.Point(132, 114);
223 | this.symbolServerBox.Name = "symbolServerBox";
224 | this.symbolServerBox.Size = new System.Drawing.Size(559, 20);
225 | this.symbolServerBox.TabIndex = 2;
226 | //
227 | // PackOptionsControl
228 | //
229 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
230 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
231 | this.AutoScroll = true;
232 | this.Controls.Add(this.groupBox2);
233 | this.Controls.Add(this.groupBox1);
234 | this.Name = "PackOptionsControl";
235 | this.Size = new System.Drawing.Size(728, 339);
236 | this.groupBox1.ResumeLayout(false);
237 | this.groupBox1.PerformLayout();
238 | this.groupBox2.ResumeLayout(false);
239 | this.groupBox2.PerformLayout();
240 | this.ResumeLayout(false);
241 |
242 | }
243 |
244 | #endregion
245 |
246 | private System.Windows.Forms.Label label10;
247 | private System.Windows.Forms.TextBox textBoxOutputDir;
248 | private System.Windows.Forms.Button btnOpenOutputDir;
249 | private System.Windows.Forms.CheckBox checkBoxIncludeSymbols;
250 | private System.Windows.Forms.CheckBox checkBoxIncludeSource;
251 | private System.Windows.Forms.CheckBox checkBoxNoDependencies;
252 | private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog;
253 | private System.Windows.Forms.Label label1;
254 | private System.Windows.Forms.ComboBox sourceBox;
255 | private System.Windows.Forms.Label label2;
256 | private System.Windows.Forms.TextBox textBoxApiKey;
257 | private System.Windows.Forms.Label label5;
258 | private System.Windows.Forms.TextBox textBoxSymbolServerApiKey;
259 | private System.Windows.Forms.Label label3;
260 | private System.Windows.Forms.GroupBox groupBox1;
261 | private System.Windows.Forms.GroupBox groupBox2;
262 | private System.Windows.Forms.CheckBox checkBoxNoBuild;
263 | private System.Windows.Forms.ComboBox symbolServerBox;
264 | }
265 | }
266 |
--------------------------------------------------------------------------------
/src/Controls/PackOptionsControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Windows.Forms;
6 | using CnSharp.VisualStudio.NuPack.Config;
7 | using CnSharp.VisualStudio.NuPack.Models;
8 | using CnSharp.VisualStudio.NuPack.Util;
9 |
10 | namespace CnSharp.VisualStudio.NuPack.Controls
11 | {
12 | public partial class PackOptionsControl : UserControl
13 | {
14 | private List _sources;
15 | private List _symbolServers = new List();
16 |
17 | public PackOptionsControl()
18 | {
19 | InitializeComponent();
20 | textBoxApiKey.AttachPlaceHolder("Keep it blank if you had set apikey by NuGet command", Color.Gray);
21 | sourceBox.AttachPlaceHolder("Keep it blank if you just build a package", Color.Gray);
22 | }
23 |
24 | public NuPackConfig Config { get; private set; }
25 |
26 | public PackArgs PackArgs { get; private set; } = new PackArgs();
27 |
28 | public List Sources
29 | {
30 | set
31 | {
32 | _sources = value;
33 | BindingSources();
34 | }
35 | }
36 |
37 | public PushArgs PushArgs { get; } = new PushArgs();
38 |
39 | public ErrorProvider ErrorProvider { get; set; }
40 |
41 | public void LoadConfig(string projectDir, string outputDir)
42 | {
43 | Config = new NuPackConfigHelper(projectDir).Read() ?? new NuPackConfig();
44 | PackArgs = Config.PackArgs;
45 | if (string.IsNullOrWhiteSpace(PackArgs.OutputDirectory))
46 | PackArgs.OutputDirectory = outputDir;
47 | folderBrowserDialog.SelectedPath = PackArgs.OutputDirectory;
48 | BindingPackArgs();
49 | BindingPushArgs();
50 | BindingSymbolServers(Config.SymbolServers);
51 | }
52 |
53 | private void BindingPackArgs()
54 | {
55 | textBoxOutputDir.DataBindings.Add("Text", PackArgs, "OutputDirectory");
56 | checkBoxIncludeSymbols.DataBindings.Add("Checked", PackArgs, "IncludeSymbols");
57 | checkBoxIncludeSource.DataBindings.Add("Checked", PackArgs, "IncludeSource");
58 | checkBoxNoBuild.DataBindings.Add("Checked", PackArgs, "NoBuild");
59 | checkBoxNoDependencies.DataBindings.Add("Checked", PackArgs, "NoDependencies");
60 | }
61 |
62 | private void BindingSources()
63 | {
64 | _sources.Insert(0, new NuGetSource { Name = string.Empty, Url = string.Empty });
65 | sourceBox.DataSource = _sources;
66 | sourceBox.DisplayMember = "Name";
67 | sourceBox.ValueMember = "Url";
68 | }
69 |
70 | private void BindingSymbolServers(List servers)
71 | {
72 | _symbolServers = servers;
73 | _symbolServers.Insert(0, string.Empty);
74 | symbolServerBox.DataSource = _symbolServers;
75 | }
76 |
77 |
78 | private void BindingPushArgs()
79 | {
80 | sourceBox.DataBindings.Add("SelectedValue", PushArgs, "Source");
81 | textBoxApiKey.DataBindings.Add("Text", PushArgs, "ApiKey");
82 | symbolServerBox.DataBindings.Add("Text", PushArgs, "SymbolSource");
83 | textBoxSymbolServerApiKey.DataBindings.Add("Text", PushArgs, "SymbolApiKey");
84 | }
85 |
86 | private void btnOpenOutputDir_Click(object sender, EventArgs e)
87 | {
88 | if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
89 | textBoxOutputDir.Text = folderBrowserDialog.SelectedPath;
90 | }
91 |
92 | private void textBoxOutputDir_Validating(object sender, CancelEventArgs e)
93 | {
94 | if (string.IsNullOrWhiteSpace(textBoxOutputDir.Text))
95 | {
96 | ErrorProvider.SetError(textBoxOutputDir, "*");
97 | e.Cancel = true;
98 | }
99 | }
100 |
101 | private void textBoxOutputDir_Validated(object sender, EventArgs e)
102 | {
103 | ErrorProvider.SetError(textBoxOutputDir, null);
104 | }
105 |
106 | private void checkBoxIncludeSymbols_CheckedChanged(object sender, EventArgs e)
107 | {
108 | EnableSymbolControls();
109 | }
110 |
111 | private void sourceBox_SelectedIndexChanged(object sender, EventArgs e)
112 | {
113 | EnableSymbolControls();
114 | }
115 |
116 | private void EnableSymbolControls()
117 | {
118 | symbolServerBox.Enabled =
119 | textBoxSymbolServerApiKey.Enabled = checkBoxIncludeSymbols.Checked && sourceBox.SelectedIndex > 0;
120 | }
121 | }
122 | }
--------------------------------------------------------------------------------
/src/Controls/PackOptionsControl.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 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/src/Controls/PackageMetadataControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.IO;
5 | using System.Windows.Forms;
6 | using CnSharp.VisualStudio.NuPack.Models;
7 | using EnvDTE;
8 |
9 | namespace CnSharp.VisualStudio.NuPack.Controls
10 | {
11 | public partial class PackageMetadataControl : UserControl
12 | {
13 | private static readonly List CommonLicenses = new List
14 | {
15 | "0BSD",
16 | "Apache-2.0",
17 | "BSD-3-Clause",
18 | "GPL-3.0-or-later",
19 | "LGPL-3.0-or-later",
20 | "MIT",
21 | "MPL-2.0"
22 | };
23 | private ManifestMetadataViewModel _manifestMetadata;
24 | private Project _project;
25 |
26 | public PackageMetadataControl()
27 | {
28 | InitializeComponent();
29 |
30 | ActiveControl = textBoxVersion;
31 |
32 | MakeTextBoxRequired(textBoxId);
33 | MakeTextBoxRequired(textBoxDescription);
34 | MakeTextBoxRequired(textBoxAuthors);
35 | MakeTextBoxRequired(textBoxOwners);
36 | MakeTextBoxRequired(textBoxVersion);
37 | MakeTextBoxRequired(textBoxReleaseNotes);
38 |
39 |
40 | checkBoxRLA.CheckedChanged += (sender, args) =>
41 | {
42 | ManifestMetadata.RequireLicenseAcceptance = checkBoxRLA.Checked;
43 | };
44 |
45 | openIconFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
46 |
47 | BindingLicenses();
48 | labelLicense.AttachHelpButton("https://spdx.org/licenses/");
49 | labelIcon.AttachHelpButton("https://go.microsoft.com/fwlink/?linkid=2147134");
50 | }
51 |
52 | public Project Project
53 | {
54 | set
55 | {
56 | _project = value;
57 | if (_project != null)
58 | {
59 | openIconFileDialog.InitialDirectory = openReadmeDialog.InitialDirectory = Path.GetDirectoryName(_project.FullName);
60 | }
61 | }
62 | }
63 |
64 | private void BindingLicenses()
65 | {
66 | CommonLicenses.ForEach(x => licenseBox.Items.Add(x));
67 | licenseBox.TextChanged += (sender, e) =>
68 | {
69 | checkBoxRLA.Enabled = !string.IsNullOrWhiteSpace(licenseBox.Text);
70 | if (!checkBoxRLA.Enabled && checkBoxRLA.Checked)
71 | checkBoxRLA.Checked = false;
72 | };
73 | }
74 |
75 |
76 | public ManifestMetadataViewModel ManifestMetadata
77 | {
78 | get => _manifestMetadata;
79 | set
80 | {
81 | _manifestMetadata = value;
82 | foreach (Control control in Controls)
83 | {
84 | var box = control as TextBox;
85 | if (!string.IsNullOrWhiteSpace(box?.Tag?.ToString()))
86 | {
87 | box.DataBindings.Clear();
88 | box.DataBindings.Add("Text", _manifestMetadata, box.Tag.ToString(), true, DataSourceUpdateMode.OnPropertyChanged);
89 | }
90 | }
91 |
92 | licenseBox.DataBindings.Add("Text", _manifestMetadata,
93 | nameof(_manifestMetadata.PackageLicenseExpression), true, DataSourceUpdateMode.OnPropertyChanged);
94 | checkBoxRLA.Checked = _manifestMetadata.RequireLicenseAcceptance;
95 | }
96 | }
97 |
98 | public ErrorProvider ErrorProvider { get; set; }
99 |
100 | private void MakeTextBoxRequired(TextBox box)
101 | {
102 | box.Validating += TextBoxValidating;
103 | box.Validated += TextBoxValidated;
104 | }
105 |
106 | private void TextBoxValidated(object sender, EventArgs e)
107 | {
108 | var box = sender as TextBox;
109 | if (box == null)
110 | return;
111 | ErrorProvider.SetError(box, null);
112 | }
113 |
114 | private void TextBoxValidating(object sender, CancelEventArgs e)
115 | {
116 | var box = sender as TextBox;
117 | if (box == null)
118 | return;
119 | if (string.IsNullOrWhiteSpace(box.Text))
120 | {
121 | ErrorProvider.SetError(box, "*");
122 | e.Cancel = true;
123 | }
124 | }
125 |
126 | protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
127 | {
128 | if (keyData == Keys.Enter)
129 | {
130 | if (textBoxDescription.Focused)
131 | {
132 | InsertNewLine(textBoxDescription);
133 | return true;
134 | }
135 | if (textBoxReleaseNotes.Focused)
136 | {
137 | InsertNewLine(textBoxReleaseNotes);
138 | return true;
139 | }
140 | }
141 | return base.ProcessCmdKey(ref msg, keyData);
142 | }
143 |
144 | void InsertNewLine(TextBox box)
145 | {
146 | var i = box.SelectionStart;
147 | box.Text = box.Text.Insert(i, Environment.NewLine);
148 | box.Select(i + 2, 0);
149 | }
150 |
151 | private void btnOpenIconDir_Click(object sender, EventArgs e)
152 | {
153 | if (openIconFileDialog.ShowDialog() == DialogResult.OK)
154 | {
155 | textBoxIconUrl.Text = openIconFileDialog.FileName;
156 | }
157 | }
158 |
159 | private void buttonOpenReadme_Click(object sender, EventArgs e)
160 | {
161 | if (openReadmeDialog.ShowDialog() == DialogResult.OK)
162 | {
163 | textBoxReadme.Text = openReadmeDialog.FileName;
164 | }
165 | }
166 | }
167 | }
--------------------------------------------------------------------------------
/src/Controls/PackageMetadataControl.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 | 17, 17
122 |
123 |
124 | 166, 17
125 |
126 |
--------------------------------------------------------------------------------
/src/Extensions/NuGetExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Xml;
6 | using System.Xml.Linq;
7 | using CnSharp.VisualStudio.Extensions;
8 | using CnSharp.VisualStudio.Extensions.Projects;
9 | using CnSharp.VisualStudio.Extensions.Util;
10 | using EnvDTE;
11 | using NuGet.Packaging;
12 | using NuGet.Packaging.Core;
13 | using NuGet.Versioning;
14 |
15 | namespace CnSharp.VisualStudio.NuPack.Extensions
16 | {
17 | public static class NuGetExtensions
18 | {
19 | public static string GetNuSpecFilePath(this Project project)
20 | {
21 | return Path.Combine(project.GetDirectory(), NuGetDomain.NuSpecFileName);
22 | }
23 |
24 | public static ManifestMetadata LoadFromNuspecFile(string file)
25 | {
26 | var metadata = new ManifestMetadata();
27 | var doc = XDocument.Load(file);
28 | var elements = doc.Element("package").Element("metadata").Elements().ToList();
29 | var props = typeof(ManifestMetadata).GetProperties()
30 | .Where(p => p.PropertyType.IsValueType ||
31 | p.PropertyType == typeof(string))
32 | .ToList();
33 | foreach (var prop in props)
34 | {
35 | if (prop.PropertyType == typeof(string))
36 | {
37 | var v = elements.FirstOrDefault(m => m.Name.LocalName.Equals(prop.Name,StringComparison.InvariantCultureIgnoreCase))?.Value;
38 | if (v != null)
39 | {
40 | prop.SetValue(metadata, v, null);
41 | }
42 | }
43 | else if (prop.PropertyType == typeof(bool))
44 | {
45 | var v = elements.FirstOrDefault(m => m.Name.LocalName.Equals(prop.Name, StringComparison.InvariantCultureIgnoreCase))?.Value;
46 | if (v != null)
47 | {
48 | prop.SetValue(metadata, v.Equals("true",StringComparison.InvariantCultureIgnoreCase), null);
49 | }
50 | }
51 | }
52 | SetUrl(elements, "licenseUrl", v => metadata.SetLicenseUrl(v));
53 | SetUrl(elements, "iconUrl", v => metadata.SetIconUrl(v));
54 | SetUrl(elements, "projectUrl", v => metadata.SetProjectUrl(v));
55 | return metadata;
56 | }
57 |
58 | private static void SetUrl(List elements, string node, Action action)
59 | {
60 | var v = elements.FirstOrDefault(m => m.Name.LocalName.Equals(node, StringComparison.InvariantCultureIgnoreCase))?.Value;
61 | if (!string.IsNullOrWhiteSpace(v))
62 | {
63 | action.Invoke(v);
64 | }
65 | }
66 |
67 | public static void UpdateNuspec(this Project project, ManifestMetadata metadata)
68 | {
69 | var nuspecFile = project.GetNuSpecFilePath();
70 | if (!File.Exists(nuspecFile))
71 | {
72 | return;
73 | }
74 |
75 | metadata.SaveToNuSpec(nuspecFile);
76 | }
77 |
78 | public static void SaveToNuSpec(this ManifestMetadata metadata,string nuspecFile)
79 | {
80 | var doc = new XmlDocument();
81 | doc.Load(nuspecFile);
82 | metadata.SyncToXmlDocument(doc);
83 | doc.Save(nuspecFile);
84 | }
85 |
86 | public static void SyncToXmlDocument(this ManifestMetadata metadata, XmlDocument doc)
87 | {
88 | var metadataNode = doc.SelectSingleNode("package/metadata");
89 | if (metadataNode == null)
90 | return;
91 | var props = typeof(ManifestMetadata).GetProperties().Where(p => p.PropertyType.IsValueType || p.PropertyType == typeof(string)).ToList();
92 | props.ForEach(p =>
93 | {
94 | var val = p.GetValue(metadata, null);
95 | if (val == null) return;
96 | var text = p.PropertyType == typeof(bool)
97 | ? val.ToString().ToLower()
98 | : val.ToString();
99 | metadataNode.SetXmlNode(p.Name.Substring(0,1).ToLower()+p.Name.Substring(1),text);
100 | });
101 | UpdateDependencies( metadata,doc);
102 | }
103 |
104 | private static void SetXmlNode(this XmlNode metadataNode, string key, string value)
105 | {
106 | var idNode = metadataNode.SelectSingleNode(key);
107 | if (idNode != null)
108 | idNode.InnerText = value == null ? string.Empty : value;
109 | }
110 |
111 | public static void UpdateDependencies(this ManifestMetadata metadata, XmlDocument doc)
112 | {
113 | var metadataNode = doc.SelectSingleNode("package/metadata");
114 | if (metadataNode == null)
115 | return;
116 |
117 | if (metadata.DependencyGroups?.Any() == true)
118 | {
119 | var depNode = metadataNode.SelectSingleNode("dependencyGroups");
120 | if (depNode == null)
121 | {
122 | var node = doc.CreateElement("dependencyGroups");
123 | metadataNode.AppendChild(node);
124 | depNode = node;
125 | }
126 |
127 | depNode.RemoveAll();
128 | var tempNode = doc.CreateElement("temp");
129 | tempNode.InnerXml = XmlSerializerHelper.GetXmlStringFromObject(metadata.DependencyGroups);
130 | depNode.InnerXml = tempNode.ChildNodes[0].InnerXml;
131 | }
132 | }
133 |
134 |
135 |
136 | public static bool IsEmptyOrPlaceHolder(this string value)
137 | {
138 | return string.IsNullOrWhiteSpace(value) || value.StartsWith("$");
139 | }
140 |
141 | public static ManifestMetadata ToManifestMetadata(this ProjectAssemblyInfo pai)
142 | {
143 | var metadata = new ManifestMetadata
144 | {
145 | Id = pai.Title,
146 | Owners = new []{pai.Company},
147 | Title = pai.Title,
148 | Description = pai.Description,
149 | Authors = new[] { pai.Company },
150 | Copyright = pai.Copyright
151 | };
152 | return metadata;
153 | }
154 |
155 | public static ManifestMetadata CopyFromAssemblyInfo(this ManifestMetadata metadata,ProjectAssemblyInfo pai)
156 | {
157 | if (metadata.Id.IsEmptyOrPlaceHolder())
158 | metadata.Id = pai.Title;
159 | if (metadata.Title.IsEmptyOrPlaceHolder())
160 | metadata.Title = pai.Title;
161 | if (metadata.Owners == null || !metadata.Owners.Any())
162 | metadata.Owners = new[] { pai.Company };
163 | if (metadata.Description.IsEmptyOrPlaceHolder())
164 | metadata.Description = pai.Description;
165 | if (metadata.Authors == null || !metadata.Authors.Any())
166 | metadata.Authors = new[] { pai.Company };
167 | if (metadata.Copyright.IsEmptyOrPlaceHolder())
168 | metadata.Copyright = pai.Copyright;
169 | return metadata;
170 | }
171 |
172 | public static ManifestMetadata ToManifestMetadata(this PackageProjectProperties ppp)
173 | {
174 | var meta = new ManifestMetadata
175 | {
176 | Id = ppp.PackageId,
177 | Authors = ppp.Authors?.Split(','),
178 | Copyright = ppp.Copyright,
179 | Owners = ppp.Company?.Split(','),
180 | Description = ppp.Description,
181 | Icon = ppp.PackageIcon,
182 | Language = ppp.NeutralLanguage,
183 | Readme = ppp.PackageReadmeFile,
184 | ReleaseNotes = ppp.PackageReleaseNotes,
185 | RequireLicenseAcceptance = ppp.PackageRequireLicenseAcceptance,
186 | Tags = ppp.PackageTags,
187 | Version = !string.IsNullOrEmpty(ppp.Version) ? new NuGetVersion(ppp.Version) : new NuGetVersion("1.0.0")
188 | };
189 |
190 | if (!string.IsNullOrWhiteSpace(ppp.RepositoryUrl))
191 | {
192 | meta.Repository = new RepositoryMetadata
193 | {
194 | Type = ppp.RepositoryType ?? "git",
195 | Url = ppp.RepositoryUrl
196 | };
197 | }
198 |
199 | if (!string.IsNullOrWhiteSpace(ppp.PackageLicenseExpression))
200 | {
201 | meta.LicenseMetadata = new LicenseMetadata(LicenseType.Expression, ppp.PackageLicenseExpression, null, null, LicenseMetadata.CurrentVersion);
202 | }
203 | else
204 | {
205 | meta.SetLicenseUrl(ppp.PackageLicenseUrl);
206 | }
207 | if(meta.Icon == null && !string.IsNullOrWhiteSpace(ppp.PackageIconUrl))
208 | meta.SetIconUrl(ppp.PackageIconUrl);
209 | meta.SetProjectUrl(ppp.PackageProjectUrl);
210 | return meta;
211 | }
212 |
213 |
214 | public static void SyncToPackageProjectProperties(this ManifestMetadata metadata, PackageProjectProperties ppp)
215 | {
216 | ppp.PackageId = metadata.Id;
217 | ppp.Authors = string.Join(",", metadata.Authors);
218 | ppp.Copyright = metadata.Copyright;
219 | ppp.Company = string.Join(",", metadata.Owners);
220 | ppp.Description = metadata.Description;
221 | ppp.PackageIcon = metadata.Icon;
222 | ppp.PackageIconUrl = metadata.IconUrl?.OriginalString;
223 | ppp.NeutralLanguage = metadata.Language;
224 | ppp.PackageLicenseUrl = metadata.LicenseUrl?.OriginalString;
225 | ppp.PackageReadmeFile = metadata.Readme;
226 | ppp.PackageReleaseNotes = metadata.ReleaseNotes;
227 | ppp.PackageRequireLicenseAcceptance = metadata.RequireLicenseAcceptance;
228 | ppp.PackageProjectUrl = metadata.ProjectUrl?.OriginalString;
229 | ppp.PackageTags = metadata.Tags;
230 | ppp.Version = metadata.Version?.ToString();
231 | if (metadata.Repository != null)
232 | {
233 | ppp.RepositoryType = metadata.Repository.Type;
234 | ppp.RepositoryUrl = metadata.Repository.Url;
235 | }
236 |
237 | if (metadata.LicenseMetadata != null)
238 | {
239 | ppp.PackageLicenseExpression = metadata.LicenseMetadata.License;
240 | // PackageLicenseUrl is deprecated, it cannot be conjunction with LicenseMetadata
241 | ppp.PackageLicenseUrl = null;
242 | }
243 |
244 | if (!string.IsNullOrWhiteSpace(ppp.PackageIcon))
245 | {
246 | ppp.PackageIconUrl = null;
247 | }
248 | }
249 |
250 |
251 | public static List UpdateDependencyInSolution(string packageId, NuGetVersion newVersion)
252 | {
253 | var nuspecFiles = new List();
254 | var projects = Host.Instance.DTE.GetSolutionProjects().ToList();
255 | projects.ForEach(p =>
256 | {
257 | var nuspecFile = p.GetNuSpecFilePath();
258 | if (File.Exists(nuspecFile))
259 | {
260 | var metadata = LoadFromNuspecFile(nuspecFile);
261 |
262 | if (metadata.DependencyGroups != null)
263 | {
264 | var found = false;
265 | foreach (var g in metadata.DependencyGroups)
266 | {
267 | var packages = g.Packages.ToList();
268 | int i = 0;
269 | PackageDependency pd = null;
270 | foreach (var d in packages)
271 | {
272 | if (d.Id == packageId)
273 | {
274 | pd = d;
275 | found = true;
276 | break;
277 | }
278 |
279 | i++;
280 | }
281 |
282 | if (pd != null)
283 | {
284 | var npd = new PackageDependency(pd.Id, new VersionRange(newVersion));
285 | packages.RemoveAt(i);
286 | packages.Insert(i, npd);
287 | }
288 | }
289 | if (found)
290 | {
291 | metadata.SaveToNuSpec(nuspecFile);
292 | nuspecFiles.Add(nuspecFile);
293 | }
294 | }
295 | }
296 | });
297 | return nuspecFiles;
298 | }
299 | }
300 |
301 | public class NuGetDomain
302 | {
303 | public const string NuSpecFileName = "package.nuspec";
304 | }
305 |
306 | }
307 |
--------------------------------------------------------------------------------
/src/Extensions/ServiceProviderExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.VisualStudio.Shell;
3 | using Microsoft.VisualStudio.Shell.Interop;
4 |
5 | namespace CnSharp.VisualStudio.NuPack.Extensions
6 | {
7 | public static class ServiceProviderExtensions
8 | {
9 | public static void ShowError(this IServiceProvider serviceProvider, string message, string title)
10 | {
11 | VsShellUtilities.ShowMessageBox(
12 | serviceProvider,
13 | message, title,
14 | OLEMSGICON.OLEMSGICON_WARNING,
15 | OLEMSGBUTTON.OLEMSGBUTTON_OK,
16 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
17 | }
18 |
19 | public static void ShowInfo(this IServiceProvider serviceProvider, string message, string title)
20 | {
21 | VsShellUtilities.ShowMessageBox(
22 | serviceProvider,
23 | message, title,
24 | OLEMSGICON.OLEMSGICON_INFO,
25 | OLEMSGBUTTON.OLEMSGBUTTON_OK,
26 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
27 | }
28 |
29 | public static bool ShowQuestion(this IServiceProvider serviceProvider, string message, string title)
30 | {
31 | return VsShellUtilities.ShowMessageBox(
32 | serviceProvider,
33 | message, title,
34 | OLEMSGICON.OLEMSGICON_WARNING,
35 | OLEMSGBUTTON.OLEMSGBUTTON_YESNO,
36 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST) == 6;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/Extensions/SolutionDataCache.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Concurrent;
2 | using System.Collections.Generic;
3 | using EnvDTE;
4 |
5 | namespace CnSharp.VisualStudio.NuPack.Extensions
6 | {
7 | public class SolutionDataCache : ConcurrentDictionary
8 | {
9 | private static SolutionDataCache instance;
10 | protected SolutionDataCache()
11 | {
12 |
13 | }
14 |
15 | public static SolutionDataCache Instance => instance ?? (instance = new SolutionDataCache());
16 |
17 | public SolutionProperties GetSolutionProperties(string solutionFile)
18 | {
19 | SolutionProperties sp;
20 | while (!TryGetValue(solutionFile,out sp))
21 | {
22 | System.Threading.Thread.Sleep(500);
23 | }
24 | return sp;
25 | }
26 | }
27 |
28 | public class SolutionProperties
29 | {
30 | public List Projects { get; set; } = new List();
31 |
32 | public void AddProject(Project project)
33 | {
34 | Projects.Add(project);
35 | }
36 |
37 | public void RemoveProject(Project project)
38 | {
39 | Projects.Remove(project);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Forms/AssemblyInfoForm.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 | True
122 |
123 |
124 | True
125 |
126 |
127 | True
128 |
129 |
130 | True
131 |
132 |
133 | True
134 |
135 |
136 | True
137 |
138 |
139 | True
140 |
141 |
142 | True
143 |
144 |
145 | 17, 17
146 |
147 |
148 | 196, 17
149 |
150 |
151 | 323, 19
152 |
153 |
154 | 530, 19
155 |
156 |
157 | 53
158 |
159 |
--------------------------------------------------------------------------------
/src/Forms/DeployWizard.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace CnSharp.VisualStudio.NuPack.Forms
2 | {
3 | partial class DeployWizard
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 Windows Form 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.components = new System.ComponentModel.Container();
32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DeployWizard));
33 | this.stepWizardControl = new AeroWizard.StepWizardControl();
34 | this.wizardPageMetadata = new AeroWizard.WizardPage();
35 | this.wizardPageOptions = new AeroWizard.WizardPage();
36 | this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
37 | this.openAssemblyInfoFileDialog = new System.Windows.Forms.OpenFileDialog();
38 | ((System.ComponentModel.ISupportInitialize)(this.stepWizardControl)).BeginInit();
39 | this.wizardPageMetadata.SuspendLayout();
40 | ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
41 | this.SuspendLayout();
42 | //
43 | // stepWizardControl
44 | //
45 | this.stepWizardControl.Location = new System.Drawing.Point(0, 0);
46 | this.stepWizardControl.Name = "stepWizardControl";
47 | this.stepWizardControl.Pages.Add(this.wizardPageMetadata);
48 | this.stepWizardControl.Pages.Add(this.wizardPageOptions);
49 | this.stepWizardControl.Size = new System.Drawing.Size(1088, 679);
50 | this.stepWizardControl.StepListFont = new System.Drawing.Font("Microsoft YaHei", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
51 | this.stepWizardControl.TabIndex = 27;
52 | this.stepWizardControl.Title = "Pack & Deploy";
53 | this.stepWizardControl.TitleIcon = ((System.Drawing.Icon)(resources.GetObject("stepWizardControl.TitleIcon")));
54 | //
55 | // wizardPageMetadata
56 | //
57 | this.wizardPageMetadata.AllowBack = false;
58 | this.wizardPageMetadata.Name = "wizardPageMetadata";
59 | this.wizardPageMetadata.NextPage = this.wizardPageOptions;
60 | this.wizardPageMetadata.Size = new System.Drawing.Size(890, 523);
61 | this.stepWizardControl.SetStepText(this.wizardPageMetadata, "Metadata");
62 | this.wizardPageMetadata.TabIndex = 2;
63 | this.wizardPageMetadata.Text = "Metadata";
64 | //
65 | // wizardPageOptions
66 | //
67 | this.wizardPageOptions.Name = "wizardPageOptions";
68 | this.wizardPageOptions.Size = new System.Drawing.Size(890, 306);
69 | this.stepWizardControl.SetStepText(this.wizardPageOptions, "Build/Deploy");
70 | this.wizardPageOptions.TabIndex = 3;
71 | this.wizardPageOptions.Text = "Build/Deploy";
72 | //
73 | // errorProvider
74 | //
75 | this.errorProvider.ContainerControl = this;
76 | //
77 | // openAssemblyInfoFileDialog
78 | //
79 | this.openAssemblyInfoFileDialog.DefaultExt = "*.cs|*.vb";
80 | this.openAssemblyInfoFileDialog.Title = "Open Common Assembly Info File";
81 | //
82 | // DeployWizard
83 | //
84 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
85 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
86 | this.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange;
87 | this.ClientSize = new System.Drawing.Size(1088, 679);
88 | this.Controls.Add(this.stepWizardControl);
89 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
90 | this.MaximizeBox = false;
91 | this.MinimizeBox = false;
92 | this.Name = "DeployWizard";
93 | this.Text = "Deploy Wizard";
94 | this.Load += new System.EventHandler(this.DeployWizard_Load);
95 | ((System.ComponentModel.ISupportInitialize)(this.stepWizardControl)).EndInit();
96 | this.wizardPageMetadata.ResumeLayout(false);
97 | ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
98 | this.ResumeLayout(false);
99 |
100 | }
101 |
102 | #endregion
103 | private AeroWizard.StepWizardControl stepWizardControl;
104 | private AeroWizard.WizardPage wizardPageMetadata;
105 | private AeroWizard.WizardPage wizardPageOptions;
106 | private System.Windows.Forms.ErrorProvider errorProvider;
107 | private System.Windows.Forms.OpenFileDialog openAssemblyInfoFileDialog;
108 | }
109 | }
--------------------------------------------------------------------------------
/src/Forms/DeployWizard.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows.Forms;
7 | using AeroWizard;
8 | using CnSharp.VisualStudio.Extensions;
9 | using CnSharp.VisualStudio.Extensions.Projects;
10 | using CnSharp.VisualStudio.NuPack.Config;
11 | using CnSharp.VisualStudio.NuPack.Controls;
12 | using CnSharp.VisualStudio.NuPack.Extensions;
13 | using CnSharp.VisualStudio.NuPack.Models;
14 | using CnSharp.VisualStudio.NuPack.Util;
15 | using EnvDTE;
16 | using EnvDTE80;
17 | using Microsoft.VisualStudio.Shell;
18 | using NuGet.Packaging;
19 | using NuGet.Versioning;
20 | using Process = System.Diagnostics.Process;
21 |
22 | namespace CnSharp.VisualStudio.NuPack.Forms
23 | {
24 | public partial class DeployWizard : Form
25 | {
26 | private readonly DTE2 _dte;
27 | private readonly ManifestMetadata _metadata;
28 | private readonly ManifestMetadataViewModel _metadataVM;
29 | private readonly AsyncPackage _package;
30 | private readonly PackageMetadataControl _metadataControl;
31 | private readonly PackOptionsControl _optionsControl;
32 | private readonly PackageProjectProperties _ppp;
33 | private readonly Project _project;
34 | private readonly string _projectDir;
35 | private readonly string _slnDir;
36 | private string _outputDir;
37 |
38 | private DeployWizard()
39 | {
40 | InitializeComponent();
41 |
42 | _metadataControl = new PackageMetadataControl();
43 | _metadataControl.Dock = DockStyle.Fill;
44 | _metadataControl.ErrorProvider = errorProvider;
45 | wizardPageMetadata.Controls.Add(_metadataControl);
46 | ActiveControl = _metadataControl;
47 |
48 | _optionsControl = new PackOptionsControl();
49 | _optionsControl.Dock = DockStyle.Fill;
50 | _optionsControl.ErrorProvider = errorProvider;
51 | wizardPageOptions.Controls.Add(_optionsControl);
52 |
53 | stepWizardControl.SelectedPageChanged += StepWizardControl_SelectedPageChanged;
54 | stepWizardControl.Finished += StepWizardControl_Finished;
55 | wizardPageMetadata.Commit += WizardPageCommit;
56 | wizardPageOptions.Commit += WizardPageCommit;
57 |
58 | BindSources();
59 | }
60 |
61 | public DeployWizard(DTE2 dte, AsyncPackage package) : this()
62 | {
63 | _dte = dte;
64 | _package = package;
65 | var project = dte.GetActiveProject();
66 | _ppp = project.GetPackageProjectProperties();
67 | InitProjectPackageInfo(_ppp, project);
68 | _metadata = _ppp.ToManifestMetadata();
69 | _metadataVM = new ManifestMetadataViewModel(_metadata);
70 | _slnDir = Path.GetDirectoryName(dte.Solution.FileName);
71 | _project = _dte.GetActiveProject();
72 | _metadataControl.Project = _project;
73 | _projectDir = _project.GetDirectory();
74 | var outputDir = Path.Combine(_projectDir, "bin", Common.ProductName);
75 | _optionsControl.LoadConfig(_projectDir, outputDir);
76 | }
77 |
78 | private void InitProjectPackageInfo(PackageProjectProperties ppp, Project project)
79 | {
80 | if (ppp.PackageId == null)
81 | ppp.PackageId = project.Name;
82 | if (ppp.Version == null)
83 | ppp.Version = "1.0.0";
84 | }
85 |
86 | private void BindSources()
87 | {
88 | var sources = new NuGetConfigReader(_slnDir, _projectDir).GetNuGetSources();
89 | _optionsControl.Sources = sources;
90 | }
91 |
92 | private void WizardPageCommit(object sender, WizardPageConfirmEventArgs e)
93 | {
94 | var wp = sender as WizardPage;
95 | if (Validation.HasValidationErrors(wp.Controls)) e.Cancel = true;
96 | }
97 |
98 | private void StepWizardControl_SelectedPageChanged(object sender, EventArgs e)
99 | {
100 | if (stepWizardControl.SelectedPage == wizardPageMetadata)
101 | _metadataControl.Focus();
102 | else if (stepWizardControl.SelectedPage == wizardPageOptions) _optionsControl.Focus();
103 | }
104 |
105 | private void StepWizardControl_Finished(object sender, EventArgs e)
106 | {
107 | DialogResult = DialogResult.OK;
108 | }
109 |
110 | private void DeployWizard_Load(object sender, EventArgs e)
111 | {
112 | BindingMetaData();
113 | }
114 |
115 | private void BindingMetaData()
116 | {
117 | var ver = _ppp.AssemblyVersion;
118 | if (_metadataVM.Version == null)
119 | _metadataVM.Version = new NuGetVersion(ver);
120 | if (_metadataVM.Title.IsEmptyOrPlaceHolder())
121 | _metadataVM.Title = _metadataVM.Id;
122 | _metadataControl.ManifestMetadata = _metadataVM;
123 | }
124 |
125 | public void SaveAndBuild()
126 | {
127 | var needPush = NeedPush();
128 | if (needPush && _optionsControl.PackArgs.NoBuild)
129 | {
130 | var yes = _package.ShowQuestion("You are going to deploy the package with --nobuild,do you confirm?",
131 | "Warning");
132 | if(!yes) return;
133 | }
134 | ActiveOutputWindow();
135 | OutputMessage("start..." + Environment.NewLine);
136 | OutputMessage(Environment.NewLine + "Save package info to project.");
137 | SavePackageInfo();
138 | EnsureOutputDir();
139 | if (!_optionsControl.PackArgs.NoBuild)
140 | {
141 | OutputMessage(Environment.NewLine + "Building...");
142 | if (!Host.Instance.Solution2.BuildRelease())
143 | return;
144 | }
145 | OutputMessage(Environment.NewLine + "Do packaging...");
146 | if (!Pack()) return;
147 | // ShowPackages();
148 | OutputMessage(Environment.NewLine + "Save project config.");
149 | SaveProjectConfig();
150 |
151 | if (!needPush)
152 | {
153 | ShowPackages();
154 | OutputMessage(Environment.NewLine + "All Done!");
155 | return;
156 | }
157 | OutputMessage(Environment.NewLine+ "Pushing nupkg..." );
158 | var pushResult = Push();
159 | if (!pushResult) return;
160 | OutputMessage(Environment.NewLine + "All Done!");
161 | }
162 |
163 | private void SavePackageInfo()
164 | {
165 | LinkIcon();
166 | LinkReadme();
167 | _project.Save();
168 | _metadataVM.SyncToPackageProjectProperties(_ppp);
169 | _project.SavePackageProjectProperties(_ppp);
170 | }
171 |
172 | private void LinkIcon()
173 | {
174 | if (!_metadataVM.IconChanged) return;
175 | _metadataVM.Icon = AddOrUpdatePackFile(_metadataVM.IconUrlString, _metadata.Icon);
176 | }
177 |
178 | private void LinkReadme()
179 | {
180 | if (!_metadataVM.ReadmeChanged) return;
181 | _metadataVM.Readme = AddOrUpdatePackFile(_metadataVM.Readme, _metadata.Readme);
182 | }
183 |
184 | private string AddOrUpdatePackFile(string filePath, string oldFile)
185 | {
186 | if (string.IsNullOrWhiteSpace(filePath))
187 | {
188 | return null;
189 | }
190 | var absolutePath = ToAbsolutePath(filePath);
191 | if (!string.IsNullOrEmpty(absolutePath) && !File.Exists(absolutePath))
192 | throw new FileNotFoundException($"File `{filePath}` not found");
193 | if (!string.IsNullOrWhiteSpace(oldFile))
194 | {
195 | var oldFilePath = Path.Combine(_projectDir, oldFile);
196 | if (oldFilePath == absolutePath)
197 | {
198 | //not changed
199 | return oldFile;
200 | }
201 | //remove old item
202 | var oldItem = _project.ProjectItems.Item(oldFile);
203 | if (oldItem != null)
204 | {
205 | oldItem.Remove();
206 | if (File.Exists(oldFilePath))
207 | File.Delete(oldFilePath);
208 | }
209 | }
210 |
211 | var fileName = Path.GetFileName(absolutePath);
212 | var existsItem = _project.ProjectItems.Item(fileName);
213 | if (existsItem != null)
214 | {
215 | existsItem.Remove();
216 | }
217 |
218 | var item = _project.ProjectItems.AddFromFile(absolutePath);
219 | _project.SetItemAttribute(item, "Pack", true.ToString());
220 | _project.SetItemAttribute(item, "PackagePath", "\\");
221 | return fileName;
222 | }
223 |
224 | private string ToAbsolutePath(string path)
225 | {
226 | if (string.IsNullOrWhiteSpace(path) || path.Contains(":\\"))
227 | {
228 | return path;
229 | }
230 | Directory.SetCurrentDirectory(Path.GetDirectoryName(_project.FileName));
231 | return Path.GetFullPath(path);
232 | }
233 |
234 | private string GetRelativePath(string path, string baseDir)
235 | {
236 | var uri = new Uri(path);
237 | var exeUri = new Uri(baseDir);
238 | var relativePath = exeUri.MakeRelativeUri(uri);
239 | return relativePath.ToString();
240 | }
241 |
242 | private bool Pack()
243 | {
244 | var args = _optionsControl.PackArgs;
245 | var script =
246 | new StringBuilder(
247 | $"pack \"{_project.FullName}\" -c Release -p:PackageVersion={_metadataVM.VersionString}");
248 | if (!string.IsNullOrWhiteSpace(args.OutputDirectory))
249 | script.Append($" -o \"{args.OutputDirectory}\"");
250 | if (args.IncludeSymbols)
251 | script.Append(" --include-symbols ");
252 | if (args.IncludeSource)
253 | script.Append(" --include-source ");
254 | if(args.NoBuild)
255 | script.Append(" --no-build ");
256 | if (args.NoDependencies)
257 | script.Append(" --no-dependencies ");
258 | // if (File.Exists(_nuspecFile))
259 | // script.AppendFormat(" -p:NuspecFile=\"{0}\" ", _nuspecFile);
260 | return CmdUtil.RunDotnet(script.ToString(), OutputMessage, OutputMessage);
261 | }
262 |
263 | private void ActiveOutputWindow()
264 | {
265 | _dte.ToolWindows.OutputWindow.Parent.Activate();
266 | }
267 |
268 | private void OutputMessage(string message)
269 | {
270 | _dte.OutputMessage(Common.ProductName, message);
271 | }
272 |
273 | private bool NeedPush()
274 | {
275 | var args = _optionsControl.PushArgs;
276 | return !string.IsNullOrWhiteSpace(args.Source) || !string.IsNullOrWhiteSpace(args.SymbolSource);
277 | }
278 |
279 | private bool Push()
280 | {
281 | var args = _optionsControl.PushArgs;
282 | var script = new StringBuilder();
283 | if (!string.IsNullOrWhiteSpace(args.Source))
284 | {
285 | script.Append(
286 | $"nuget push \"{_outputDir}{_metadataVM.Id}.{_metadataVM.VersionString}.nupkg\" -s \"{args.Source}\" ");
287 | if (!string.IsNullOrWhiteSpace(args.ApiKey))
288 | script.Append($" -k \"{args.ApiKey}\"");
289 | }
290 |
291 | if (!string.IsNullOrWhiteSpace(args.SymbolSource))
292 | {
293 | script.Append($" -ss \"{args.SymbolSource}\" ");
294 | if (!string.IsNullOrWhiteSpace(args.SymbolApiKey))
295 | script.Append($" -sk \"{args.SymbolApiKey}\"");
296 | }
297 |
298 | if (script.Length == 0)
299 | return true;
300 |
301 | return CmdUtil.RunDotnet(script.ToString(), OutputMessage, OutputMessage);
302 | }
303 |
304 | private void ShowPackages()
305 | {
306 | var pkg = $"{_outputDir}{_metadataVM.Id}.{_metadataVM.VersionString}.nupkg";
307 | if (File.Exists(pkg))
308 | Process.Start("explorer.exe", $"/select,\"{pkg}\"");
309 | }
310 |
311 | private void EnsureOutputDir()
312 | {
313 | _outputDir = _optionsControl.PackArgs.OutputDirectory.Trim().Replace("/", "\\");
314 | if (string.IsNullOrWhiteSpace(_outputDir)) return;
315 | if (!Directory.Exists(_outputDir))
316 | Directory.CreateDirectory(_outputDir);
317 | if (!_outputDir.EndsWith("\\"))
318 | _outputDir += "\\";
319 | }
320 |
321 | private void SaveProjectConfig()
322 | {
323 | var config = _optionsControl.Config;
324 | if (config.SymbolServers?.Any() == true)
325 | {
326 | if (!string.IsNullOrWhiteSpace(_optionsControl.PushArgs.SymbolSource))
327 | {
328 | config.SymbolServers.Add(_optionsControl.PushArgs.SymbolSource);
329 | }
330 | config.SymbolServers =
331 | config.SymbolServers.Where(x => !string.IsNullOrWhiteSpace(x)).Distinct().ToList();
332 | }
333 | else
334 | {
335 | if (!string.IsNullOrWhiteSpace(_optionsControl.PushArgs.SymbolSource))
336 | {
337 | config.SymbolServers = new List
338 | {
339 | _optionsControl.PushArgs.SymbolSource
340 | };
341 | }
342 | }
343 |
344 | new NuPackConfigHelper(_projectDir).Save(config);
345 | }
346 | }
347 | }
--------------------------------------------------------------------------------
/src/Forms/LoadingForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 |
6 | namespace CnSharp.VisualStudio.NuPack.Forms
7 | {
8 | public partial class LoadingForm : Form
9 | {
10 | #region Constants and Fields
11 | private BackgroundWorker _backgroundWorker;
12 |
13 | private bool _isCloseBySelf;
14 |
15 | #endregion
16 |
17 | #region Constructors and Destructors
18 |
19 | public LoadingForm()
20 | {
21 | InitializeComponent();
22 |
23 | _isCloseBySelf = false;
24 | LoadingMessage = "Loading...";
25 | }
26 |
27 | #endregion
28 |
29 | #region Public Properties
30 |
31 | public BackgroundWorker BackgroundWorker
32 | {
33 | get { return _backgroundWorker; }
34 | set
35 | {
36 | if (_backgroundWorker != null && _backgroundWorker.IsBusy)
37 | {
38 | return;
39 | }
40 | _backgroundWorker = value;
41 | _backgroundWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerCompleted;
42 | if (_backgroundWorker.WorkerReportsProgress)
43 | {
44 | progressBar.Maximum = 100;
45 | progressBar.Show();
46 | _backgroundWorker.ProgressChanged += backgroundWorker_ProgressChanged;
47 | }
48 | }
49 | }
50 |
51 | public Action Action { get; set; }
52 |
53 | public string LoadingMessage { get; set; }
54 |
55 | public bool ReloadEnabled { get; set; } = true;
56 |
57 | #endregion
58 |
59 | #region Methods
60 |
61 | private void BackgroundWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
62 | {
63 | if (e.Error != null)
64 | {
65 | ShowError(e.Error);
66 | return;
67 | }
68 | _isCloseBySelf = true;
69 | Close();
70 | }
71 |
72 | private void ShowError(Exception error)
73 | {
74 | ShowStatus("Loading failed."+Environment.NewLine + error.Message);
75 |
76 |
77 | reloadPicture.Top = loadingPicture.Top;
78 | reloadPicture.Left = loadingPicture.Left - reloadPicture.Width / 2;
79 | reloadPicture.Visible = ReloadEnabled;
80 |
81 | closePicture.Visible = true;
82 | closePicture.Top = loadingPicture.Top;
83 | closePicture.Left = ReloadEnabled ? loadingPicture.Right : reloadPicture.Left;
84 |
85 | loadingPicture.Visible = false;
86 | }
87 |
88 | private void FrmWait_FormClosing(object sender, FormClosingEventArgs e)
89 | {
90 | if (!_isCloseBySelf)
91 | {
92 | e.Cancel = true;
93 | }
94 | }
95 |
96 | private void FrmWait_Load(object sender, EventArgs e)
97 | {
98 | var x = Width/2 - panel1.Width/2;
99 | var y = Height/2 - panel1.Height/2;
100 |
101 | var point = new Point(x, y);
102 |
103 | panel1.Location = point;
104 |
105 | FormBorderStyle = FormBorderStyle.None;
106 |
107 | MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
108 |
109 | WindowState = FormWindowState.Maximized;
110 |
111 | Refresh();
112 |
113 | if (Action != null)
114 | {
115 | try
116 | {
117 | Action.Invoke();
118 | _isCloseBySelf = true;
119 | Close();
120 | }
121 | catch (Exception exception)
122 | {
123 | ShowError(exception);
124 | }
125 | }
126 | }
127 |
128 | public void DoAction(Action action, bool closeWhenCompleted = true)
129 | {
130 |
131 | }
132 |
133 | private void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
134 | {
135 | ShowProcess(e.ProgressPercentage);
136 | }
137 |
138 | #endregion
139 |
140 | #region Implementation of IBlockView
141 |
142 | public void Block()
143 | {
144 | ShowDialog();
145 | }
146 |
147 | public void UnBlock()
148 | {
149 | _isCloseBySelf = true;
150 | Close();
151 | }
152 |
153 | public void ShowProcess(int percentage)
154 | {
155 | if (!progressBar.Visible) progressBar.Visible = true;
156 | progressBar.Value = percentage;
157 | }
158 |
159 | public void ShowStatus(string status)
160 | {
161 | label.Visible = true;
162 | label.Text = status;
163 | }
164 |
165 | #endregion
166 |
167 | private void ReloadPicture_Click(object sender, EventArgs e)
168 | {
169 | if (BackgroundWorker == null || BackgroundWorker.IsBusy)
170 | return;
171 | loadingPicture.Visible = true;
172 | reloadPicture.Visible = false;
173 | closePicture.Visible = false;
174 | ShowStatus(LoadingMessage);
175 | BackgroundWorker.RunWorkerAsync();
176 | }
177 |
178 | private void closePicture_Click(object sender, EventArgs e)
179 | {
180 | _isCloseBySelf = true;
181 | Close();
182 | if(Parent is Form form)
183 | form.Close();
184 | else
185 | {
186 | Owner?.Close();
187 | }
188 | }
189 | }
190 | }
--------------------------------------------------------------------------------
/src/Forms/LoadingForm.designer.cs:
--------------------------------------------------------------------------------
1 | namespace CnSharp.VisualStudio.NuPack.Forms
2 | {
3 | partial class LoadingForm
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 Windows Form 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.progressBar = new System.Windows.Forms.ProgressBar();
32 | this.label = new System.Windows.Forms.Label();
33 | this.panel1 = new System.Windows.Forms.Panel();
34 | this.closePicture = new System.Windows.Forms.PictureBox();
35 | this.reloadPicture = new System.Windows.Forms.PictureBox();
36 | this.loadingPicture = new System.Windows.Forms.PictureBox();
37 | this.panel2 = new System.Windows.Forms.Panel();
38 | this.panel1.SuspendLayout();
39 | ((System.ComponentModel.ISupportInitialize)(this.closePicture)).BeginInit();
40 | ((System.ComponentModel.ISupportInitialize)(this.reloadPicture)).BeginInit();
41 | ((System.ComponentModel.ISupportInitialize)(this.loadingPicture)).BeginInit();
42 | this.panel2.SuspendLayout();
43 | this.SuspendLayout();
44 | //
45 | // progressBar
46 | //
47 | this.progressBar.Location = new System.Drawing.Point(0, 155);
48 | this.progressBar.Name = "progressBar";
49 | this.progressBar.Size = new System.Drawing.Size(332, 25);
50 | this.progressBar.TabIndex = 0;
51 | this.progressBar.Visible = false;
52 | //
53 | // label
54 | //
55 | this.label.AutoSize = true;
56 | this.label.ForeColor = System.Drawing.Color.Red;
57 | this.label.Location = new System.Drawing.Point(96, 99);
58 | this.label.Name = "label";
59 | this.label.Size = new System.Drawing.Size(54, 13);
60 | this.label.TabIndex = 1;
61 | this.label.Text = "Loading...";
62 | //
63 | // panel1
64 | //
65 | this.panel1.Controls.Add(this.closePicture);
66 | this.panel1.Controls.Add(this.reloadPicture);
67 | this.panel1.Controls.Add(this.label);
68 | this.panel1.Controls.Add(this.progressBar);
69 | this.panel1.Controls.Add(this.loadingPicture);
70 | this.panel1.Location = new System.Drawing.Point(51, 69);
71 | this.panel1.Name = "panel1";
72 | this.panel1.Size = new System.Drawing.Size(332, 184);
73 | this.panel1.TabIndex = 2;
74 | //
75 | // closePicture
76 | //
77 | this.closePicture.Image = global::CnSharp.VisualStudio.NuPack.Resource.close;
78 | this.closePicture.Location = new System.Drawing.Point(285, 11);
79 | this.closePicture.Name = "closePicture";
80 | this.closePicture.Size = new System.Drawing.Size(44, 54);
81 | this.closePicture.TabIndex = 5;
82 | this.closePicture.TabStop = false;
83 | this.closePicture.Visible = false;
84 | this.closePicture.Click += new System.EventHandler(this.closePicture_Click);
85 | //
86 | // reloadPicture
87 | //
88 | this.reloadPicture.Image = global::CnSharp.VisualStudio.NuPack.Resource.reload32;
89 | this.reloadPicture.Location = new System.Drawing.Point(213, 11);
90 | this.reloadPicture.Name = "reloadPicture";
91 | this.reloadPicture.Size = new System.Drawing.Size(44, 54);
92 | this.reloadPicture.TabIndex = 4;
93 | this.reloadPicture.TabStop = false;
94 | this.reloadPicture.Visible = false;
95 | this.reloadPicture.Click += new System.EventHandler(this.ReloadPicture_Click);
96 | //
97 | // loadingPicture
98 | //
99 | this.loadingPicture.Image = global::CnSharp.VisualStudio.NuPack.Resource.loading32;
100 | this.loadingPicture.Location = new System.Drawing.Point(138, 11);
101 | this.loadingPicture.Name = "loadingPicture";
102 | this.loadingPicture.Size = new System.Drawing.Size(49, 54);
103 | this.loadingPicture.TabIndex = 3;
104 | this.loadingPicture.TabStop = false;
105 | //
106 | // panel2
107 | //
108 | this.panel2.BackColor = System.Drawing.Color.Beige;
109 | this.panel2.Controls.Add(this.panel1);
110 | this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
111 | this.panel2.Location = new System.Drawing.Point(0, 0);
112 | this.panel2.Name = "panel2";
113 | this.panel2.Size = new System.Drawing.Size(436, 377);
114 | this.panel2.TabIndex = 3;
115 | //
116 | // WaitingForm
117 | //
118 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
119 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
120 | this.ClientSize = new System.Drawing.Size(436, 377);
121 | this.Controls.Add(this.panel2);
122 | this.Name = "LoadingForm";
123 | this.Opacity = 0.75D;
124 | this.ShowInTaskbar = false;
125 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
126 | this.Text = "Loading";
127 | this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
128 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmWait_FormClosing);
129 | this.Load += new System.EventHandler(this.FrmWait_Load);
130 | this.panel1.ResumeLayout(false);
131 | this.panel1.PerformLayout();
132 | ((System.ComponentModel.ISupportInitialize)(this.closePicture)).EndInit();
133 | ((System.ComponentModel.ISupportInitialize)(this.reloadPicture)).EndInit();
134 | ((System.ComponentModel.ISupportInitialize)(this.loadingPicture)).EndInit();
135 | this.panel2.ResumeLayout(false);
136 | this.ResumeLayout(false);
137 |
138 | }
139 |
140 | #endregion
141 |
142 | private System.Windows.Forms.ProgressBar progressBar;
143 | private System.Windows.Forms.Label label;
144 | private System.Windows.Forms.Panel panel1;
145 | private System.Windows.Forms.PictureBox loadingPicture;
146 | private System.Windows.Forms.Panel panel2;
147 | private System.Windows.Forms.PictureBox reloadPicture;
148 | private System.Windows.Forms.PictureBox closePicture;
149 | }
150 | }
--------------------------------------------------------------------------------
/src/Forms/LoadingForm.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/Models/ManifestMetadataViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using NuGet.Packaging;
4 | using NuGet.Packaging.Core;
5 | using NuGet.Versioning;
6 |
7 | namespace CnSharp.VisualStudio.NuPack.Models
8 | {
9 | public class ManifestMetadataViewModel : ManifestMetadata
10 | {
11 | private readonly ManifestMetadata _metadata;
12 | private string _licenseUrlString;
13 | private string _projectUrlString;
14 |
15 | public ManifestMetadataViewModel()
16 | {
17 | }
18 |
19 | public ManifestMetadataViewModel(ManifestMetadata metadata)
20 | {
21 | _metadata = metadata;
22 | Authors = metadata.Authors;
23 | ContentFiles = metadata.ContentFiles;
24 | Copyright = metadata.Copyright;
25 | DependencyGroups = metadata.DependencyGroups;
26 | Description = metadata.Description;
27 | DevelopmentDependency = metadata.DevelopmentDependency;
28 | Id = metadata.Id;
29 | Icon = metadata.Icon;
30 | Language = metadata.Language;
31 | Owners = metadata.Owners;
32 | Readme = metadata.Readme;
33 | ReleaseNotes = metadata.ReleaseNotes;
34 | Repository = metadata.Repository;
35 | RequireLicenseAcceptance = metadata.RequireLicenseAcceptance;
36 | Serviceable = metadata.Serviceable;
37 | Summary = metadata.Summary;
38 | Tags = metadata.Tags;
39 | Title = metadata.Title;
40 | LicenseMetadata = metadata.LicenseMetadata;
41 |
42 | // licenseUrl is deprecated, keep it just for old projects when LicenseMetadata is null
43 | if (metadata.LicenseMetadata == null && metadata.LicenseUrl != null)
44 | {
45 | LicenseUrlString = metadata.LicenseUrl?.OriginalString;
46 | }
47 |
48 | _projectUrlString = metadata.ProjectUrl?.OriginalString ?? string.Empty;
49 | if (!string.IsNullOrWhiteSpace(_projectUrlString))
50 | SetProjectUrl(_projectUrlString);
51 | Version = metadata.Version;
52 | }
53 |
54 | public string AuthorsString
55 | {
56 | get => Authors != null ? string.Join(",", Authors) : string.Empty;
57 | set => Authors = value.Split(',').ToList();
58 | }
59 |
60 | public string OwnersString
61 | {
62 | get => Owners != null ? string.Join(",", Owners) : string.Empty;
63 | set => Owners = value.Split(',').ToList();
64 | }
65 |
66 |
67 | public string PackageLicenseExpression
68 | {
69 | get => LicenseMetadata?.License ?? string.Empty;
70 | set
71 | {
72 | if (string.IsNullOrWhiteSpace(value))
73 | {
74 | LicenseMetadata = null;
75 | return;
76 | }
77 |
78 | LicenseMetadata = new LicenseMetadata(LicenseType.Expression, value, null, null,
79 | LicenseMetadata.CurrentVersion);
80 | }
81 | }
82 |
83 | public string LicenseUrlString
84 | {
85 | get => _licenseUrlString;
86 | set
87 | {
88 | _licenseUrlString = value;
89 | if (!string.IsNullOrWhiteSpace(value))
90 | SetLicenseUrl(value);
91 | }
92 | }
93 |
94 | public string IconUrlString
95 | {
96 | get => Icon ?? (IconUrl?.OriginalString ?? string.Empty);
97 | set
98 | {
99 | Icon = value;
100 | if (!string.IsNullOrWhiteSpace(value) && value.StartsWith("http"))
101 | {
102 | SetIconUrl(value);
103 | Icon = null;
104 | }
105 | }
106 | }
107 |
108 | public bool IconChanged => Icon != _metadata.Icon;
109 |
110 |
111 | public string ProjectUrlString
112 | {
113 | get => _projectUrlString;
114 | set
115 | {
116 | _projectUrlString = value;
117 | if (!string.IsNullOrWhiteSpace(value))
118 | SetProjectUrl(value);
119 | }
120 | }
121 |
122 | public bool ReadmeChanged => Readme != _metadata.Readme;
123 |
124 | public string RepositoryType
125 | {
126 | get => Repository?.Type ?? string.Empty;
127 | set
128 | {
129 | if (Repository != null)
130 | {
131 | Repository.Type = value;
132 | return;
133 | }
134 |
135 | Repository = new RepositoryMetadata(value, null, null, null);
136 | }
137 | }
138 |
139 | public string RepositoryUrl
140 | {
141 | get => Repository?.Url ?? string.Empty;
142 | set
143 | {
144 | if (Repository != null)
145 | {
146 | Repository.Url = value;
147 | return;
148 | }
149 |
150 | Repository = new RepositoryMetadata(null, value, null, null);
151 | }
152 | }
153 |
154 | public string VersionString
155 | {
156 | get => Version.OriginalVersion;
157 | set
158 | {
159 | if (string.IsNullOrWhiteSpace(value))
160 | {
161 | Version = null;
162 | }
163 |
164 | try
165 | {
166 | Version = new NuGetVersion(value);
167 | }
168 | catch
169 | {
170 | //ignored
171 | }
172 | }
173 | }
174 | }
175 | }
--------------------------------------------------------------------------------
/src/Models/PackArgs.cs:
--------------------------------------------------------------------------------
1 | namespace CnSharp.VisualStudio.NuPack.Models
2 | {
3 | /**
4 | * Arguments of 'dotnet pack' command
5 | * see:https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack
6 | */
7 | public class PackArgs
8 | {
9 | public string OutputDirectory { get; set; }
10 | public bool IncludeSymbols { get; set; }
11 | public bool IncludeSource { get; set; }
12 |
13 | public bool NoBuild { get; set; }
14 | public bool NoDependencies { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Models/PushArgs.cs:
--------------------------------------------------------------------------------
1 | namespace CnSharp.VisualStudio.NuPack.Models
2 | {
3 | public class PushArgs
4 | {
5 | public string Source { get; set; }
6 | public string ApiKey { get; set; }
7 | public string SymbolSource { get; set; }
8 | public string SymbolApiKey { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/NuPack.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 17.0
5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
6 |
7 |
8 |
9 |
10 | Debug
11 | AnyCPU
12 | 2.0
13 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | {D53600BB-F94D-4421-8B05-22F206F23A5F}
15 | Library
16 | Properties
17 | CnSharp.VisualStudio.NuPack
18 | NuPack
19 | v4.7.2
20 | true
21 | true
22 | true
23 | false
24 | false
25 | true
26 | true
27 | Program
28 | $(DevEnvDir)devenv.exe
29 | /rootsuffix Exp
30 |
31 |
32 | true
33 | full
34 | false
35 | bin\Debug\
36 | DEBUG;TRACE
37 | prompt
38 | 4
39 |
40 |
41 | pdbonly
42 | true
43 | bin\Release\
44 | TRACE
45 | prompt
46 | 4
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | Form
59 |
60 |
61 | AssemblyInfoForm.cs
62 |
63 |
64 | Form
65 |
66 |
67 | LoadingForm.cs
68 |
69 |
70 |
71 |
72 |
73 | True
74 | True
75 | NuPackPackage.vsct
76 |
77 |
78 | Form
79 |
80 |
81 | DeployWizard.cs
82 |
83 |
84 |
85 | UserControl
86 |
87 |
88 | PackageMetadataControl.cs
89 |
90 |
91 | UserControl
92 |
93 |
94 | PackOptionsControl.cs
95 |
96 |
97 |
98 |
99 | True
100 | True
101 | Resource.resx
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 | Designer
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 | 2.3.1
129 |
130 |
131 | 4.7.0
132 |
133 |
134 | compile; build; native; contentfiles; analyzers; buildtransitive
135 |
136 |
137 | 6.12.1
138 |
139 |
140 | 17.0.2
141 |
142 |
143 |
144 |
145 | Menus.ctmenu
146 | VsctGenerator
147 | NuPackPackage1.cs
148 |
149 |
150 |
151 |
152 | Always
153 | true
154 |
155 |
156 | Always
157 | true
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 | Always
168 | true
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 | Always
177 | true
178 |
179 |
180 |
181 |
182 | AssemblyInfoForm.cs
183 |
184 |
185 | LoadingForm.cs
186 |
187 |
188 | DeployWizard.cs
189 |
190 |
191 | PackageMetadataControl.cs
192 |
193 |
194 | PackOptionsControl.cs
195 |
196 |
197 | ResXFileCodeGenerator
198 | Resource.Designer.cs
199 |
200 |
201 |
202 |
203 |
204 |
211 |
--------------------------------------------------------------------------------
/src/NuPack.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.12.35527.113
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NuPack", "NuPack.csproj", "{D53600BB-F94D-4421-8B05-22F206F23A5F}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{99AB1735-8371-4015-ABD6-C5A65BCB25BD}"
9 | ProjectSection(SolutionItems) = preProject
10 | ..\.gitignore = ..\.gitignore
11 | ..\README.md = ..\README.md
12 | EndProjectSection
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Debug|arm64 = Debug|arm64
18 | Debug|x86 = Debug|x86
19 | Release|Any CPU = Release|Any CPU
20 | Release|arm64 = Release|arm64
21 | Release|x86 = Release|x86
22 | EndGlobalSection
23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
24 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Debug|arm64.ActiveCfg = Debug|arm64
27 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Debug|arm64.Build.0 = Debug|arm64
28 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Debug|x86.ActiveCfg = Debug|x86
29 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Debug|x86.Build.0 = Debug|x86
30 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Release|arm64.ActiveCfg = Release|arm64
33 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Release|arm64.Build.0 = Release|arm64
34 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Release|x86.ActiveCfg = Release|x86
35 | {D53600BB-F94D-4421-8B05-22F206F23A5F}.Release|x86.Build.0 = Release|x86
36 | EndGlobalSection
37 | GlobalSection(SolutionProperties) = preSolution
38 | HideSolutionNode = FALSE
39 | EndGlobalSection
40 | EndGlobal
41 |
--------------------------------------------------------------------------------
/src/NuPackPackage.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.Shell;
2 | using System;
3 | using System.Runtime.InteropServices;
4 | using System.Threading;
5 | using CnSharp.VisualStudio.Extensions;
6 | using CnSharp.VisualStudio.NuPack.Commands;
7 | using EnvDTE;
8 | using EnvDTE80;
9 | using Task = System.Threading.Tasks.Task;
10 |
11 | namespace CnSharp.VisualStudio.NuPack
12 | {
13 | ///
14 | /// This is the class that implements the package exposed by this assembly.
15 | ///
16 | ///
17 | ///
18 | /// The minimum requirement for a class to be considered a valid package for Visual Studio
19 | /// is to implement the IVsPackage interface and register itself with the shell.
20 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF)
21 | /// to do it: it derives from the Package class that provides the implementation of the
22 | /// IVsPackage interface and uses the registration attributes defined in the framework to
23 | /// register itself and its components with the shell. These attributes tell the pkgdef creation
24 | /// utility what data to put into .pkgdef file.
25 | ///
26 | ///
27 | /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file.
28 | ///
29 | ///
30 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
31 | [Guid(PackageGuidString)]
32 | [ProvideMenuResource("Menus.ctmenu", 1)]
33 | [ProvideUIContextRule(
34 | contextGuid: PackageGuids.guidMigrateNuspecToProjectUIRuleString,
35 | name: "package.nuspec file",
36 | expression: "package.nuspec",
37 | termNames: new []{"package.nuspec"},
38 | termValues: new []{"HierSingleSelectionName:package.nuspec$"})]
39 | public sealed class NuPackPackage : AsyncPackage
40 | {
41 | ///
42 | /// NuPack 2022 Package GUID string.
43 | ///
44 | public const string PackageGuidString = PackageGuids.guidNuPackPackageString;
45 |
46 | ///
47 | /// Initialization of the package; this method is called right after the package is sited, so this is the place
48 | /// where you can put all the initialization code that rely on services provided by VisualStudio.
49 | ///
50 | /// A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.
51 | /// A provider for progress updates.
52 | /// 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.
53 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress)
54 | {
55 | // When initialized asynchronously, the current thread may be a background thread at this point.
56 | // Do any initialization that requires the UI thread after switching to the UI thread.
57 | await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
58 |
59 | var dte = GetGlobalService(typeof(DTE)) as DTE2;
60 | Host.Instance.DTE = dte;
61 |
62 | // await AssemblyInfoEditCommand.InitializeAsync(this);
63 | await DeployPackageCommand.InitializeAsync(this);
64 | await MigrateNuspecToProjectCommand.InitializeAsync(this);
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/NuPackPackage.vsct:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
37 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
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 |
--------------------------------------------------------------------------------
/src/NuPackPackage1.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // This file was generated by VSIX Synchronizer
4 | //
5 | // ------------------------------------------------------------------------------
6 | namespace CnSharp.VisualStudio.NuPack
7 | {
8 | using System;
9 |
10 | ///
11 | /// Helper class that exposes all GUIDs used across VS Package.
12 | ///
13 | internal sealed partial class PackageGuids
14 | {
15 | public const string guidNuPackPackageString = "b90fffa4-9f8a-4bbf-9a4f-16880fbfea9c";
16 | public static Guid guidNuPackPackage = new Guid(guidNuPackPackageString);
17 |
18 | public const string guidDeployPackageCmdSetString = "7d371e13-afd3-4d17-8c84-9bf0fe65da2a";
19 | public static Guid guidDeployPackageCmdSet = new Guid(guidDeployPackageCmdSetString);
20 |
21 | public const string guidPackageDeploymentImageString = "04e5e168-97c3-438a-b67e-35b4b90e81e3";
22 | public static Guid guidPackageDeploymentImage = new Guid(guidPackageDeploymentImageString);
23 |
24 | public const string guidMigrateNuspecToProjectCmdSetString = "df6aceb6-5353-4ec9-9174-069d2b2605ce";
25 | public static Guid guidMigrateNuspecToProjectCmdSet = new Guid(guidMigrateNuspecToProjectCmdSetString);
26 |
27 | public const string guidPackagePropertyImageString = "a266cd18-7edb-45c4-adb6-279ebf281d84";
28 | public static Guid guidPackagePropertyImage = new Guid(guidPackagePropertyImageString);
29 |
30 | public const string guidMigrateNuspecToProjectUIRuleString = "c0d08b33-dc49-4362-9b60-cc7761e29944";
31 | public static Guid guidMigrateNuspecToProjectUIRule = new Guid(guidMigrateNuspecToProjectUIRuleString);
32 | }
33 | ///
34 | /// Helper class that encapsulates all CommandIDs uses across VS Package.
35 | ///
36 | internal sealed partial class PackageIds
37 | {
38 | public const int DeployMenuGroup = 0x1020;
39 | public const int cmdidDeployPackageCommand = 0x0100;
40 | public const int deployPic = 0x0001;
41 | public const int MigrateNuspecMenuGroup = 0x1020;
42 | public const int cmdidMigrateNuspecToProjectCommand = 0x0101;
43 | public const int migrateNuspecPic = 0x0001;
44 | }
45 | }
--------------------------------------------------------------------------------
/src/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("NuPack")]
5 | [assembly: AssemblyDescription("A Nuget packaging and deploying wizard for VS 2022.")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("CnSharp Studio")]
8 | [assembly: AssemblyProduct("NuPack")]
9 | [assembly: AssemblyCopyright("Copyright \u00a9 CnSharp Studio 2015-2025")]
10 | [assembly: AssemblyTrademark("NuPack")]
11 | [assembly: AssemblyCulture("")]
12 | [assembly: ComVisible(false)]
13 | [assembly: AssemblyVersion("17.0.5.0")]
14 | [assembly: AssemblyFileVersion("17.0.5.0")]
--------------------------------------------------------------------------------
/src/Resource.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CnSharp.VisualStudio.NuPack {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resource {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resource() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CnSharp.VisualStudio.NuPack.Resource", typeof(Resource).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap close {
67 | get {
68 | object obj = ResourceManager.GetObject("close", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 |
73 | ///
74 | /// Looks up a localized resource of type System.Drawing.Bitmap.
75 | ///
76 | internal static System.Drawing.Bitmap folder {
77 | get {
78 | object obj = ResourceManager.GetObject("folder", resourceCulture);
79 | return ((System.Drawing.Bitmap)(obj));
80 | }
81 | }
82 |
83 | ///
84 | /// Looks up a localized resource of type System.Drawing.Bitmap.
85 | ///
86 | internal static System.Drawing.Bitmap HelpIndexFile {
87 | get {
88 | object obj = ResourceManager.GetObject("HelpIndexFile", resourceCulture);
89 | return ((System.Drawing.Bitmap)(obj));
90 | }
91 | }
92 |
93 | ///
94 | /// Looks up a localized resource of type System.Drawing.Bitmap.
95 | ///
96 | internal static System.Drawing.Bitmap loading32 {
97 | get {
98 | object obj = ResourceManager.GetObject("loading32", resourceCulture);
99 | return ((System.Drawing.Bitmap)(obj));
100 | }
101 | }
102 |
103 | ///
104 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
105 | ///
106 | internal static System.Drawing.Icon logo {
107 | get {
108 | object obj = ResourceManager.GetObject("logo", resourceCulture);
109 | return ((System.Drawing.Icon)(obj));
110 | }
111 | }
112 |
113 | ///
114 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
115 | ///
116 | internal static System.Drawing.Icon nuget {
117 | get {
118 | object obj = ResourceManager.GetObject("nuget", resourceCulture);
119 | return ((System.Drawing.Icon)(obj));
120 | }
121 | }
122 |
123 | ///
124 | /// Looks up a localized resource of type System.Drawing.Bitmap.
125 | ///
126 | internal static System.Drawing.Bitmap reload32 {
127 | get {
128 | object obj = ResourceManager.GetObject("reload32", resourceCulture);
129 | return ((System.Drawing.Bitmap)(obj));
130 | }
131 | }
132 |
133 | ///
134 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
135 | ///
136 | internal static System.Drawing.Icon zip {
137 | get {
138 | object obj = ResourceManager.GetObject("zip", resourceCulture);
139 | return ((System.Drawing.Icon)(obj));
140 | }
141 | }
142 | }
143 | }
144 |
--------------------------------------------------------------------------------
/src/Resource.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 |
122 | Resources\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
125 | Resources\nuget.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
126 |
127 |
128 | Resources\zip.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
129 |
130 |
131 | Resources\folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
132 |
133 |
134 | Resources\loading32.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
135 |
136 |
137 | Resources\reload32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
138 |
139 |
140 | Resources\Close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
141 |
142 |
143 | Resources\HelpIndexFile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
144 |
145 |
--------------------------------------------------------------------------------
/src/Resources/AssemblyInfoFile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/AssemblyInfoFile.png
--------------------------------------------------------------------------------
/src/Resources/Close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/Close.png
--------------------------------------------------------------------------------
/src/Resources/HelpIndexFile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/HelpIndexFile.png
--------------------------------------------------------------------------------
/src/Resources/PackageDeployment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/PackageDeployment.png
--------------------------------------------------------------------------------
/src/Resources/PackageProperty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/PackageProperty.png
--------------------------------------------------------------------------------
/src/Resources/attribute.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/attribute.png
--------------------------------------------------------------------------------
/src/Resources/exchange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/exchange.png
--------------------------------------------------------------------------------
/src/Resources/folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/folder.png
--------------------------------------------------------------------------------
/src/Resources/loading32.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/loading32.gif
--------------------------------------------------------------------------------
/src/Resources/logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/logo.ico
--------------------------------------------------------------------------------
/src/Resources/nuget.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/nuget.ico
--------------------------------------------------------------------------------
/src/Resources/reload32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/reload32.png
--------------------------------------------------------------------------------
/src/Resources/zip.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/Resources/zip.ico
--------------------------------------------------------------------------------
/src/Util/CmdUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Threading;
4 |
5 | namespace CnSharp.VisualStudio.NuPack.Util
6 | {
7 | public class CmdUtil
8 | {
9 | //cmd issues goes here:https://stackoverflow.com/questions/139593/processstartinfo-hanging-on-waitforexit-why
10 | public static bool RunCmd(string script, Action outputMessageHandler = null, Action errorMessageHandler = null)
11 | {
12 | using (var process = new Process())
13 | {
14 | process.StartInfo.FileName = @"C:\Windows\System32\cmd.exe";
15 | //process.StartInfo.Arguments = arguments;
16 | process.StartInfo.UseShellExecute = false;
17 | process.StartInfo.RedirectStandardInput = true;
18 | process.StartInfo.RedirectStandardOutput = true;
19 | process.StartInfo.RedirectStandardError = true;
20 | process.StartInfo.CreateNoWindow = true;
21 |
22 | using (var outputWaitHandle = new AutoResetEvent(false))
23 | using (var errorWaitHandle = new AutoResetEvent(false))
24 | {
25 | process.OutputDataReceived += (sender, e) => {
26 | if (e.Data == null)
27 | {
28 | outputWaitHandle.Set();
29 | }
30 | else
31 | {
32 | outputMessageHandler?.Invoke(e.Data);
33 | }
34 | };
35 | process.ErrorDataReceived += (sender, e) =>
36 | {
37 | if (e.Data == null)
38 | {
39 | errorWaitHandle.Set();
40 | }
41 | else
42 | {
43 | errorMessageHandler?.Invoke(e.Data);
44 | }
45 | };
46 |
47 | process.Start();
48 | using (var writer = process.StandardInput)
49 | {
50 | if (writer.BaseStream.CanWrite)
51 | {
52 | writer.WriteLine(script);
53 | }
54 | }
55 |
56 | process.BeginOutputReadLine();
57 | process.BeginErrorReadLine();
58 |
59 | process.WaitForExit();
60 | return process.ExitCode == 0;
61 | }
62 | }
63 | }
64 |
65 | public static bool RunDotnet(string arguments, Action outputMessageHandler = null, Action errorMessageHandler = null)
66 | {
67 | var startInfo = new ProcessStartInfo
68 | {
69 | FileName = "dotnet",
70 | Arguments = arguments,
71 | RedirectStandardOutput = true,
72 | RedirectStandardError = true,
73 | UseShellExecute = false,
74 | CreateNoWindow = true
75 | };
76 |
77 | using (var process = new Process { StartInfo = startInfo })
78 | {
79 | using (var outputWaitHandle = new AutoResetEvent(false))
80 | using (var errorWaitHandle = new AutoResetEvent(false))
81 | {
82 | process.OutputDataReceived += (sender, e) => {
83 | if (e.Data == null)
84 | {
85 | outputWaitHandle.Set();
86 | }
87 | else
88 | {
89 | outputMessageHandler?.Invoke(e.Data + Environment.NewLine);
90 | }
91 | };
92 | process.ErrorDataReceived += (sender, e) =>
93 | {
94 | if (e.Data == null)
95 | {
96 | errorWaitHandle.Set();
97 | }
98 | else
99 | {
100 | errorMessageHandler?.Invoke(e.Data + Environment.NewLine);
101 | }
102 | };
103 |
104 | process.Start();
105 | process.BeginOutputReadLine();
106 | process.BeginErrorReadLine();
107 | process.WaitForExit();
108 | return process.ExitCode == 0;
109 | }
110 | }
111 | }
112 |
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/src/Util/DirectoryBuildUtil.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Xml;
5 | using CnSharp.VisualStudio.Extensions.Projects;
6 | using CnSharp.VisualStudio.Extensions.Util;
7 | using EnvDTE;
8 |
9 | namespace CnSharp.VisualStudio.NuPack.Util
10 | {
11 | public static class DirectoryBuildUtil
12 | {
13 | public static DirectoryBuildProps GetDirectoryBuildProps(this Solution solution)
14 | {
15 | var file = solution.GetDirectoryBuildPropsPath();
16 | return !File.Exists(file) ? null : new DirectoryBuildProps(file);
17 | }
18 |
19 | public static string GetDirectoryBuildPropsPath(this Solution solution)
20 | {
21 | return Path.Combine(Path.GetDirectoryName(solution.FullName), DirectoryBuildProps.FileName);
22 | }
23 | }
24 |
25 | public class DirectoryBuildProps : IPackageCommonMetadata
26 | {
27 | private readonly string _file;
28 |
29 | public DirectoryBuildProps()
30 | {
31 |
32 | }
33 |
34 | public DirectoryBuildProps(string file)
35 | {
36 | _file = file;
37 | if(!File.Exists(file)) throw new FileNotFoundException("not found",file);
38 | var doc = new XmlDocument();
39 | doc.Load(_file);
40 | var parent = doc.ChildNodes[0].ChildNodes[0];
41 | var props = GetType().GetProperties().ToList();
42 | foreach (XmlNode node in parent.ChildNodes)
43 | {
44 | var prop = props.Find(m => m.Name == node.Name);
45 | if (prop == null) continue;
46 | prop.SetValue(this,node.InnerXml,null);
47 | }
48 | }
49 |
50 | public void Save()
51 | {
52 | if (_file == null)
53 | return;
54 | SaveTo(_file);
55 | }
56 |
57 | public void SaveTo(string file)
58 | {
59 | var doc = new XmlDocument();
60 | doc.LoadXml(XmlTemplate);
61 | var tempNode = doc.CreateElement("temp");
62 | tempNode.InnerXml = XmlSerializerHelper.GetXmlStringFromObject(this);
63 | doc.ChildNodes[0].ChildNodes[0].InnerXml = tempNode.ChildNodes[0].InnerXml;
64 | doc.Save(file);
65 | }
66 |
67 | public IEnumerable GetValuedProperties()
68 | {
69 | var props = GetType().GetProperties().ToList();
70 | foreach (var prop in props)
71 | {
72 | var v = prop.GetValue(this);
73 | if (!string.IsNullOrWhiteSpace(v?.ToString()))
74 | yield return prop.Name;
75 | }
76 | }
77 |
78 | public const string FileName = "Directory.Build.props";
79 | private const string XmlTemplate = @"
80 |
81 |
82 | ";
83 |
84 | #region Implementation of IPackageCommonMetadata
85 |
86 | public string Version { get; set; }
87 | public string Copyright { get; set; }
88 | public string Product { get; set; }
89 | public string Company { get; set; }
90 | public string Trademark { get; set; }
91 | public string Authors { get; set; }
92 | public string Owners { get; set; }
93 |
94 | #endregion
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/src/Util/LicenseReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using Newtonsoft.Json;
5 |
6 | namespace CnSharp.VisualStudio.NuPack.Util
7 | {
8 |
9 | public class License
10 | {
11 | public string Reference { get; set; }
12 | public bool IsDeprecatedLicenseId { get; set; }
13 | public string DetailsUrl { get; set; }
14 | public int ReferenceNumber { get; set; }
15 | public string Name { get; set; }
16 | public string LicenseId { get; set; }
17 | public List SeeAlso { get; set; }
18 | public bool IsOsiApproved { get; set; }
19 | public bool? IsFsfLibre { get; set; }
20 | }
21 |
22 | public class LicenseList
23 | {
24 | public string LicenseListVersion { get; set; }
25 | public List Licenses { get; set; }
26 | }
27 |
28 | public class LicenseReader
29 | {
30 | public List ReadLicenses(string filePath)
31 | {
32 | var jsonContent = File.ReadAllText(filePath);
33 | var licenseList = JsonConvert.DeserializeObject(jsonContent);
34 | return licenseList.Licenses;
35 | }
36 |
37 | public static List ReadLicenses()
38 | {
39 | var assembly = typeof(LicenseReader).Assembly;
40 | var resourceName = "CnSharp.VisualStudio.NuPack.Resources.licenses.json";
41 |
42 | using (Stream stream = assembly.GetManifestResourceStream(resourceName))
43 | using (StreamReader reader = new StreamReader(stream))
44 | {
45 | var jsonContent = reader.ReadToEnd();
46 | var licenseList = JsonConvert.DeserializeObject(jsonContent);
47 | return licenseList.Licenses;
48 | }
49 | }
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/src/Util/NuGetConfigReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Xml;
6 |
7 | namespace CnSharp.VisualStudio.NuPack.Util
8 | {
9 | public class NuGetConfigReader
10 | {
11 | public const string ConfigFileName = "NuGet.config";
12 | private const string NuGet = "NuGet";
13 | private const string VsOfflinePackages = "Microsoft Visual Studio Offline Packages";
14 | private static readonly string NuGetConfigFileSubDir = Path.Combine(NuGet, ConfigFileName);
15 | private static readonly string AppDataDir = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData),
16 | NuGetConfigFileSubDir);
17 | private readonly string _solutionDirectory;
18 | private readonly string _projectDirectory;
19 |
20 | public NuGetConfigReader(string solutionDirectory = null, string projectDirectory = null)
21 | {
22 | _solutionDirectory = solutionDirectory;
23 | _projectDirectory = projectDirectory;
24 | }
25 |
26 |
27 | public List GetNuGetSources()
28 | {
29 | var sources = new List();
30 |
31 | // User-level config
32 | if (File.Exists(AppDataDir))
33 | {
34 | var userLevelSources = ReadConfigFile(AppDataDir);
35 | FilterSources(userLevelSources, sources);
36 | }
37 |
38 | // Solution-level config
39 | if (!string.IsNullOrEmpty(_solutionDirectory))
40 | {
41 | var solutionConfigPath = Path.Combine(_solutionDirectory, ConfigFileName);
42 | if (File.Exists(solutionConfigPath))
43 | {
44 | var solutionLevelSources = ReadConfigFile(solutionConfigPath);
45 | FilterSources(solutionLevelSources, sources);
46 | }
47 | }
48 |
49 | // Project-level config
50 | if (!string.IsNullOrEmpty(_projectDirectory))
51 | {
52 | var projectConfigPath = Path.Combine(_projectDirectory, ConfigFileName);
53 | if (File.Exists(projectConfigPath))
54 | {
55 | var projectLevelSources = ReadConfigFile(projectConfigPath);
56 | FilterSources(projectLevelSources, sources);
57 | }
58 | }
59 |
60 | // Machine-level config
61 | // var machineConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), NuGet);
62 | // if (Directory.Exists(machineConfigPath))
63 | // {
64 | //
65 | // }
66 | return sources;
67 | }
68 |
69 | private static void FilterSources(List subSources, List sources)
70 | {
71 | subSources.ForEach(s =>
72 | {
73 | if (s.Name != VsOfflinePackages && sources.All(x => x.Name != s.Name))
74 | {
75 | sources.Add(s);
76 | }
77 | });
78 | }
79 |
80 | public static List ReadConfigFile(string configFileName)
81 | {
82 | var sources = new List();
83 |
84 | if (!File.Exists(configFileName))
85 | {
86 | throw new FileNotFoundException($"The config file {configFileName} does not exist.");
87 | }
88 |
89 | var doc = new XmlDocument();
90 | doc.Load(configFileName);
91 |
92 | var packageSourcesNode = doc.SelectSingleNode("//configuration/packageSources");
93 | if (packageSourcesNode != null)
94 | {
95 | foreach (XmlNode sourceNode in packageSourcesNode.ChildNodes)
96 | {
97 | if (sourceNode.NodeType == XmlNodeType.Element)
98 | {
99 | var source = new NuGetSource
100 | {
101 | Url = sourceNode.Attributes["value"]?.InnerText,
102 | Name = sourceNode.Attributes["key"]?.InnerText
103 | };
104 | sources.Add(source);
105 | }
106 | }
107 | }
108 |
109 | return sources;
110 | }
111 | }
112 |
113 | public class NuGetSource
114 | {
115 | public string Url { get; set; }
116 | public string Name { get; set; }
117 | }
118 |
119 | }
120 |
--------------------------------------------------------------------------------
/src/Util/Validation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Reflection;
4 | using System.Windows.Forms;
5 |
6 | namespace CnSharp.VisualStudio.NuPack.Util
7 | {
8 | public class Validation
9 | {
10 | public static bool HasValidationErrors(Control.ControlCollection controls)
11 | {
12 | bool hasError = false;
13 |
14 | // Now we need to loop through the controls and deterime if any of them have errors
15 | foreach (Control control in controls)
16 | {
17 | // check the control and see what it returns
18 | bool validControl = IsValid(control);
19 | // If it's not valid then set the flag and keep going. We want to get through all
20 | // the validators so they will display on the screen if errorProviders were used.
21 | if (!validControl)
22 | hasError = true;
23 |
24 | // If its a container control then it may have children that need to be checked
25 | if (control.HasChildren)
26 | {
27 | if (HasValidationErrors(control.Controls))
28 | hasError = true;
29 | }
30 | }
31 | return hasError;
32 | }
33 |
34 | // Here, let's determine if the control has a validating method attached to it
35 | // and if it does, let's execute it and return the result
36 | private static bool IsValid(object eventSource)
37 | {
38 | string name = "EventValidating";
39 |
40 | Type targetType = eventSource.GetType();
41 |
42 | do
43 | {
44 | FieldInfo[] fields = targetType.GetFields(
45 | BindingFlags.Static |
46 | BindingFlags.Instance |
47 | BindingFlags.NonPublic);
48 |
49 | foreach (FieldInfo field in fields)
50 | {
51 | if (field.Name == name)
52 | {
53 | EventHandlerList eventHandlers = ((EventHandlerList)(eventSource.GetType().GetProperty("Events",
54 | (BindingFlags.FlattenHierarchy |
55 | (BindingFlags.NonPublic | BindingFlags.Instance))).GetValue(eventSource, null)));
56 |
57 | Delegate d = eventHandlers[field.GetValue(eventSource)];
58 |
59 | if (d != null)
60 | {
61 | Delegate[] subscribers = d.GetInvocationList();
62 |
63 | // ok we found the validation event, let's get the event method and call it
64 | foreach (Delegate d1 in subscribers)
65 | {
66 | // create the parameters
67 | object sender = eventSource;
68 | CancelEventArgs eventArgs = new CancelEventArgs();
69 | eventArgs.Cancel = false;
70 | object[] parameters = new object[2];
71 | parameters[0] = sender;
72 | parameters[1] = eventArgs;
73 | // call the method
74 | d1.DynamicInvoke(parameters);
75 | // if the validation failed we need to return that failure
76 | return !eventArgs.Cancel;
77 | }
78 | }
79 | }
80 | }
81 |
82 | targetType = targetType.BaseType;
83 |
84 | } while (targetType != null);
85 |
86 | return true;
87 | }
88 |
89 | }
90 | }
--------------------------------------------------------------------------------
/src/Util/VersionUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.RegularExpressions;
3 |
4 | namespace CnSharp.VisualStudio.NuPack.Util
5 | {
6 | public static class VersionUtil
7 | {
8 | public static string GetCurrentBuildVersionString(this Version baseVersion)
9 | {
10 | DateTime d = DateTime.Now;
11 | return new Version(baseVersion.Major, baseVersion.Minor,
12 | (DateTime.Today - new DateTime(2000, 1, 1)).Days,
13 | ((int)new TimeSpan(d.Hour, d.Minute, d.Second).TotalSeconds) / 2).ToString();
14 | }
15 |
16 | public static string GetWildCardVersionString(this Version version)
17 | {
18 | return $"{version.Major}.{version.Minor}.*";
19 | }
20 |
21 | public static bool IsAutoVersion(this string version)
22 | {
23 | return Regex.IsMatch(version, @"\d+\.\d+\.\d{4}\.\d{5}");
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Util/XmlTextFormatter.cs:
--------------------------------------------------------------------------------
1 | namespace CnSharp.VisualStudio.NuPack.Util
2 | {
3 | public class XmlTextFormatter
4 | {
5 | protected const string Blank = " ";
6 | protected const string Tab = " ";
7 | protected const string Enter = "
";
8 | protected const string NewLine = "
";
9 |
10 | protected static readonly string[] WhiteSpacesXmlCodes = {Blank, Tab, Enter, NewLine};
11 | protected static readonly string[] WhiteSpacesOriginalStrings = {" ", "\t", "\r", "\n"};
12 |
13 | public static string Encode(string text)
14 | {
15 | var i = 0;
16 | foreach (var s in WhiteSpacesOriginalStrings)
17 | {
18 | text = text.Replace(s, WhiteSpacesXmlCodes[i]);
19 | i ++;
20 | }
21 | return text;
22 | }
23 |
24 | public static string Decode(string text)
25 | {
26 | var i = 0;
27 | foreach (var s in WhiteSpacesXmlCodes)
28 | {
29 | text = text.Replace(s, WhiteSpacesOriginalStrings[i]);
30 | i++;
31 | }
32 | return text;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/release_notes.txt:
--------------------------------------------------------------------------------
1 | ### V17.0.3 2/17/2025
2 | * Fix a NullReferenceException bug when the project has no package info.
3 | [#33](https://github.com/cnsharp/NuPack/issues/33)
4 |
5 | ### V17.0.2 2/14/2025
6 | * Add install target for architecture arm64.
7 |
8 | ### V17.0 1/15/2025
9 | * Support VS2022
10 | * Remove features for classic projects.
11 |
12 | ### V3.0 4/18/2019
13 | * Support VS2019.
14 |
15 | ### V2.1.1 9/5/2018
16 | * A dependency bug fix.
17 |
18 | ### V2.1.0 7/30/2018
19 | * Add universal app platform (UAP) projects support.
20 |
21 | ### V2.0.6 6/1/2018
22 | * Support nuget source path with spaces.
23 | [#21](https://github.com/cnsharp/nupack/issues/21)
24 |
25 | ### V2.0.5 5/9/2018
26 | * Fix double slash bug in nuget push statement about .NET Standard/Core projects.
27 | [#19](https://github.com/cnsharp/nupack/issues/19)
28 |
29 | ### V2.0.4 5/9/2018
30 | * Fix double slash bug in nuget push statement.
31 | [#19](https://github.com/cnsharp/nupack/issues/19)
32 | * Derived from AsyncPackage instead of Package to improve performance.
33 |
34 | ### V2.0.3 5/7/2018
35 | * Refersh cache when adding/removing project
36 |
37 | ### V2.0.2 5/3/2018
38 | * Restrict project types to .csproj/.vbproj/.fsproj,in case of some other types may make extension crash.
39 | [#17](https://github.com/cnsharp/nupack/issues/17)
40 | * Fix the bug when Package Output directory is a network path.
41 | [#20](https://github.com/cnsharp/nupack/issues/20)
42 |
43 | ### V2.0.1 4/23/2018
44 | * Add auto increment version number feature.
45 |
46 | ### V2.0 4/21/2018
47 | * Add SDK-based project support by msbuild command.
48 | * Support CommonAssemblyInfo on classic projects.
49 | * Add Directory.Build.props to support common package info of SDK-based projects,like company/authors/etc.
50 |
51 | ### V1.6.3 1/11/2018
52 | * add -ForceEnglishOutput option
53 |
54 | ### V1.6.2 8/10/2017
55 | * Fix the bug of DevelopmentDependency property of Package.
56 | [#7](https://github.com/cnsharp/nupack/issues/7)
57 |
58 | ### V1.6.1 8/2/2017
59 | * NuGet V2 login support.
60 | [#5](https://github.com/cnsharp/nupack/issues/5)
61 |
62 | ### V1.6 7/22/2017
63 | [#1](https://github.com/cnsharp/nupack/issues/1)
64 | update CnSharp.VisualStudio.TFS package to 1.1.2 to include 'Microsoft.TeamFoundation.Common' dll.
65 | [#2](https://github.com/cnsharp/nupack/issues/2)
66 | support spaces in Nuget.exe path
67 | [#3](https://github.com/cnsharp/nupack/issues/3)
68 | support developmentDependency
69 |
70 | ### V1.5.1 6/22/2017
71 | * add -IncludeReferencedProjects option
72 |
73 | ### V1.5 3/9/2017
74 | * VS 2017 support.
75 |
76 | ### V1.4.4 11/10/2016
77 | * Fix a bug when sync version to other .nuspec file in the solution.
78 |
79 | ### V1.4.3 11/8/2016
80 | * Fix a bug of assembly info modification.
81 |
82 | ### V1.4.2 10/27/2016
83 | * Dependency merge bug fix.
84 |
85 | ### V1.4.1 10/20/2016
86 | * TFS check out bug fix(some .dll missed).
87 |
88 | ### V1.4 8/4/2016
89 | * Sync version to .nuspec file in solution projects which depend on it when a package's version has changed.
90 | * .nuspec merge bug fix when dependencies in multiple groups
91 | * Encode whitespaces in XML
92 |
93 | ### V1.3.2 7/26/2016
94 | * Add feature which supports to remember NuGet API key.
95 |
96 | ### V1.3.1 7/20/2016
97 | * Fix a bug of merge dependency in separated groups.
98 |
99 | ### V1.3 6/23/2016
100 | * Add VB project support.
101 |
102 | ### V1.2 6/4/2016
103 | * Improve deploy wizard.
104 | * Merge dependencies from packages.config automatically where .nuspec file created.
105 |
106 | ### V1.1.1 5/24/2016
107 | * Merge dependencies from packages.config into .nuspec automatically.
108 | * Improve replacement pattern for assemblyinfo.cs under multi language charset.
109 |
110 | ### V1.1 5/17/2016
111 | * Add nuspec dependency management.
112 | * Add NuGet.exe path and output directory settings.
113 | * Display NuGet command output message in Output Pane in VS.
114 | * Adjust context menu positions.
115 | * Some nuspec bug fixed.
116 | * Some assemblyinfo.cs replacement bug fixed.
117 |
118 | ### V1.0 3/13/2016
119 | * Initial version with basic features.
--------------------------------------------------------------------------------
/src/screenshots.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnsharp/NuPack/8b900ea1583d27fcd3d262fa3dea628e81335f84/src/screenshots.png
--------------------------------------------------------------------------------
/src/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NuPack 2022
6 | A wizard for building and deploying NuGet packages.
7 | http://www.cnsharp.com
8 | LICENSE.txt
9 | release_notes.txt
10 | Resources\logo.ico
11 | screenshots.png
12 | NuGet,NuPack,Package,Deploy
13 |
14 |
15 |
18 |
19 | amd64
20 |
21 |
22 | amd64
23 |
24 |
27 |
28 | arm64
29 |
30 |
31 | arm64
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------