{"id":22538443,"url":"https://github.com/shuttle/shuttle.nugetpackager","last_synced_at":"2025-03-28T06:43:34.762Z","repository":{"id":66349406,"uuid":"272952418","full_name":"Shuttle/Shuttle.NuGetPackager","owner":"Shuttle","description":"Visual Studio extension used to configure/build a C# class library as a NuGet package.","archived":false,"fork":false,"pushed_at":"2024-10-06T06:54:12.000Z","size":148,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T07:28:52.997Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shuttle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-17T11:07:31.000Z","updated_at":"2024-10-06T06:54:15.000Z","dependencies_parsed_at":"2024-12-07T11:12:12.418Z","dependency_job_id":"5ad2a45f-25fa-4b0d-ab00-47d0313841c0","html_url":"https://github.com/Shuttle/Shuttle.NuGetPackager","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuttle%2FShuttle.NuGetPackager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuttle%2FShuttle.NuGetPackager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuttle%2FShuttle.NuGetPackager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuttle%2FShuttle.NuGetPackager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shuttle","download_url":"https://codeload.github.com/Shuttle/Shuttle.NuGetPackager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245984556,"owners_count":20704794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-07T11:12:03.798Z","updated_at":"2025-03-28T06:43:34.745Z","avatar_url":"https://github.com/Shuttle.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shuttle.NuGetPackager\n\nThis VS2022+ extension is used to configure a C# class library project for NuGet packaging allowing you to manage the versioning package.\n\n***Note***: This extension should only be applied to Visual Studio files that are in the new SDK format.\n\n## Installation\n\nYou can download this extension from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Shuttle.NuGetPackager).\n\n## Usage\n\nBy accessing the context menu of a C# class library project you select `Configure NuGet Project` which will create a `.package` folder containing:\n\n- `package.msbuild`\n- `Shuttle.NuGetPackager.targets`\n- `Shuttle.NuGetPackager.MSBuild.dll`\n- `AssemblyInfo.cs.template`\n- `package.nuspec.template`\n- `package.nuspec`\n\nIn addition your projects's `.csproj` file will be updated to include a property `\u003cGenerateAssemblyInfo\u003efalse\u003c/GenerateAssemblyInfo\u003e` in order to make use of an ``AssemblyInfo.cs` file which is created from the `AssemblyInfo.cs.template`.\n\nYou explicitly set the version of your package using the `package.msbuild` file.  When you commit you changes that version will be commited and any CI automation can build the package using the configured version.\n\nIn order to effect any changes you should execute the `package.msbuild` with the relevant `target` the default being `Version`.  Each target is explained in the following sections.\n\n### Version\n\n```\nmsbuild package.msbuild [/t:Version] [/p:SemanticVersion=major.minor.patch[-prerelease[+buildmetadata]]]\n```\n\nYou will be prompted for the `SemanticVersion` if not specified.  This is parsed and produces the following output parameters:\n\n- `SemanticVersionCore`: `major.minor.patch`\n- `SemanticVersionPrerelease`: `prerelease`\n- `SemanticVersionBuildMetadata`: `buildmetadata`\n\nThese parameters are replacement values for tags in the `AssemblyInfo.cs.template` and `package.nuspec.template` files:\n\n| Tag | Property / Value |\n| --- | --- |\n| #{SemanticVersionCore}# | $(SemanticVersionCore) |\n| #{SemanticVersion}# | $(SemanticVersion) |\n| #{Year}# | $([System.DateTime]::Now.ToString(`yyyy`)) |\n\nThe `package.nuspec` file will also update `#{Dependencies}#` with all the dependencies located in the `.csproj` file.\n\nShould you require more control over the dependencies the following structure may be used:\n\n```\n\u003cdependencies\u003e\n\t\u003cdependency id=\"Shuttle.Core.Contract\" version=\"{Shuttle.Core.Contract-version}\" /\u003e\n\t\u003cdependency id=\"Shuttle.Core.Data\" version=\"{Shuttle.Core.Data-version}\" /\u003e\n\u003c/dependencies\u003e\n```\n\nAll `{PackageName-version}` tags will be replaced by the version referenced in the `.csproj` file.\n\n### Build\n\n```\nmsbuild package.msbuild [/t:build]\n```\n\nBuild both the `Debug` as well as the `Release` configurations of the project.\n\n### Pack (depends on Build)\n\n```\nmsbuild package.msbuild [/t:pack]\n```\n\nUses NuGet to `pack` the output using the `package.nuspec` file.  The `package.nuspec` file is generated by the `Version` target. \n\nThe created `{PackageName}.{SemanticVersion}.nupkg` file will be in the `.package\\release` folder.\n\n### Push\n\n```\nmsbuild package.msbuild [/t:push]\n```\n\nWill push the `.package\\release\\{PackageName}.{SemanticVersion}.nupkg` package to a provided `PackageSource` NuGet source.\n\nIf `PackageSource` is not provided the default `https://www.nuget.org` will be used.\n\n### Bump (depends on Version)\n\n```\nmsbuild package.msbuild [/t:bump] \n```\n\nWill set the semantic version, build the project, and copy the package file to `$(NuGetPackageSourceFolder)`.\n\nIf no `$(NuGetPackageSourceFolder)` property exists then the file isn't copied.  As per normal MSBuild functionality you can also define an environment variable called `NuGetPackageSourceFolder`.\n\nA useful workflow is to create a local package folder abd have the `NuGetPackageSourceFolder` environment variable point to that folder.  You then `bump` the package and test is locally.  Once you are happy with the package you can then commit the changes.\n\n### Flush\n\nRemoves the folder package (`%UserProfile%\\.nuget\\packages\\{PackageName}`) from the NuGet cache.\n\nThis is useful during development when you wish to stick on the same version and have your dependent project make use of the latest build.\n\n## Shuttle.NuGetPackager.MSBuild\n\nThis assembly contains the following MSBuild tasks:\n\n### Prompt\n\nPrompts the user for input that is saved in the given output parameter.\n\n| Parameter | Required | Description |\n| --- | --- | --- |\n| Text | yes | The text to display on the console. |\n| UserInput | output | The value entered on the console. |\n\n``` xml\n\u003cPrompt Text=\"Enter semantic version:\" Condition=\"$(SemanticVersion) == ''\"\u003e\n\t\u003cOutput TaskParameter=\"UserInput\" PropertyName=\"SemanticVersion\" /\u003e\n\u003c/Prompt\u003e\n```\n\n### RegexFindAndReplace\n\nPerforms a regular expression find/replace on the given files.\n\n| Parameter | Required | Description |\n| --- | --- | --- |\n| Files | yes | The files that the find/replace operation should be performed on. |\n| FindExpression | yes | The Regex that should be used to find the text to be replaced. |\n| ReplacementText | no | The text to replace the located expression with. |\n| IgnoreCase | no | Defaults to false. |\n| Multiline | no | Defaults to false. |\n| Singleline | no | Defaults to false. |\n\n``` xml\n\u003cRegexFindAndReplace Files=\"@(Files)\" FindExpression=\"regex\" ReplacementText=\"new-text\" /\u003e\n```\n\n### SetNuGetPackageVersions\n\nRetrieves the package names and version from the given package folder and replaces all tags with the relevant version number. A tag has to be in the format `{OpenTag}{PackageName}-version{CloseTag}`.\n\n| Parameter | Required | Description |\n| --- | --- | --- |\n| Files | yes | The files that contain package version tags. |\n| PackageFolder | yes | The folder that contains all the packages. |\n| OpenTag | no | Defaults to `{`. |\n| CloseTag | no | Defaults to `}`. |\n\n``` xml\n\u003cSetNuGetPackageVersions Files=\"@(Files)\" PackageFolder=\"nuget-package-folder\" /\u003e\n```\n\n### Zip\n\nCreates an archive that contains the given files.\n\n| Parameter | Required | Description |\n| --- | --- | --- |\n| Files | yes | The files that should be added to the zip archive. |\n| RelativeFolder | yes | The 'base' folder that the zip entries should be created from.  e.g. if there is a file `c:\\folder\\another\\file.txt` and the `RelativeFolder` is `c:\\folder\\` then the entry in the zip archive will be `another\\file.txt`.\t |\n| ZipFilePath | yes | The path to the zip archive that will be created.  Any existing file will be overwritten. |\n\n``` xml\n\u003cZip Files=\"@(Files)\" RelativeFolder=\"$(OutputPath)\" ZipFilePath=\"$(OutputPath).zip\" /\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuttle%2Fshuttle.nugetpackager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshuttle%2Fshuttle.nugetpackager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuttle%2Fshuttle.nugetpackager/lists"}