path - C# using static variable as parameter to DeploymentItem -


I want to use a fixed variable as a parameter on an MSTEST unit test on DeploymentItem I do not think I am able to do this. An XSL file that should be copied with the DLL file, when the unit test runs, and I

  private static string _xslPath = Path.Combine ("MyProjectDir", "transform.xsl" ); However, when I do the following:  
  [TestMethod] [Deployment Unit (DLL)] [Deployment Unit (_xslpath)] Public Zero XmlToResultsTest () {}  

I get this build error:

An attribute argument can be an expression of type expression, type expression or an array of parameter type expression

OK, okay, but it's so dirty to collect the path yourself Is:

  [DeploymentItem (@ "MyProjectDir \ transform.xsl")]  

Do I type Path.Combine Want to use as much as I want? Am I getting another option? I think I could simply put an XML file in the root solution directory so I did not have to pass in the project directory as part of the path.

attributes can only use continuous wires, not so: you can not do it -Compact version, or have to use a lexical combination - no path.Combine ). You can also use the test-project deployment setting (testrunconfig?), But clearly I like to use the NUnate approach to marking the file for deployment (in Seaspase in general). I just do not know why MS added a different way of defining it ...


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -