Using MSTest, what is the relative path root of the DeploymentItemAttribute.
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
- Dependencies while implementing Mocking in Junit4
So I'm gonna add my experience.
So if you're using .testrunconfig file, that will trump (override) what I'm saying below.
I figured there were a few options.
I finally got my build system working by using the "relative to the current .cs file" approach.
In my example, I needed a Xsd from a different project copied over for my UnitTest. But the type of file does not matter.
Example:
Per the MSDN page...
That setting is, by default, the Solution directory. So, if you have this project structure
And you want to deploy required.xml, you're going to create a DeploymentItemAttribute like this
It seems the file properties need to be set to 'Content' and 'Copy always' or 'Copy if newer'. There are advanced examples on this MSDN page.
To assume that the RelativePathRoot default is the dir where your solution resides was not correct in my case, nor was RelativePathRoot defined within my .testrunconfig file. I found the RelativePathRoot default to be the /bin/debug dir for the solution.
Walking back from that point, then walking up to my file that I was attempting to deploy for the unit test worked fine.