Skip to content
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

.SLN File not generating properly for aspnetcore scenarios due to intermediary "src" folder #7614

Closed
Norinha2015 opened this issue Feb 7, 2018 · 4 comments

Comments

@Norinha2015
Copy link

Description

Upon generating the Server Side Code, the project is unable to load in VS2017, claiming an unspecified error.

Swagger-codegen version

2.3.1

Swagger declaration file content or url

PetStore Example available from the Swagger.IO

Command line used for generation

java -jar .\swagger-codegen-cli-2.3.1.jar generate -i .\PetStore.yaml -l aspnetcore -o .
Power Shell 5, Latest version of Java

Steps to reproduce

Simply run the above command, and attempt to open in Visual Studio 2017.

Related issues/PRs

None that I could find.

Suggest a fix/enhancement

Removing / Re-Adding the CSProj File via the CLI resolves the issue:

dotnet sln IO.Swagger.sln remove .\src\IO.Swagger\IO.Swagger.csproj
dotnet sln IO.Swagger.sln add .\src\IO.Swagger\IO.Swagger.csproj

This results in a .sln file that is materially different, in that it has a reference to a project called "src" which is the default folder the code objects get generated to.

Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{05A3DB7A-04CC-4CAB-A6E6-1C680BC0D6F2}"

Ultimately it appears as if the presence of that folder is tripping up visual studio's IDE. The project will build and run via CLI, this is purely is a Visual Studio Issue.

@vfarah-if
Copy link

The problem seems to be related to the missing postSolution section in the solution. If you add this at the end it may fix the code generator

GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9F02DA37-DF0F-4909-8510-328578FBE3A0}
EndGlobalSection

@eeskildsen
Copy link

eeskildsen commented Jan 9, 2019

Reposting my comment from #7945:

The generated project path is missing backslashes. Looks like this is the case for csharp too.

Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IO.Swagger", "srcIO.SwaggerIO.Swagger.csproj", "{C90F1986-9E16-4F6B-86EE-9E22593A9ED9}"

I'm guessing this has to do with how Mustache handles backslashes?

@stunney
Copy link
Contributor

stunney commented Apr 9, 2020

Same issue occurs in VS 2019 (16.4.5) as well. Can also remove and re-add the csproj from within Visual Studio and it loads just fine the second time.

@HugoMario
Copy link
Contributor

fixed by #10478

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

No branches or pull requests

5 participants