tag:help.appveyor.com,2012-11-13:/discussions/questions/23338-call-exe-in-nuget-package-while-accessing-mscorlibxmlAppVeyor: Discussion 2018-10-13T21:00:26Ztag:help.appveyor.com,2012-11-13:Comment/457940872018-07-29T06:26:06Z2018-07-29T06:26:06ZCall exe in nuget package while accessing mscorlib.xml<div><p>From what i can see, provided the <em>inheritdoc</em> package is installed, the only modifications needed in that command is <code>path\to\project\directory</code>, which you should be able to swap out with <code>%APPVEYOR_BUILD_FOLDER%</code> environment variable, and <code><user name></code> in first parameter should be <code>appveyor</code>.</p>
<p>Give it a try and let us know if any troubleshooting is needed.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/457940872018-07-29T20:07:57Z2018-07-29T20:08:14ZCall exe in nuget package while accessing mscorlib.xml<div><p>I added this line the the appveyor.yml:</p>
<pre>
<code>before_package:
# This step replaces the inheritdoc tags in the xml documentation with documentation from mscorlib.xml
- ps: \Users\appveyor\.nuget\packages\inheritdoc\1.2.0.1\tools\InheritDoc.exe -b '%APPVEYOR_BUILD_FOLDER%' -g '\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.X\mscorlib.xml' -o</code>
</pre>
<p>but it produced the following error:</p>
<pre>
<code>\Users\appveyor\.nuget\packages\inheritdoc\1.2.0.1\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\1.2.0.1\tools\InheritDoc.exe :
At line:1 char:1
+ \Users\appveyor\.nuget\packages\inheritdoc\1.2.0.1\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%'.</code>
</pre>
<p>I believe the <code>C:\projects\system-io-abstractions\</code> is the clone/build directory, but unsure why the environment variable has been appended.</p></div>roberttag:help.appveyor.com,2012-11-13:Comment/457940872018-07-30T04:17:03Z2018-07-30T04:17:03ZCall exe in nuget package while accessing mscorlib.xml<div><p>Can you please share your yaml file or go to <em>Export Yaml</em> tab if you are using UI for configuration.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/457940872018-07-30T05:57:42Z2018-07-30T05:57:42ZCall exe in nuget package while accessing mscorlib.xml<div><p>Here it is: <a href="https://github.com/robertlarkins/System.IO.Abstractions/blob/master/appveyor.yml">System.IO.Abstractions/appveyor.yml</a></p></div>roberttag:help.appveyor.com,2012-11-13:Comment/457940872018-07-31T03:55:32Z2018-07-31T03:55:32ZCall exe in nuget package while accessing mscorlib.xml<div><p><code>%APPVEYOR_BUILD_FOLDER%</code> is cmd syntax. For powershell, use <code>$env:APPVEYOR_BUILD_FOLDER</code></p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/457940872018-07-31T08:48:22Z2018-07-31T08:48:22ZCall exe in nuget package while accessing mscorlib.xml<div><p>Thanks for the syntax correction, I changed the yml file to use the powershell syntax style with this environment variable but it kept the <code>$env:APPVEYOR_BUILD_FOLDER</code> rather than switching it for the path of the build directory. Does it require something else to tell it that its an environment variable?</p>
<p>The build log can be found here: <a href="https://ci.appveyor.com/project/tathamoddie/system-io-abstractions/build/2.1.0.212-gwggpnxi">ci.appveyor.com</a></p></div>roberttag:help.appveyor.com,2012-11-13:Comment/457940872018-07-31T12:14:14Z2018-07-31T12:14:14ZCall exe in nuget package while accessing mscorlib.xml<div><p>In PowerShell variables are not being resolved if they wrapped on single quotas (<code>'</code>). So <code>InheritDoc.exe</code> is fed with literally <code>-b $env:APPVEYOR_BUILD_FOLDER</code>.</p>
<p>You do not need to wrap <code>$env:APPVEYOR_BUILD_FOLDER</code> in quotas at all, but if you wish, use double quotas (<code>"</code>).</p>
<p>Also nuget package is being created as part of build stage. So if you need this command to be executed before, run it as <code>before_build</code>.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/457940872018-08-03T10:59:17Z2018-08-03T11:21:27ZCall exe in nuget package while accessing mscorlib.xml<div><p>Thanks, that got it working, except the script call only worked in <code>before_package</code>. 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.<br>
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)?</p></div>roberttag:help.appveyor.com,2012-11-13:Comment/457940872018-08-03T16:22:54Z2018-08-03T16:22:54ZCall exe in nuget package while accessing mscorlib.xml<div><p>Sure, using nuget cli will avoid adding any reference of the package to your project.<br>
So something like <code>- ps: nuget install InheritDoc -Version 1.2.0.1</code> should work.</p>
<p>No need to uninstall since build VM's are transient and destroyed after the build anyway.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/457940872018-08-13T06:46:56Z2018-08-13T06:46:56ZCall exe in nuget package while accessing mscorlib.xml<div><p>Hopefully this is the final part of getting this change in place. I'm trying to put the duplicated components into environment variables:<br></p>
<pre>
<code>environment:
INHERITDOC_VERSION: "1.2.2.1"
TEMP_DIR: c:/temp</code>
</pre>
I managed to get it working for the <code>nuget</code> call:<br>
<pre>
<code>install:
- nuget install inheritdoc -Version %INHERITDOC_VERSION% -OutputDirectory %TEMP_DIR%</code>
</pre>
but I've had no luck running the following call:<br>
<pre>
<code>before_package:
- 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</code>
</pre>
I get the following error:<br>
<pre>
<code>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.</code>
</pre>
How do I go about fixing this?<br>
If it helps, the full yaml file can be found <a href="https://github.com/System-IO-Abstractions/System.IO.Abstractions/blob/8958cdcd34f7fe56ce8bae40baa94e4bf2101184/appveyor.yml">here</a>, and the log file <a href="https://ci.appveyor.com/project/tathamoddie/system-io-abstractions/build/2.1.0.226-ubkrddrh">here</a>.</div>roberttag:help.appveyor.com,2012-11-13:Comment/457940872018-08-13T15:31:38Z2018-08-13T15:31:38ZCall exe in nuget package while accessing mscorlib.xml<div><p>Try putting the call operator (&) in front of the problematic line. Like so,<br></p>
<pre>
<code>before_package:
- 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</code>
</pre></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/457940872018-08-13T17:04:50Z2018-08-13T17:04:50ZCall exe in nuget package while accessing mscorlib.xml<div><p>Sorry, you should also wrap the whole command in single quotes.<br></p>
<pre>
<code>before_package:
- 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'</code>
</pre></div>Owen McDonnell