[csharp] Client nuspec (#4576)

* [csharp] Client nuspec

* [csharp] remove carriage returns from nuspec
This commit is contained in:
Jim Schubert 2017-01-16 21:59:31 -06:00 committed by wing328
parent 55443daebc
commit 4c7d1338dc
3 changed files with 60 additions and 0 deletions

View File

@ -312,6 +312,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
if (optionalProjectFileFlag) {
supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln"));
supportingFiles.add(new SupportingFile("Project.mustache", packageFolder, packageName + ".csproj"));
supportingFiles.add(new SupportingFile("nuspec.mustache", packageFolder, packageName + ".nuspec"));
if(Boolean.FALSE.equals(excludeTests)) {
// NOTE: This exists here rather than previous excludeTests block because the test project is considered an optional project file.

View File

@ -51,6 +51,20 @@ using {{packageName}}.{{apiPackage}};
using {{packageName}}.Client;
using {{packageName}}.{{modelPackage}};
```
<a name="packaging"></a>
## Packaging
A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages.
This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly:
```
nuget pack -Build -OutputDirectory out {{packageName}}.csproj
```
Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual.
<a name="getting-started"></a>
## Getting Started

View File

@ -0,0 +1,45 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- The identifier that must be unique within the hosting gallery -->
<id>$id$</id>
<title>{{packageTitle}}</title>
<!-- The package version number that is used when resolving dependencies -->
<version>$version$</version>
<!-- Authors contain text that appears directly on the gallery -->
<authors>$author$</authors>
<!-- Owners are typically nuget.org identities that allow gallery
users to earily find other packages by the same owners. -->
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<developmentDependency>false</developmentDependency>
<!-- The description can be used in package manager UI. Note that the
nuget.org gallery uses information you add in the portal. -->
<description>{{packageDescription}}</description>{{#termsOfService}}
<copyright>{{termsOfService}}</copyright>{{/termsOfService}}{{#licenseUrl}}
<licenseUrl>{{licenseUrl}}</licenseUrl>{{/licenseUrl}}
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>
<dependency id="NewtonSoft.Json" version="8.0.3" />
<dependency id="RestSharp" version="105.1.0" />{{#generatePropertyChanged}}
<dependency id="Fody" version="1.29.2" />
<dependency id="PropertyChanged.Fody" version="1.51.3" />{{/generatePropertyChanged}}
</dependencies>
</metadata>
<files>
<!-- A readme.txt will be displayed when the package is installed -->
<file src="..\..\README.md" target="" />
<file src="..\..\docs\**\*.*" target="docs" />{{#generatePropertyChanged}}
<file src="..\..\packages\Fody.1.29.2\build\portable-net+sl+win+wpa+wp\Fody.targets" target="build" />
{{/generatePropertyChanged}}
</files>
</package>