I need to call a REST API from a Visual Basic .NET project (.NET Framework 3.5). They gave me an OpenAPI .yaml file. In the Swagger Editor I can't generate the client for Visual Basic, only for C#. I tried to export the JSON from the Swagger Editor and paste it as a class in Visual Studio, but the generated class seems to be incorrect and incomplete.
Is there a way to generate a Visual Basic .NET client from an OpenAPI definition?
Related
In .Net Framework 4.7.2 F#, I have been using:
FSharp.Data.TypeProviders
with
type WSDL = WsdlService<"http://...ServiceHost.svc">
type AV = WsdlService<"http://...ServiceHost.svc">
to access my local WCF network service from an F# .fs file.
How do I access the WCF service from F# client when .NET Core 3.1 is being used?
TIA
If not, what is the recommended upgrade path for WCF/petapoco/PostgreSQL?
That is an old type provider from F# 3.0, and it depended on svcutil for code generation. You could reference its nuget package but it's possible (likely) there is no support for the dotnet-svcutil tool. But you can use WCF from C#, so:
Add a new C# project to your solution
Add Connected Service in Visual Studio and configure your end point, this will generate the necessary code, build your project (and test that it works)
From your F# project, add reference to this C# project, and open ProjectName
Create your type, and use it from F#. You will get intellisense on the types so the user experience is not that different from the type provider.
If needed you can publish the self-contained exe:
dotnet publish -r win10-x64 -c Release -p:PublishSingleFile=true -p:PublishTrimmed=true
I'm not new to programming, but am new to Microsoft-centric technologies. In this case, I have downloaded Visual Studio 2019 Community edition and am trying to get some stuff working as a VBA Console application.
Here is the link the the Visual Basic Guide I am using as documentation:
https://opdhsblobprod02.blob.core.windows.net/contents/c6aea4f5457448ee818b7292ba695982/8f8c9552565899a6bd5ea3443dc48752?sv=2015-04-05&sr=b&sig=z6HVPKMrsWrYMl1xp9Pk34R040%2B8A71q3nmRLNTG6lk%3D&st=2019-10-18T21%3A16%3A48Z&se=2019-10-19T21%3A26%3A48Z&sp=r
On Page #1 of that guide is a section titled "Development with My". 'My' can have various pieces, depending on the project type. In this case, my project type is: Console Application (from VS, File -> New -> Project, select: Console App (.NET Core) )
On page 59 of that guide is a table that explicitly shows which different parts of 'My' would be available in different project types. For a Console App, all of My.User, My.Resources, My.Setting should be available (as well as some other things).
Yet within my VBA code, the editor implies that the only part of 'My' available is a My.InternalXmlHelper. (I guess that comes by default - I haven't done anything to explicitly try to add such a thing.)
Obviously, some piece of the puzzle is missing here that enables access to all this wonder 'My' functionality that is described. Anybody know what needs to be done here so that my VS environment knows about My.User (and other stuff)?
Thanks.
.NET Core is a different beast altogether, in addition to the other languages you seem to be mixing together.
Based on this link, VB My namespace support is not a part of core 3.0. I'm not sure if it's in earlier core versions, because I haven't been working with VB in Core.
A large part of what makes Visual Basic special is the Visual Basic Runtime. .NET Core 2 contains only the small part of Visual Basic Runtime that is defined in the Visual Basic Language Specification which was initially designed for interop with phones.
The major effort for Visual Basic 16.0 will be moving the Visual Basic Runtime to .NET Core 3.0 to provide expected features like Mid or the My namespace. This work will probably not be ready for the first preview of .NET Core 3.0 but will appear in a later preview.
I think the guide you are working with is for .NET Framework 4.x and earlier (Core is a different initiative that involves getting .NET to run on multiple Operating Systems, etc.). Try creating a new .NET Framework app. The templates will have (.NET Framework) in the name, e.g., ASP.NET Web Application (.NET Framework).
I need to use vbhtml files with editor support in a VB.NET ASP.NET Core project. I don't need Razor to do any thing with these files. Just want the editor support (currently, the editor supports the html part only, not vb code). Is there a reference or a Nuget that I include in the project to borrow vbhtml editor from ASP.NET 5 to ASP.NET Core?
I'm afraid this is not possible. The Razor version which is used by ASP.NET Core MVC does not support the Visual Basic language (e.g. .vbhtml files), only C# is supported.
Importing web service metadata ...
Number of service endpoints found: 2
Scaffolding service reference code ...
Error:Unable to generate deps.json, it may have been already generated. You can specify the "-d" option before the tool name for diagnostic output (for example, "dotnet -d <toolname>": C:\Program Files\dotnet\sdk\2.1.503\Sdks\Microsoft.NET.Sdk\targets\GenerateDeps\GenerateDeps.proj
Done.
Had the same issue recently in Visual Studio 2019 (16.8.4) with a .NET Standard 2.0 class library. I was able to use svcutil.exe from the command line to generate code from an existing Webservice (asmx). But with Visual Studio (Microsoft WCF Web Service Reference Provider) I got this error.
The funny thing for me was running Visual Studio as an administrator did the trick for me (I never expected that to be honest).
As I have seen there is a way through Xamarin and Visual Studio to develop cross platform applications in C#.
Is there a way to write cross platform applications with VB.net?
Is it possible Visual Studio 2017 to include this possibility?
Thank you!
You can use VB.net in a xamarin forms project. You have to use a vb.net PCL for the project. There is an article on the Xamarin site on how to do this.
https://developer.xamarin.com/guides/cross-platform/application_fundamentals/pcl/portable_visual_basic_net/xamarin-forms/
Please note there are a lot of limitations on this.
Custom Renderers cannot be written in Visual Basic, they must be written in C# in the native platform projects.
Dependency Service implementations cannot be written in Visual Basic, they must be written in C# in the native platform projects.
XAML pages cannot be included in the Visual Basic project - the code-behind generator can only build C#. It is possible to include XAML in a separate, referenced, C# portable class library and use databinding to populate the XAML files via Visual Basic models (an example of this is included in the sample).
Xamarin does not support the Visual Basic.NET language.