Skip to content

CSharp client: optionally build .csproj file #1941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 24, 2016

Conversation

jhancock93
Copy link
Contributor

Adds 2 parameters to csharp build options. One to control whether a project file is generated and another which can specify the Project Guid for the csproj.

Addresses open issue #1883.

@wing328
Copy link
Contributor

wing328 commented Jan 22, 2016

@jhancock93 thanks for the PR. It failed the generator test:

Failed tests: 
io.swagger.generator.online.OnlineGeneratorOptionsTest.getOptionsTest(io.swagger.generator.online.OnlineGeneratorOptionsTest)
  Run 1: PASS
  Run 2: PASS
  Run 3: PASS
  Run 4: OnlineGeneratorOptionsTest.getOptionsTest:176 Lists differ at element [8]: io.swagger.generator.online.OnlineGeneratorOptionsTest$CliOptionProxy@2788a29d != io.swagger.generator.online.OnlineGeneratorOptionsTest$CliOptionProxy@f71390f2 expected [io.swagger.generator.online.OnlineGeneratorOptionsTest$CliOptionProxy@2788a29d] but found [io.swagger.generator.online.OnlineGeneratorOptionsTest$CliOptionProxy@f71390f2]
  Run 5: PASS
  Run 6: PASS
  Run 7: PASS
  Run 8: PASS
  Run 9: PASS
  Run 10: PASS
  Run 11: PASS
  Run 12: PASS
  Run 13: PASS
  Run 14: PASS
  Run 15: PASS
  Run 16: PASS
  Run 17: PASS
  Run 18: PASS
  Run 19: PASS
  Run 20: PASS
  Run 21: PASS
  Run 22: PASS
  Run 23: PASS
  Run 24: PASS
  Run 25: PASS
  Run 26: PASS
  Run 27: PASS
  Run 28: PASS
  Run 29: PASS
  Run 30: PASS
  Run 31: PASS

To run the CI test locally, please execute mvn verify -P samples

Let us know if you need help fixing the issue.

@@ -62,4 +62,10 @@
public static final String OPTIONAL_ASSEMBLY_INFO = "optionalAssemblyInfo";
public static final String OPTIONAL_ASSEMBLY_INFO_DESC = "Generate AssemblyInfo.cs (Default: true).";

public static final String OPTIONAL_PROJECT_FILE = "optionalProjectFile";
public static final String OPTIONAL_PROJECT_FILE_DESC = "Generate {PackageName}.csproj (Default: true).";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a test and believe the default should be false, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, the default should be false. Initially I had it default to true but forgot to change the description. I can fix that.

@wing328
Copy link
Contributor

wing328 commented Jan 22, 2016

After setting optionalProjectFile=true when generating the C# petstore sample, I opened samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/IO.Swagger.Client.csproj but got the following error:

screen shot 2016-01-23 at 12 03 28 am

I'm using Xamarin Studio 5.10 and Mono 4.2.1.

Did you get similar error when opening the csproj file?

@jhancock93
Copy link
Contributor Author

No, I don't get the error you're seeing with the project file. I can open the .csproj file in VisualStudio with no errors. But I suppose we probably need a somewhat different template in Xamarin. I don't have Xamarin Studio myself, but I suspect the targets file or the TargetFrameworkVersion would be different with Xamarin.

@wing328
Copy link
Contributor

wing328 commented Jan 23, 2016

I've changed the following

    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>

to

    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

and that works for me in Xamarin Studio

Would that also work for you in Visual Studio? If yes, please update to use v4.5 instead.

@jhancock93
Copy link
Contributor Author

4.5 works for me. I've updated the branch with the code change to 4.5 and the correction on the default value in the option description.

@wing328
Copy link
Contributor

wing328 commented Jan 24, 2016

@jhancock93 thanks. PR merged

wing328 added a commit that referenced this pull request Jan 24, 2016
CSharp client: optionally build .csproj file
@wing328 wing328 merged commit 3086bb6 into swagger-api:master Jan 24, 2016
@jhancock93 jhancock93 deleted the projectfile2 branch January 24, 2016 05:18
@wing328
Copy link
Contributor

wing328 commented Feb 27, 2016

@jhancock93 if you don't mind, I wonder if you can contact me via my personal email address in my Github profile page as I've 2 simple questions about your use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants