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

Issue with VB.NET #85

Closed
guidoffm opened this issue Sep 19, 2014 · 5 comments
Closed

Issue with VB.NET #85

guidoffm opened this issue Sep 19, 2014 · 5 comments

Comments

@guidoffm
Copy link

The package can be installe within a VB.NET project and it inserts a C# file which does not work at all.

@domaindrivendev
Copy link
Owner

The C# file is just simple bootstrapping code to get you started. Alternatively, you can just install the "Core" package (which doesn't insert any additional code) ...

Install-Package Swashbuckle.Core

And manually add the following line, or rather it's VB.Net equivalent, somewhere during app startup

Swashbuckle.Bootstrapper.Init(GlobalConfiguration.Configuration)

Granted, it would be ideal if the full "Swashbuckle" package detected the language on install and inserted a VB version of SwaggerConfig but it's just not a use-case that has come up before now.

I'm not very familiar with VB.NET ... would you be interested in submitting this as a pull request?

@domaindrivendev
Copy link
Owner

Closing due to inactivity - only so many hours in the day!

Will gladly accept through a PR though ...

@jbencina
Copy link

jbencina commented Mar 7, 2015

If anyone comes across this on Google for help with VB.NET.

  1. Create a SwaggerConfig.vb class file in the App_Start of your Web API project
  2. Modify the file as such
Imports System.Web.Http
Imports WebActivatorEx
Imports Swashbuckle.Application
<Assembly: PreApplicationStartMethod(GetType(SwaggerConfig), "Register")> 

Public Class SwaggerConfig
    Public Shared Sub Register()
        Dim thisAssembly = GetType(SwaggerConfig).Assembly

        GlobalConfiguration.Configuration.EnableSwagger(Function(c) c.SingleApiVersion("v1", "Your API Name")).EnableSwaggerUi()
    End Sub

End Class

This is the bare minimum. You can follow the annotations in the SwaggerConfig.cs file as well as the readme for any additional options you may want to configure.

@ghost
Copy link

ghost commented Aug 3, 2015

I've added that file to my project, however I am getting this error:

Method not found: 'Swashbuckle.Application.SwaggerEnabledConfiguration Swashbuckle.Application.HttpConfigurationExtensions.EnableSwagger(System.Web.Http.HttpConfiguration, System.Action`1<Swashbuckle.Application.SwaggerDocsConfig>)'.

I'm referencing this this library version: Swashbuckle.Core.5.0.0\lib\net40\Swashbuckle.Core.dll

Update This was caused by a version mismatch of the System.Web.Http assembly referenced by my project and the Swashbuckle library.

@vbjay
Copy link

vbjay commented Aug 2, 2016

Please just detect language and place this file renamed to .vb in project instead of the cs file.
SwaggerConfig.txt

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

No branches or pull requests

4 participants