Expand variable in after_test
What is the proper way to have a variable replaced in my after_test script? I tried the following:
notice my attempt at using a variable: $(configuration):
after_test:
- packages\OpenCover.4.5.3723\OpenCover.Console.exe -register:user -target:"vstest.console.exe" -targetargs:"""MyProject.UnitTests\bin\$(configuration)\MyProject.UnitTests.dll""" -output:coverage.xml
but i get the following error message:
Error: The test source file "MyProject.UnitTests\bin\$(configuration)\MyProject.UnitTests.dll" provided was not found.
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | 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
Support Staff 1 Posted by Feodor Fitsner on 24 Mar, 2015 04:53 AM
As there is just a command try this:
2 Posted by desautelsj on 24 Mar, 2015 04:18 PM
Yes it worked. Thank you. The output in the appveyor console shows the %configuration% instead of 'Debug' or 'Release', which is slightly confusing. If you ever have a chance, it would be great to improve the output in the console to display the actual value. Here's an example of the console to illustrate my point:
As a follow-up question: when are we supposed to use curly brackets such as {myvariable}? When are we supposed to use the dollar sign and parenthesis such as $(myvariable)? and when are we supposed to use the percent signs (such as %myvariable%)?
Support Staff 3 Posted by Feodor Fitsner on 25 Mar, 2015 10:24 AM
If it is a "shell" command line, such as something starting with
-
use%myvariable%
. if it's PS command, starting with- ps:
use"$env:myvariable"
. In all other places should use$(myvariable)
.{myvariable}
is only used in version format and assembly patching and there only two vars:{biuld}
and{version}
.4 Posted by brian.donahue on 17 Jul, 2015 08:16 PM
Is the above info on variable usage specified anywhere in docs? Had to search for this - would be very useful to make easier to find! Thanks :)
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:58 AM.