Skip to content

Commit

Permalink
Merge pull request #10361 from swagger-api/issue-8334
Browse files Browse the repository at this point in the history
added to option to write csproj file in output code for csharpDorNet2…
  • Loading branch information
HugoMario committed Jul 3, 2020
2 parents 62b4aa2 + 4fff441 commit c30a364
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

public class CsharpDotNet2ClientCodegen extends AbstractCSharpCodegen {
public static final String CLIENT_PACKAGE = "clientPackage";
public static final String USE_CSPROJ_FILE = "useCsProjFile";
protected String clientPackage = "IO.Swagger.Client";
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
Expand Down Expand Up @@ -68,6 +69,9 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor", "packages.config"));
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
if (additionalProperties.containsKey(USE_CSPROJ_FILE) && Boolean.parseBoolean(additionalProperties.get(USE_CSPROJ_FILE).toString())) {
supportingFiles.add(new SupportingFile("csproj.mustache", "", clientPackage + ".csproj"));
}

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>{{clientPackage}}</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<!-- Nuget Package Metadata -->
<PackageId>{{packageName}}</PackageId>
<PackageVersion>{{packageVersion}}</PackageVersion>
<Authors>{{packageAuthors}}</Authors>
<Owners>{{packageCompany}}</Owners>
<Title>{{packageTitle}}</Title>
<Description>{{packageDescription}}</Description>
<Copyright>{{packageCopyright}}</Copyright>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="RestSharp" Version="105.0.1" />
</ItemGroup>
</Project>

0 comments on commit c30a364

Please sign in to comment.