Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ public void processOpts() {
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.
Expand Down
14 changes: 14 additions & 0 deletions modules/swagger-codegen/src/main/resources/csharp/README.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
45 changes: 45 additions & 0 deletions modules/swagger-codegen/src/main/resources/csharp/nuspec.mustache
Original file line number Diff line number Diff line change
@@ -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>