I am trying to make my Web API work with Google Protobuff and I tried to follow the instructions in Github but I cannot find the way how to compile protobuff file so it will create c# files for my project. Can someone please tell me instructions in order to do that.
Thank you all in advance.
Assuming that by "protobuff file" you mean a .proto file, the tool you're looking for is protoc, and it ships in the release.
Alternatively, both protoc and protogen are available for online usage at https://protogen.marcgravell.com - protogen is protobuf-net's equivalent tooling, for an independent re-implementation.
There may also be MSBuild/CLI tools available separately via a protobuf nuget package, I'm not sure.
Related
I am trying to play around with the ANTLR4 grammars for MySQL to do some basic statement parsing. This is my first time using ANTLR. I created a blank C# console project in VS2017, installed the ANTLR4, ANTLR4.CodeGenerator and Antlr4.Runtime nuget packages as well as the ANTLR Language Support extension. I added in the MySQLLexer.g4, MySQLParser.g4 and the predefined.tokens file. When I try to build the solution I get the following error:
The type or namespace name 'MySQLBaseLexer' could not be found (are you missing a using directive or an assembly reference?"
I have been looking through the tutorials, SO, and other blogs that discuss using ANTLR4 on C# but nothing seems to resolve the errors. Could anyone point me in the right direction to get this working correctly?
Thanks!
I assume you are using the two grammar files located here. While those grammars may not contain C++ code, it requires the base class you mention which is C++ code, so you will need to port MySQLBaseLexer.cpp and auxiliary code to C#, which is found in the Git repo. The readme in the ANTLR4 grammar directory contains a few more details about this requirement.
Also, why don't you try using Visual Studio 2019, the official Java Antlr Tool 4.7.2 (which requires Java), and my Net Core template for generating an Antlr C# program? Everything is integrated into a build and run F5. Check out this and this. The C# tool is at least two years behind the official release of Antlr. Further, the *.tokens is a generated file.
I don't understand why people keep checking in Antlr-generated files into a repo. It should not be checked in and used, especially if you use my template. The .g4 files are your source. If you need an extension for editing Antlr grammars in VS, you might want to check out my AntlrVSIX extension.
I was interested on this topic once I saw this topic, but went on vacations recently and I could finish the sample.
Here is a sample:
https://github.com/hmadrigal/playground-dotnet/tree/master/MsDotNetCore.MySqlParser
I created where the grammar provided by workbench (https://github.com/mysql/mysql-workbench/tree/8.0/library/parsers/grammars) has been adapted to work on .NET Core (using .NET standard for portability)
I created this sample project, it is not meant for production, and I am not an ANTLR expert, but I love coding and parsers.
Take a look at README.md and https://github.com/hmadrigal/playground-dotnet/blob/master/MsDotNetCore.MySqlParser/MySqlParser.TerminalApp/MySqlParserTester.cs could be your bootstrap. If I ever get to write a blog post I'll share the notes in here.
I am attempting to compile a C# library for GoogleCloudSpeechToTextv1p1beta1 from a .proto file here. The protobuf compiler works, except that it is missing dependencies from the googleapis/google/protobuf directory. All of the other import files that it depends on exist, here.
My question is this: Why is the protobuf directory missing from the googleapis/google directory? Is it a library that I need to compile/assemble personally? Or is it something Google should be providing and it's just missing?
The google/protobuf directory is shipped with the Google.Protobuf.Tools package, under tools (so there's tools/google/protobuf/any.proto for example). Alternatively, the same files are within the protobuf GitHub repo (under src - the protos are mixed with the C++ code).
So you should include the tools directory as a "root" in the protoc call if you need to... but in this particular case, there's already a NuGet package of Google.Cloud.Speech.V1P1Beta1 so I'd suggest you use that instead :) (There are even docs available if you know to extrapolate the URL scheme from other APIs. It's not really advertised as such.)
I've decided to use RoundhousE for my database. Now there are three ways to use this tool. With MSBuild, a DLL File or the console application. I found some documentations how to use the MSBuild variant and I know how to use the console application but I can not find anything how to use the DLL in Visual Studio and how to call/configure RoundhousE this way.
Does someone know where to find a detailled documentation or could someone explain me this?
The DLL is used in a few places, like with DropkicK - it may not be a bad idea to explore how it uses it, as there is not much documentation with this otherwise. You can also review how Roundhouse RefreshDatabase uses it as well.
DropkicK - https://github.com/chucknorris/dropkick/blob/master/product/dropkick/Tasks/RoundhousE/RoundhousEClientApi.cs
RoundhousE-EntityFramework RefreshDatabase - https://github.com/chucknorris/roundhouse-entityframework
HTH
I use a production library (namely itextsharp) in my project, this library doesn't ship with intellisense documentation.
I'd like to build (partial) documentation project.
Is this possible without access to the source code?
I think that intellisense data for external libraries are defined in a xml file which should ship alongside the said library. It should also have the same named but an xml extension instead of dll.
There are a bunch of xml tags that Intellisense will expect which are documented on msdn. Also some open source libraries come with such documentation, like Unity for instance, which will give you a "working" example of such a xml file. You can find an example here on github
Me: I'm a relative new-comer to the .NET platform.
Problem
In Java, you can add package level documentation to your project by creating a package-info.java or package.html file and storing in the package folder. How do I add equivalent documentation to my project in C# using Visual Studio 2010?
Background
I like to write documentation describing my motivations in the package/folder level context of the source code projects that I am working on. I have become very accustomed to this workflow in a variety of languages (specifically Java) and I believe that it is a good way to document my project.
C# will automatically turn the XML-based tripple-slash comments into intellisense documentation.
///<summary>This method does something!</summary>
///<parameter name="p1">The first parameter</parameter>
///<return>true, if the method completed successfully</return>
public bool DoSomething(int p1){
return p1 > 0;
}
When you compile your project into a class library and reference it in another project, the above will automatically be turned into a useful tooltip. In addition, the C# compiler can optionally produce an XML file with all of these comments alongside your DLL. This XML file can be fed into Sandcastle (as mentioned previously) and added to a documentation project as MSDN-style API reference.
The Sandcastle tool has its own project and documentation structure, so you'll want to start up a side project if you're going to add anything more than the XML-generated Intellisense reference.
The focus is a bit different in .NET, it has very good support for generating IntelliSense info. Documentation at your finger tips. I'm sure you're familiar with it when you used VS for a while, look up "xml documentation".
Off-line docs used to be covered by NDoc but the guy that supported it quit his project. The Sandcastle project took up the slack. Seems to be a bit laggy too these days btw.