-
Notifications
You must be signed in to change notification settings - Fork 6k
Cannot run project after it is built, error with finding the file An exception of type 'System.IO.DirectoryNotFoundException' occurred in System.Xml.dll but was not handled in user code Additional information: Could not find file "IO.Swagger.xml" #2914
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
Comments
I'll have to check this out. I've downloaded the server generator code from editor.swagger.io in the same way mentioned above and run it successfully, but it's been a couple months. I don't know what's changed in that time. What version of .NET Core are you running? Is Visual Studio not using RC1-final which is required by the project? |
By default it looks like its using "1.0.l-rc1-final". I figured out what is happening and was able to correct it to a degree, by default line 69 in the Startup.cs has the xmlComments variable set to "C:\Users\Desktop\Project\aspnet5-server\src\artifacts\Debug\dnx451\IO.Swagger.xml", which doesn't exist. I found the xml I thought it would need in the artifact directory "C:\Users\Desktop\Project\aspnet5-server\src\artifacts\bin\Project\Debug\dnxcore50\IO.Swagger.xml". If I hard code that value in line 69 or set the xmlComments to that it works fine (service starts up without an error and shows the Swagger UI Page). Could be the update 2 of VS 2015 doesn't write out the file to the appropriate place (or it's changing as they finalize .NET Core)? I went a bit further and fixed the code so it works, also fixed a potential bug where this would fail if you changed the project folder from Swagger.IO to something else (which is what I did), here is the code (starting at line 35):
I'm worried a bit about deployment, not sure if the deployed code would work with the same directory structure. Also not sure if that will be the "final" way to identify the project name. Heard through the grapevine that the project.json was being deprecated to some degree and there will be a new project file (VS generated the following file for me when I saved it: Project.xproj). |
I've tested this with the same project pulled from editor.swagger.io. It seems the only piece that's missing for this to run as expected in Visual Studio 2015 is to run
From the downloaded content's root after building in Visual Studio. I didn't have issues with building the project as-is downloaded from the site (right-clicked project, did build). I also didn't have to change project properties, although it seems the properties you've changed result the same artifacts being output as the command above. I think the bug here is actually that the server generator stub doesn't include a README listing the steps to compile or a batch file to compile directly under Windows. For reference until I add these changes, the steps are available in the shell script:
However, and I'm not sure why there's a difference, the third step is One thing I notice in your screenshot is the run configuration shows IIS Express. That will fail, you need to drop that down to Thanks for posting the .xproj contents. The project.json based projects will actually be converted to .csproj after the next release candidate, so I'm going to wait until that version is out to update the generator from rc1-final and include the project file. If I remember correctly the xproj file isn't supported by Visual Studio Code or Xamarin on Mac, and the intention of the generator is to be cross platform.
|
It actually looks like "the next release candidate" is 1.0 RTM. I will update everything for that after it is released later this month. |
Per https://blogs.msdn.microsoft.com/webdev/2016/06/27/announcing-asp-net-core-1-0/, the RTM release didn't contain the .csproj/.sln changes:
I'll work on any interim changes. |
I'm working on updating the aspnet5 generator to ASP.NET Core 1.0.0-preview2. This will change a bit because This is what
I didn't test this change in the previous version, but I thought I'd share here while I'm working on this. |
Description
I've created a .NET MVC Project using Swagger Editor using "PetStore on Heroku" example. The zip file downloads fine and after I extract that I'm able to build the project. When I try to run it I get the following error:
An exception of type 'System.IO.DirectoryNotFoundException' occurred in System.Xml.dll but was not handled in user code
Additional information: Could not find a part of the path 'C:\Users[user]\Desktop\pet-store-api\src\artifacts\Debug\dnx451\IO.Swagger.xml'.
Swagger-codegen version
I'm using the public editor: http://editor.swagger.io/
Swagger declaration file content or url
Command line used for generation
Steps to reproduce
This is in Visual Studio 2015 Update 2
Related issues
Suggest a Fix
Seems like the IO.Swagger.xml is not being generated, pre-AspNet5 there was a property on the project that would create that file, seems like it's not being generated now, if it was generated that should fix the issue.
The text was updated successfully, but these errors were encountered: