DeploymentItem doesn't work
-
Sunday, October 14, 2012 5:59 AM
Hello.
I have following project structure:
Solution -My.Project -My.Project.Test --Resources ---mytest.file
In my test file following method:
[TestMethod]
[DeploymentItem("My.Project.Test\\Resources\\mytest.file", @"Resources")]
TestMethod()
{
....
string path = "Resources\\mytest.file"; ....
}
In according to http://msdn.microsoft.com/en-us/library/ms182475%28VS.80%29.aspx I want use only DeployItemAttribute without "Deployment Items property".
But when debugged it method i catch exception: "File not found".
How can I do?
Best regards!
All Replies
-
Sunday, October 14, 2012 4:02 PM
Have you verified that you have "Enable Deployment" in your testsettings file ?
- Proposed As Answer by Amanda ZhuMicrosoft Contingent Staff, Moderator Thursday, October 18, 2012 12:00 AM
- Marked As Answer by Amanda ZhuMicrosoft Contingent Staff, Moderator Monday, October 22, 2012 12:38 AM
- Unmarked As Answer by foxxxx_xxxx Tuesday, October 23, 2012 6:31 AM
-
Monday, October 15, 2012 6:24 AMModerator
Hello Foxxxx_xxxx,
Thank you for posting in the MSDN forum.
If you want to deploy a file, you can refer to the following article to know more information about how to configure test deployment:
How to: Configure Test Deployment
Generally, you can deploy a file in your active test settings for example Load.testsettings. Also you can deploy items for a single test using the DeploymentItem attribute like this:
[DeploymentItem("MyTestProject\\XMLFile1.xml")]
Note that, when you deploy a file, you need to select “Enable Deployment” in your active test settings.
Best regards,
Amanda Zhu [MSFT]
MSDN Community Support | Feedback to us
- Proposed As Answer by Amanda ZhuMicrosoft Contingent Staff, Moderator Thursday, October 18, 2012 12:00 AM
- Marked As Answer by Amanda ZhuMicrosoft Contingent Staff, Moderator Monday, October 22, 2012 12:38 AM
- Unmarked As Answer by Amanda ZhuMicrosoft Contingent Staff, Moderator Tuesday, October 23, 2012 6:40 AM
-
Tuesday, October 23, 2012 6:32 AMYes, it is enabled.
-
Tuesday, October 23, 2012 6:38 AM
Hello!
I do in according this link, but it is not help me.
But following URL helps me (thanks stackoverflow's guys):
Best regards!
- Marked As Answer by foxxxx_xxxx Tuesday, October 23, 2012 6:38 AM
- Edited by foxxxx_xxxx Tuesday, October 23, 2012 6:42 AM
-
Thursday, October 25, 2012 1:56 PM
There have been some changes between how deploymentitems are arranged between VS2010 and VS2012. Especially the target directory handling is different. In VS2010 specifying a target directory name lead to the files being copied to the directory. VS2012 will rename the source file to 'Resources'.
Adding a couple of slashes changes how this is interpreted: '.\Resources\' instead of 'Resources'.
Also, the different test frameworks handle this slightly different.
See my original connect item for this bug.
My contact wihin the team promised to work on some additional MSDN pages to explain how to best use the DeploymentItem and how to configure it properly in your test settings file.
My blog: blog.jessehouwing.nl

