Call exe in nuget package while accessing mscorlib.xml

robert's Avatar


29 Jul, 2018 05:18 AM

The System.IO.Abstractions is a C# repository that uses the <inheritdoc /> tag to link to System.IO documentation. Unfortunately to make this documentation available in the System.IO.Abstraction nuget package the xml documentation files needs to be modified at the before_package stage in the appveyor deployment.

The inheritdoc nuget package provides an exe tool that does this modification, but I'm unsure where to find or how to access this tool as part of the appveyor deployment. On my local machine this exe is found for .NET standard/core here:

\Users\<your user name>\.nuget\packages\inheritdoc\\tools\InheritDoc.exe

but it also takes in a set of parameters that are paths to other files, such as the project directory to search for the xml files to change, and the paths to the System.IO xml documentation files.

How would I run this exe from the appveyor.xml if it looks like this on my local machine:

\Users\<user name>\.nuget\packages\inheritdoc\\tools\InheritDoc.exe -b '\path\to\project\directory\' -g 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.X\mscorlib.xml' -o

  1. Support Staff 1 Posted by Owen McDonnell on 29 Jul, 2018 06:26 AM

    Owen McDonnell's Avatar

    From what i can see, provided the inheritdoc package is installed, the only modifications needed in that command is path\to\project\directory, which you should be able to swap out with %APPVEYOR_BUILD_FOLDER% environment variable, and <user name> in first parameter should be appveyor.

    Give it a try and let us know if any troubleshooting is needed.

  2. 2 Posted by robert on 29 Jul, 2018 08:07 PM

    robert's Avatar

    I added this line the the appveyor.yml:

    # This step replaces the inheritdoc tags in the xml documentation with documentation from mscorlib.xml
    - ps: \Users\appveyor\.nuget\packages\inheritdoc\\tools\InheritDoc.exe -b '%APPVEYOR_BUILD_FOLDER%' -g '\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.X\mscorlib.xml' -o

    but it produced the following error:

    \Users\appveyor\.nuget\packages\inheritdoc\\tools\InheritDoc.exe -b '%APPVEYOR_BUILD_FOLDER%' -g '\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.X\mscorlib.xml' -o
    2018-07-29 02:52:45.5775|INFO|InheritDoc.Program|InheritDoc(v1.2.0.1).Run():basePath=%APPVEYOR_BUILD_FOLDER%,xmlDocFileNamePatterns=,overwriteExisting =True
    \Users\appveyor\.nuget\packages\inheritdoc\\tools\InheritDoc.exe : 
    At line:1 char:1
    + \Users\appveyor\.nuget\packages\inheritdoc\\tools\InheritDoc.e ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError
    Unhandled Exception:
    System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\projects\system-io-abstractions\%APPVEYOR_BUILD_FOLDER%'.

    I believe the C:\projects\system-io-abstractions\ is the clone/build directory, but unsure why the environment variable has been appended.

  3. Support Staff 3 Posted by Owen McDonnell on 30 Jul, 2018 04:17 AM

    Owen McDonnell's Avatar

    Can you please share your yaml file or go to Export Yaml tab if you are using UI for configuration.

  4. 4 Posted by robert on 30 Jul, 2018 05:57 AM

    robert's Avatar
  5. Support Staff 5 Posted by Owen McDonnell on 31 Jul, 2018 03:55 AM

    Owen McDonnell's Avatar

    %APPVEYOR_BUILD_FOLDER% is cmd syntax. For powershell, use $env:APPVEYOR_BUILD_FOLDER

  6. 6 Posted by robert on 31 Jul, 2018 08:48 AM

    robert's Avatar

    Thanks for the syntax correction, I changed the yml file to use the powershell syntax style with this environment variable but it kept the $env:APPVEYOR_BUILD_FOLDER rather than switching it for the path of the build directory. Does it require something else to tell it that its an environment variable?

    The build log can be found here:

  7. Support Staff 7 Posted by Ilya Finkelshte... on 31 Jul, 2018 12:14 PM

    Ilya Finkelshteyn's Avatar

    In PowerShell variables are not being resolved if they wrapped on single quotas ('). So InheritDoc.exe is fed with literally -b $env:APPVEYOR_BUILD_FOLDER.

    You do not need to wrap $env:APPVEYOR_BUILD_FOLDER in quotas at all, but if you wish, use double quotas (").

    Also nuget package is being created as part of build stage. So if you need this command to be executed before, run it as before_build.

  8. 8 Posted by robert on 03 Aug, 2018 10:59 AM

    robert's Avatar

    Thanks, that got it working, except the script call only worked in before_package. However, it has been recommended that the InheritDoc nuget package only be used temporarily as part of the appveyor script and neither installed nor deployed with System.IO.Abstractions.
    Is it possible to temporarily install a nuget package? Maybe using the Powershell Install-Package cmdlet? Does appveyor already have the nuget packageprovider installed, and does the InheritDoc nuget package need to be uninstalled after the fact (using Uninstall-Package)?

  9. Support Staff 9 Posted by Owen McDonnell on 03 Aug, 2018 04:22 PM

    Owen McDonnell's Avatar

    Sure, using nuget cli will avoid adding any reference of the package to your project.
    So something like - ps: nuget install InheritDoc -Version should work.

    No need to uninstall since build VM's are transient and destroyed after the build anyway.

  10. 10 Posted by robert on 13 Aug, 2018 06:46 AM

    robert's Avatar

    Hopefully this is the final part of getting this change in place. I'm trying to put the duplicated components into environment variables:

      TEMP_DIR: c:/temp
    I managed to get it working for the nuget call:
    - nuget install inheritdoc -Version %INHERITDOC_VERSION% -OutputDirectory %TEMP_DIR%
    but I've had no luck running the following call:
    - ps: $env:TEMP_DIR\InheritDoc.$env:INHERITDOC_VERSION\tools\InheritDoc.exe -b $env:APPVEYOR_BUILD_FOLDER -g 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.X\mscorlib.xml' -o
    I get the following error:
    At line:1 char:14
    + ... env:TEMP_DIR\InheritDoc.$env:INHERITDOC_VERSION\tools\InheritDoc.exe  ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Unexpected token '\InheritDoc.$env:INHERITDOC_VERSION\tools\InheritDoc.exe' in expression or statement.
    How do I go about fixing this?
    If it helps, the full yaml file can be found here, and the log file here.
  11. Support Staff 11 Posted by Owen McDonnell on 13 Aug, 2018 03:31 PM

    Owen McDonnell's Avatar

    Try putting the call operator (&) in front of the problematic line. Like so,

    - ps: & $env:TEMP_DIR\InheritDoc.$env:INHERITDOC_VERSION\tools\InheritDoc.exe -b $env:APPVEYOR_BUILD_FOLDER -g 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.X\mscorlib.xml' -o
  12. Support Staff 12 Posted by Owen McDonnell on 13 Aug, 2018 05:04 PM

    Owen McDonnell's Avatar

    Sorry, you should also wrap the whole command in single quotes.

    - ps: '& $env:TEMP_DIR\InheritDoc.$env:INHERITDOC_VERSION\tools\InheritDoc.exe -b $env:APPVEYOR_BUILD_FOLDER -g 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.X\mscorlib.xml' -o'
  13. Ilya Finkelshteyn closed this discussion on 13 Oct, 2018 09:00 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac