When attempting to use Docfx to document a C# project I am running into an issue that is probably down to myself being a moron. However I have read through the docfx examples and I have not seen any obvious ways of rectifying the issue.
When I run docfx init -q I get no errors. When I run docfx docfx.json --serve I also get no errors, upon completed I get a Build succeeded. 0 Warnings 0 Errors message however no html files are generated.
It also appears to be correctly reading the source files from my project as the api folder has yml files with the same names as the class files in the project.
How do I get docfx to generated the appropriate html files for the project. Full output of docfx docfx.json --serve is below:
[19-07-04 05:07:47.020]Info:[MetadataCommand.ExtractMetadata]Using msbuild C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin as inner compiler.
[19-07-04 05:07:47.302]Info:[MetadataCommand.ExtractMetadata]Loading projects...
[19-07-04 05:07:50.379]Info:[MetadataCommand.ExtractMetadata]'C:/Users/Devvy/Source/Repos/TestProj/TestProj.csproj,C:/Users/Devvy/Source/Repos/TestProj/Display_Output.cs,C:/Users/Devvy/Source/Repos/TestProjException.cs,C:/Users/Devvy/Source/Repos/TestProj_Core.cs,C:/Users/Devvy/Source/Repos/TestProj/Module_Info.cs,C:/Users/Devvy/Source/Repos/TestProj/Opcode_Assembler.cs,C:/Users/Devvy/Source/Repos/TestProj/Opcode_Disassembler.cs,C:/Users/Devvy/Source/Repos/TestProj/Pattern_Tools.cs,C:/Users/Devvy/Source/Repos/TestProj/Payloads.cs,C:/Users/Devvy/Source/Repos/TestProj/Process_Info.cs,C:/Users/Devvy/Source/Repos/TestProj/PtrRemover.cs,C:/Users/Devvy/Source/Repos/TestProj/RopChainGenerator32.cs,C:/Users/Devvy/Source/Repos/TestProj/RopChainGenerator64.cs,C:/Users/Devvy/Source/Repos/TestProj/Thread_Info.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472.AssemblyInfo.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472/TestProj.AssemblyInfo.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472_Lib.AssemblyInfo.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/net472/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Debug/netstandard2.0.AssemblyInfo.cs,C:/Users/Devvy/Source/Repos/TestProj/obj/Release/net472/TestProj.AssemblyInfo.cs' keep up-to-date since '7/4/2019 5:03:14 PM', cached result from 'C:/Users/Devvy/Source/Repos/TestProj/Documentation/api' is used.
[19-07-04 05:07:50.379]Info:[MetadataCommand]Completed Scope:MetadataCommand in 3384.2278 milliseconds.
[19-07-04 05:07:50.379]Info:Completed in 3389.2213 milliseconds
Build succeeded.
0 Warning(s)
0 Error(s)
Docfx provides static code documentation for us. If you want to static website of output with docfx correctly. You should follow these steps;
First you must install docfx. You have many way but I recommend install with choco
choco install docfx -y
then you must add your project docfx console package from NuGet
Install-Package docfx.console -Version 2.33.0
now open your project folder or whatever you want create a folder then run like that
docfx init
now best part of this answer you must config you'r project docfx.json file like this
after run
docfx --serve
Also I found a example project here
I think your problem about you're docfx file configuration.
Related
Im releasing a nuget package and I'd like that whoever is using it could step into it as if it was his own code.
In order to do that, in the RELEASE configuration (which is the one I use for distribution), I try set the "Debug Information:" to Embedded and Portable but none did the trick! When I install the package, the pub files are never there...
What am I doing wrong?
The answer from memory is:
Visual Studio has a config setting for a Symbol Server which must point to source code with the same pdb file produced with the compile used for creating the nuget package.
There are different ways to host the symbol server. The easiest is to simply clone the repo from same version the nuget package was created from. Compile that code to generate the pdb. Then point the symbol server config to the bin folder containing the pdb of that compile.
Reboot visual studio.
Now try to single step into that code.
The real symbol server is produced as a website. Plenty of doc. On how to do that.
I have a dotNet Core solution containing three projects - one common code, one "read-only" web service and one "admin" web service (which has all the POST, PUT and DELETE routes). The solution builds just fine locally and works. I want to build both projects and run both their publish operations to generate the output artifacts as part of the TFS Gated Check-In.
I have a build definition in TFS (2017) which includes a dotnet build task in which I specified the two project file paths and which has the following parameters...
/p:AssemblyVersion=$(Build.BuildNumber)
/p:Version=$(Build.BuildNumber) /p:DeployOnBuild=True
/p:PublishProfile=Dev.pubxml /p:AllowUntrustedCertificate=True
/p:Configuration=$(BuildConfiguration)
When the build runs it has no problem with the first project which builds just fine and correctly publishes, but when it then attempts to build the second project it comes up with the error...
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for e:\ci\builds\173\s\JMO.WebAPI\develop\JMOAdmin.WebAPI\JMOAdmin.WebAPI.csproj...
Restore completed in 23.62 ms for e:\ci\builds\173\s\JMO.WebAPI\develop\JMO.DAL\JMO.DAL.csproj.
Restore completed in 78.55 ms for e:\ci\builds\173\s\JMO.WebAPI\develop\JMO.WebAPI\JMO.WebAPI.csproj.
Restore completed in 34.6 ms for e:\ci\builds\173\s\JMO.WebAPI\develop\JMO.WebAPI\JMO.WebAPI.csproj.
Generating MSBuild file e:\ci\builds\173\s\JMO.WebAPI\develop\JMOAdmin.WebAPI\obj\JMOAdmin.WebAPI.csproj.nuget.g.props.
Restore completed in 1.3 sec for e:\ci\builds\173\s\JMO.WebAPI\develop\JMOAdmin.WebAPI\JMOAdmin.WebAPI.csproj.
JMO.DAL -> e:\ci\builds\173\s\JMO.WebAPI\develop\JMO.DAL\bin\dev\netcoreapp2.1\JMO.DAL.dll
CSC : error CS0006: Metadata file 'e:\ci\builds\173\s\JMO.WebAPI\develop\JMO.WebAPI\publish\System.EnterpriseServices.Wrapper.dll' could not be found [e:\ci\builds\173\s\JMO.WebAPI\develop\JMO.WebAPI\JMO.WebAPI.csproj]
Build FAILED.
CSC : error CS0006: Metadata file 'e:\ci\builds\173\s\JMO.WebAPI\develop\JMO.WebAPI\publish\System.EnterpriseServices.Wrapper.dll' could not be found [e:\ci\builds\173\s\JMO.WebAPI\develop\JMO.WebAPI\JMO.WebAPI.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:03.71
Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
Dotnet command failed with non-zero exit code on the following projects : e:\ci\builds\173\s\JMO.WebAPI\develop\JMOAdmin.WebAPI\JMOAdmin.WebAPI.csproj
Here's the rub though, if I swap the order of the projects in the task it is still the second project that fails to build. What is more, if I add a second dotnet build task so there is one for each project it still does the same - the second build fails with the same error, irrespective of which actual project builds first. The same applies if I use a wildcard for the project file names.
The other thing to note is that the file specified in the error (System.EnterpriseServices.Wrapper.dll) is not to be found in either build's output path anyway, whether the build succeeds or not!
The only way I have found so far to get a successful build of both projects is to use the MultiConfiguration option with a Pass1,Pass2 value and enable/disable the build tasks so that it takes two entire passes at the process, once for the "read-only" WS and one for the admin WS. I'm guessing that something is getting stuck in memory during the first project build process and it's tripping up the second but I can't prove it so far.
My problem with this solution is that this only works on the develop branch, on the release branch I need to use the multi-configuration option for the intended purpose - the various target environments (test, uat, prod).
Short of installing a TFS extension to chain builds (not ideal but viable), can anyone suggest why I'm getting this behaviour and, more importantly, suggest a better solution.
Cheers.
Very common problem for many users, that SonarQube Code Analysis fails with an error:
[10:06:05]No ProjectInfo.xml files were found. Possible causes:
[10:06:05]1. The project has not been built - the end step was called right
after the begin step, without a build step in between
[10:06:05]2. An unsupported version of MSBuild has been used to build the
project. Currently MSBuild 12.0 upwards are supported
[10:06:05]3. The build step has been launched from a different working folder
[10:06:05]Post-processing failed. Exit code: 1
[10:06:05]Process exited with code 1
A lot of references say that fix is to use full path for MSBuild.exe, but yes, I use full path, but also I use MSBuild 15.0 version with newest C# version, older MSBuild just fails for new C# features in code.
However I can't get rid of this error and I have no idea what can be done about it, so maybe any of you guys have already met this problem and could help me?
EDITED
I am pretty sure that none of these steps should be the reason for the fail, the second one only the closest one, because my build steps are
Team City build steps look like the following.
Step XX:
cd %projectDirectory%
"C:\sonarqube-5.3\bin\MSBuild.SonarQube.Runner\MSBuild.SonarQube.Runner.exe" begin ... params
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe" "MyProject.sln" /t:Clean;Rebuild
Step XY:
...
Step XZ: (the last)
cd %projectDirectory%
"C:\sonarqube-5.3\bin\MSBuild.SonarQube.Runner\MSBuild.SonarQube.Runner.exe" end
For me it looks very simple and easy to understand, but still I got that error and I have no idea why, the error is thrown in the last step (XZ).
You need to upgrade to a newer version of the Scanner for MSBuild. I'd suggest upgrading to the newest available version (v4.2 at the time of writing).
The scanner copies a targets file under the following location for each supported version of MBuild: %localappdata%\Microsoft\MSBuild[MSBuild version]\Microsoft.Common.targets\ImportBefore.
From the look of the log output you are using an version of the Scanner for MSBuild that pre-dates the release of MSBuild 15, so the file won't be copied to the MSBuild15-specific location. This will lead to the "no ProjectInfo.xml files were found" state.
It would be better if the warning message in the scanner log explicitly listed the range of MSBuild versions that were supported e.g. "This version of the Scanner supports MSBuild v12.0 to v14.0". I've created issue #502 to track this.
I've been trying to run code analysis of several .Net Core 1.1 projects, but have failed to get any results.
While using VS2015 and the project.json format I successfully sent the command:
../Sonar/tools/sonar-scanner-2.8/bin/sonar-scanner
and the sonar server shows each of the files in project(s) and test projects(s), but no analysis has actually been carried out:
Lines of code = 0
Vulnerabilities = 0
code smells = 0
Having migrated the projects to VS2017 and the csproj format, I can't even get the scan to run.
Running in the main project folder:
SonarQube.Scanner.MSBuild.exe begin /k:"Car.Enquiry-Presenter" /n:"Car.Enquiry-Presenter" /v:"1.0" (no prolems here)
msbuild Car.EnquiryPresenter.csproj
throws error: "error MSB4066: The attribute "Version" in element is unrecognized."
I can see here that the dotnet cli is not yet supported
https://jira.sonarsource.com/browse/SONARMSBRU-310
But this post suggests that it is possible:
https://www.sonarsource.com/resources/product-news/news.html#2017-04-13-sonarqube-scanner-for-msbuild-2-3-released
'support for .NET Core projects: SONARMSBRU-167'
But I've been unable to get this to work.
Can anyone help?
Yes is the answer (great, I get to answer my own question!).
I've just got it working using v15 of MSBuild, but I needed to fully qlaulify the path to the exe, otherwise it continued to use v14:
MSBuild.SonarQube.Runner.exe begin /key:"Car.Enquiry-Presenter" /name:"Car.Enquiry-Presenter" /version:"1.0"
"../../../../Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"
MSBuild.SonarQube.Runner.exe end
I also needed to add a 'ProjectGuid' node to my csproj file containing a guid (i just generated that with https://www.guidgen.com/)
NB: Overriding the toolset you use in the csproj file does not force it to use v15. ie: ... .
Hence the fully qualified path.
you need to ensure that the nuget packages are updated using a "dotnet restore" before calling msbuild.exe too.
I'm trying to build a Xamarin.Android app, but the build always fails with error MSB6006: "java.exe" exited with code 2. I've tried enabling ProGuard and multi-dex, deleting the bin and obj folders, updating all NuGet packages, switching to debug and release modes, and removing all unused references. The error always points to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets on line 1965, but that does not help. I've been struggling with this issue for days and I have no idea what to do next. These are some SO questions that I've seen, but haven't helped:
"java.exe" exited with code 2
"java.exe" exited with code 2 Xamarin.Android project
Java.exe exited with code 2 in android app build in VS 2015
You can try to enable Multi-Dex in Android project.
Right click on Android project
Options
Android Build
General
Check: Enable Multi-Dex
Now Rebuild the project.
Issue for me was android-sdk path containing "space".
Run following command
mklink /J C:\andsdk "C:\Program Files (x86)\Android\android-sdk"
and change the SDK path in Tools > Options > Xamarin > Android Sdk Location
Enable MultiDex also if doesn't work.
My guess and it's just a guess is this is related to a poorly constructed keystore or something amiss in Java, like an incorrect path. But I don't know what to do next and in the meantime my project is halted.
I fixed this problem by creating a new project and copying the old project's code, resources, and packages to the new one.