-1

There are some cases where I need to deploy and some cases where I should not. For example, when a build is queued for remote agent i.e. using visual studio online execute the DeploymentItem attribute. But when a debug from visual studio i.e. build locally I do not wish to execute the DeploymentItem.

Can I set condition like if .. else on the DeploymentItem attribute? If yes, please let me know how to. Do mention if any work around.

Some code just for reference:

[DeploymentItem(@"Mocks", "Mocks")]
public class CodedUITest
{ 
    ....
}
Shridhar R Kulkarni
  • 6,653
  • 3
  • 37
  • 57

1 Answers1

-1

You can use two different test settings files with different values for Enable deployment option:

  • when queuing for remote agent you should use settings with this option enabled;
  • when building locally you should use settings with this option disabled.

How to select test settings file in VS ?

Specifying test settings as argument to MSTest

Yurii
  • 4,811
  • 7
  • 32
  • 41
  • Someone has downvoted the question as well as the answer. Also is trying to close the question. Any idea over this? – Shridhar R Kulkarni Jan 18 '18 at 17:09
  • No idea whatsoever, there is no comment to explain the behavior/decision. If this repeats, without any explanation of reason, you can ask about it on meta. Don't dwell on it too much. – Yurii Jan 19 '18 at 07:43