Swagger-codegen: error building Pet Store example for .NET Core

血红的双手。 提交于 2019-12-12 04:55:29

问题


I am trying out swagger-codegen to generate the Pet Store example for .NET Core. When I try to build the project, I see this error:

/home/username/test/src/IO.Swagger/IO.Swagger.xproj(7,5): error MSB4019:
The imported project "/usr/share/dotnet/sdk/1.0.4/Microsoft/VisualStudio/v14.0/
DotNet/Microsoft.DotNet.Props"
was not found. Confirm that the path in the <Import> declaration is correct,
and that the file exists on disk.

The exact steps I ran were:

$ java -jar swagger-codegen-cli.jar generate -i 
     http://petstore.swagger.io/v2/swagger.json -l aspnetcore -o test/
$ cd test/
$ chmod +x build.sh
$ ./build.sh

Versions:

$ dotnet --version
1.0.4
$ java -jar swagger-codegen-cli.jar version
2.2.3

It looks like the generated .NET core project is not compatible with the version of .NET core I am using. How can I easily update the generated project so it works?


回答1:


I found an answer after reading this: https://docs.microsoft.com/en-us/dotnet/core/migration/#dotnet-migrate

The answer is to run dotnet migrate in the directory containing the .xproj. This creates a .csproj which can be built without errors.



来源:https://stackoverflow.com/questions/45589890/swagger-codegen-error-building-pet-store-example-for-net-core

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!