Using docfx.console fails to generate documentation - visual-studio

I installed docfx.console through the nuget package manager (visual studios 2017 15.7.3) into a test project. My project is a .net library with a singular class with a bit of xml documentation. When I build the project it creates a _site file with a .html file but no documentation. It also generates an api, apidoc and articles folder and a docfx.json file.
The project throws the warning: Unable to find either toc.yml or toc.md inside obj/api/. Make sure the file is included in config file docfx.json!
I found a few similar issues in github which advised setting my visual studio version to 2015, however this solution doesn't appear to work with docfx.console as far as I can tell. Does anyone know how I might be able to correct this issue? Thank you

I also stumbled upon this issue when I was documenting an existing VB.net solution. Without knowing what your docfx.json file looks like or whether your .NET library is written in C# or VB.net, I can only provide a answer that fixed my issue and maybe will help with yours.
For me when installing docfx via nuget, the docfx.json file is set to be used with C# projects and not VB.Net projects by default.
I easily fixed this by modifying the docfx.json file and changing the metadata file source extension to search for *.vbproj:
"metadata": [
{
"src": [
{
"files": [
"*.vbproj"
],
"cwd": ".",
"exclude": [
"**/obj/**",
"**/bin/**",
"_site/**"
]
}
],
"dest": "obj/api"
}],

Related

SFML for MinGW VS code

I am attempting to use SFML for my next project, however I have yet to find reliable information on how to install SFML for MinGW, the page on the main SFML website is for using code::blocks, and I would prefer to keep using VS Code if I could. Additionally all of the tutorials for visual studio are for older versions where the UI is much different. I was hoping that someone who has installed it could guide me through the steps they used to install it. Thanks.
I am on Windows.
Just to be clear, I have never used Visual Studio Code, but it supports Nuget Package Manager, so it should work the same as in the 'normal' Visual Studio. So after creating new project:
Your should be getting/installing Nuget Package Manager from here.
Then according to answers to this question, you should be able to Press Ctrl+P or Ctrl+Shift+P and search for SFML packages, and choose version 2.5.1.
There are five modules: Audio, Graphics, Network, System and Window, choose what you need or install all five.
As I said at the begining, I do not have a way to test it, but it should work.
This question is fairly old at this point but for anyone in the future wondering how I solved it, I ended up switching compilers to Clang and creating a .bat file the just runs clang++ and links the SFML lib directory. (SFML GCC-64 worked fine with Clang)
To fix any errors in VS Code, you can add SFML to the workspace config
in .vscode/c_cpp_properties.json:
add or edit a field called "configurations" (should be an array), and add the following:
"configurations": [
{
"name": "SFML",
"intelliSenseMode": "clang-x64",
"includePath": ["${defaultInclude}", "C:/libs/SFML/GCC-64-Bit/SFML-2.5.1/include"],
"compilerPath": "C:/msys64/mingw64/bin/clang++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"browse": {
"path": ["${workspaceFolder}"],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
]
You'll have to change some of the paths to fit your setup, and you could very well put this in your global C++ configuration.
Finally, make sure that the needed DLLs are copied to your compilation output directory

XERCES XML parser

I am relatively new to programming and have been tasked with writing an xml parser using Xerces. My project is in c++ on Microsoft Visual Studio 2015. Are there any good examples for Xerces being used on Windows? I have looked through Apache and it is horrible and has been talked down on by all my coworkers. Most of the help I've found has been for Linux command line or overly complicated examples for specific use cases. Is there anywhere to find a simple example of xerces being used to parse a simple, known xml file? Thank you for any and all help as it is much appreciated!
The official Xerces documentation provides a lot of examples using both DOM and SAX parsing technique. You can find it here: https://xerces.apache.org/xerces-c/samples-3.html.
In order to build the examples and use them as direct references for your code, you have to follow the build instructions in https://xerces.apache.org/xerces-c/build-3.html.
For my personal requirements I created a VS 2013 solution for both Xerces library generation and samples compilation. The command to invoke for generation of the VS solution should for you be something simliar like
cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=D:\libs \path\to\xerces-c\source
where you can set the destination path of the output files via CMAKE_INSTALL_PREFIX , while \path\to\xerces-c\source should be the top level directory of the Xerces download, where the CMakeLists.txt file is located. Naturally you will need to install cmake on your Windows computer, which can be downloaded here: https://cmake.org/download/
Finally in order to start the examples, just use the generated VS solution or open a command prompt and start the desired program. For example use the "DOMPrint" application by calling .\DOMPrint.exe xxx.xml. The location of the binaries is in ${CMAKE_INSTALL_PREFIX}/bin.
Please be aware that you will have to compile or provide the Xerces .dll files to be able to start any programm related with the library. It also can be built using the generated VS solution out of cmake.
Please don't hesitate to ask further questions, if the issue is still up-to-date!

Suppress TypeScript errors in Visual Studio 2015

Is it possible to suppress errors in Visual Studio (when working with TypeScript)?
Specifically I'd like to suppress the is declared but never used-error. When debugging I need to comment out some code every once in a while, but Visual Studio refuses to build the project if I have declared a function I'm not using.
Why is that an error to begin with? Shouldn't it be a warning?
You should use a tsconfig.json file, more information here:
http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
It might take some time to get it configured the way you have your project configured now, but there is a setting to not error when there are unused locals:
{
"compilerOptions": {
"noUnusedLocals": false
}
}
There are also a couple other settings, noUnusedParameters, allowUnsedLabels and allowUnreachableCode which may help you.
The schema for the JSON file is available here: http://json.schemastore.org/tsconfig
Visual Studio should know that the JSON file is a tsconfig file and provide you with IntelliSense information from that schema file.
If using a csproj -file, you can get rid of the is declared but never used -error by removing the line
<TypeScriptNoUnusedLocals>True</TypeScriptNoUnusedLocals>
or changing it to
<TypeScriptNoUnusedLocals>False</TypeScriptNoUnusedLocals>
Some other settings for suppressing errors:
<TypeScriptAllowUnreachableCode>True</TypeScriptAllowUnreachableCode>
<TypeScriptNoUnusedParameters>False</TypeScriptNoUnusedParameters>
<TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>

Build problems with SQLite3 on VS2010

I try to build SQLite v3 from source using VS2010 and run into problems which I do not know how to tackle.
This is what I have:
VS2010 pro.
using sqlite-amalgamation-3160100.zip
Microsoft article: SQLite databases
This is what I did:
Created a C++ 'Win32 Console application'.
Disabled procompiled headers.
Added preprocessor definitions: (dont do this, this is the problem!)
_HAVE_SQLITE_CONFIG_H;SQLITE_OS_WINRT;SQLITE_API=__declspec(dllexport);
(as specified by 'SQLite databases' section 3.)
Created config.h (which is empty for the moment.)
Included the source files from sqlite-amalgamation-3160100.zip in the project.
build.
I get a number of compiler errors
1> sqlite3.c
1>e:\andre\ontwikkeling\sqlite\sqlite-amalgamation-3160100\sqlite3.c(38515): error C2065: 'MapViewOfFileFromApp' : undeclared identifier
1>e:\andre\ontwikkeling\sqlite\sqlite-amalgamation-3160100\sqlite3.c(38515): error C2099: initializer is not a constant
1>e:\andre\ontwikkeling\sqlite\sqlite-amalgamation-3160100\sqlite3.c(38524): error C2065: 'CreateFile2' : undeclared identifier
....
... which I try to solve.
The first one leads me to the following code snipped:
#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
{ "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 },
#else
{ "MapViewOfFileFromApp", (SYSCALL)0, 0 },
#endif
Now 'MapViewOfFileFromApp' leads to MapViewOfFileFromApp function, 'Maps a view of a file mapping into the address space of a calling Windows Store app.', a valid microsoft call for which my project setup is missing the correct configuration.
I could get a workaround for this one, but other errors are depending only on SQLITE_OS_WINRT and as such not possible to work around it.
It looks like that I'm missing some configuration options but I do not know which ones. I read all of the documented compile time options but can't find out what it is that I do wrong.
I tried to find a working exaple of a VS2010 solution but came up with nothing. And of cause I checked here for similar questions! (If there is one covering this then I missed it, sorry.)
Does anybody have a suggestion on what I'm missing? I'm running out of idea's.
* edit 6 jan 2017 *
On advice of MaxFurry I followed the steps of the blog by David Cravey which does exact the same steps as I did but without declaring SQLITE_OS_WINRT;SQLITE_API=__declspec(dllexport);. Leaving these two defines out solved the problem.
Aparently I misinterpreted the advice in the Microsoft article.
Compile time problems solved.
Kind regards.
Do you have your sqlite3.dll file already built? If so just create a folder in your visual studio folder. When u want to use sqlite3 just copy the dll file to the folder of the project in visual studio u want to use it also copy the following files there sqlit3.c, sqlite3.h. When this is done open the project in your visual studio IDE. Right click on the project name, add, add existing then click on the sqlite3.h and sqlite3.c. Let me know how it goes.

Using i18n with RequireJS in Visual Studio 2015 Cordova App project

I got a weird thing happening when I try to run the Windows application produced by the Cordova project in Visual Studio 2015.
The application uses the third-party libs i18n along with RequireJS to translate any text based on the language chosen by the user. The problem is that no text is loaded without any form of error or whatsoever. The same exact code works for Android and iOS builds just fine.
I went into debug to find out something weird, whatever language I submit will return the value undefined. Even weirder, if I require specifically the root file manually, it will load the english version of the file.
Any help would be appreciated.
Here's a sample project that mimics the exact problem.
CordovaTest.rar
The issue you're running into with Windows is its support of qualifiers in file names to support localization.
Resource qualifiers are folder and filename modifiers that identify
the context in which a particular version of a resource should be
used.
Contexts can include locales which is what you've run into here. Long story short, here's what it looks like is happening:
Your app's default language is set to "fr" right now
When the app starts on Windows, it sees that you're running as the "fr" local and it hides any folders qualified as targeting other locales. In this case, your app has an "en" folder that is seen as a qualifier for the English language, and Windows will hide the "en" folder contents.
It's really hard to explain the first time around, so let me know if you want clarification on the above and I can try to re-phrase it.
To fix your issue, you would want to use folder names that are not seen by Windows as qualifiers. For example, you could name your "en" folder and call it "English". Then, change your RequireJS bundle configuration to define the "english" locale:
define({
"root": {
"Test" : "TestFR"
},
"english":true
});
Now when you run your app, you'll see it working.

Resources