I Have unit test project in this I am using AspNetDevelopmentServer attribute to test my wcf Service locally. It working fine When I give the arguments hardcoded like this
[AspNetDevelopmentServer("Test",@"C:\\Users\\LocalSourcePath")]
When I try to pass this arguments through variable (dynamically) like
string path = @Directory.GetParent((Directory.GetParent(Path.GetDirectoryName((new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase)).LocalPath))).Parent.FullName).FullName+"\\Publish";
[AspNetDevelopmentServer("Test",path )]
It throws error like this:
"An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type "
Is any other way to pass a dynamic value to attribute? Thanks is advance.
Try using relative paths to the other project (presumably in the same Visual Studio solution within C:\Users\LocalSourcePath):
Paths are relative your MyProjectTests\bin\debug folder