{"id":3953,"date":"2012-11-08T03:17:00","date_gmt":"2012-11-08T03:17:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2012\/11\/08\/migrating-coded-ui-test-projects-on-vs-2012\/"},"modified":"2019-02-14T17:57:57","modified_gmt":"2019-02-15T01:57:57","slug":"migrating-coded-ui-test-projects-on-vs-2012","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/migrating-coded-ui-test-projects-on-vs-2012\/","title":{"rendered":"Migrating Coded UI Test Projects on VS 2012"},"content":{"rendered":"<p><span style=\"font-family: Calibri;font-size: small\">In Visual Studio 2012, Coded UI Test projects provide silent upgrade features where if you open a Coded UI Test project which was created in Visual Studio 2010 SP1, it will get repaired automatically to support both Visual Studio 2012 &amp; Visual Studio 2010 SP1. Similarly if you create any new Coded UI Test project in Visual Studio 2012, you can also open the same project in Visual Studio 2010 SP1 after doing some tweaks without any issues.<\/span><\/p>\n<h2><strong><span style=\"font-size: medium\"><span style=\"color: #2e74b5\"><span style=\"font-family: Calibri Light\">How does it work<\/span><\/span><\/span><\/strong><\/h2>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; When we open a Coded UI Test project in Visual Studio 2012, it puts all Visual Studio 2010 Coded UI Test references to conditional reference section, so that these references get enabled only when there is appropriate version of Visual Studio.<\/span><\/span><\/p>\n<p><span style=\"font-size: x-small\">&lt;Choose&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp; &lt;When Condition=&#8221;&#8216;$(VisualStudioVersion)&#8217; == &#8216;10.0&#8217; And &#8216;$(IsCodedUITest)&#8217; == &#8216;True'&#8221;&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ItemGroup&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Reference Include=&#8221;Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL&#8221;&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Private&gt;False&lt;\/Private&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;\/Reference&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Reference Include=&#8221;Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL&#8221;&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Private&gt;False&lt;\/Private&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/Reference&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Reference Include=&#8221;Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL&#8221;&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Private&gt;False&lt;\/Private&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;\/Reference&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Reference Include=&#8221;Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL&#8221;&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Private&gt;False&lt;\/Private&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;\/Reference&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;\/ItemGroup&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp;&nbsp;&nbsp; &lt;\/When&gt;<\/span><\/p>\n<p><span style=\"font-size: x-small\">&nbsp; &lt;\/Choose&gt;<\/span><\/p>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">Also adds a target file entry in the end of project file which provide details of Visual Studio 2012 reference details.<\/span><\/span><\/p>\n<p>&lt;Import Project=&#8221;$(VSToolsPath)TeamTestMicrosoft.TestTools.targets&#8221; Condition= &#8220;Exists(&#8216;$(VSToolsPath)TeamTestMicrosoft.TestTools.targets&#8217;)&#8221; \/&gt;<\/p>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;Now if you open this project in Visual Studio 2010 SP1, only the first conditional block is picked for the referencing Coded UI Test assemblies. Since the target file is not present in the setup, import statement will not load Visual Studio 2012 references. <\/span><\/span><\/p>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">Similarly if the same project is opened in Visual Studio 2012, first conditional block is not picked thus no Visual Studio 2010 assemblies are picked, but presence of Target file provides 11.0 version assemblies.<\/span><\/span><\/p>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">So if you don&rsquo;t have any other Visual Studio version specific reference you project is good to go in both Visual Studio 2012 &amp; Visual Studio 2010 Sp1. All you have to do is to build the project and run the tests.<\/span><\/span><\/p>\n<p><span style=\"font-family: Calibri;font-size: small\">&nbsp;<\/span><\/p>\n<h2><strong><span style=\"font-size: medium\"><span style=\"color: #2e74b5\"><span style=\"font-family: Calibri Light\">What to do with custom references<\/span><\/span><\/span><\/strong><\/h2>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Silent repair in Coded UI Test project will not touch any custom reference which was added by the user. In such cases, if the referenced assembly has any Visual Studio version dependency, then you have to fix the references by yourself. <\/span><\/span><\/p>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To resolve your issue you can always use Conditional referencing and use <strong>$(VisualStudioVersion) <\/strong>attribute to identify with which Visual Studio version your solution is opened.<\/span><\/span><\/p>\n<h2><strong><span style=\"color: #2e74b5;font-family: Calibri Light;font-size: medium\">&nbsp;<\/span><\/strong><\/h2>\n<h2><strong><span style=\"font-size: medium\"><span style=\"color: #2e74b5\"><span style=\"font-family: Calibri Light\">Any in house assembly which is using Visual Studio references<\/span><\/span><\/span><\/strong><\/h2>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">If you have any in house assembly in your test framework and using these references, you have to modify that also to enable seamless experience in Coded UI Test. Both your local assemblies &amp; test project have to be built every time the project is opened in Visual Studio<\/span><\/span><\/p>\n<h2><strong><span style=\"color: #2e74b5;font-family: Calibri Light;font-size: medium\">&nbsp;<\/span><\/strong><\/h2>\n<h2><strong><span style=\"font-size: medium\"><span style=\"color: #2e74b5\"><span style=\"font-family: Calibri Light\">How to convert a Visual Studio 2012 Coded UI Test project to 2010 SP1<\/span><\/span><\/span><\/strong><\/h2>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If you have created any Coded UI Test project in Visual Studio 2012 and you want to work in Visual Studio 2010 Sp1, there are few things you have to take care<\/span><\/span><\/p>\n<ol>\n<li><span style=\"font-size: small\"><span style=\"font-family: Calibri\">Visual Studio 2010 doesn&rsquo;t support .NET v4.5, so you have to change your Target framework to v4.0 to open the project in Visual Studio 2010 SP1.<\/span><\/span><\/li>\n<li><span style=\"font-size: small\"><span style=\"font-family: Calibri\">You should not use any new features which were not present in Visual Studio 2010 SP1. You can get details of such features from MSDN.<\/span><\/span><\/li>\n<\/ol>\n<h2><strong><span style=\"color: #2e74b5;font-family: Calibri Light;font-size: medium\">&nbsp;<\/span><\/strong><\/h2>\n<h2><strong><span style=\"font-size: medium\"><span style=\"color: #2e74b5\"><span style=\"font-family: Calibri Light\">What to do with Visual Studio 2010 Feature Pack 2<\/span><\/span><\/span><\/strong><\/h2>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In Visual Studio 2012 RTM, support for SilverLight &amp; Firefox browser is not there by default. However you can install plug in for Silverlight from Code Gallery. Also we are releasing playback support for Firefox and Chrome browser as part of our quarterly update for Visual Studio 2012 which is planned to release by end of 2012. <\/span><\/span><\/p>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Silent upgrade of Coded UI Test project will take care of putting old Visual Studio 2010 Feature Pack 2 references inside Conditional reference block,&nbsp; but since there are no references available in Visual Studio 2012 for Silverlight extension, you have to add it by yourself. <\/span><\/span><\/p>\n<h2><strong><span style=\"color: #2e74b5;font-family: Calibri Light;font-size: medium\">&nbsp;<\/span><\/strong><\/h2>\n<h2><strong><span style=\"font-size: medium\"><span style=\"color: #2e74b5\"><span style=\"font-family: Calibri Light\">What is my project is part of Team Build<\/span><\/span><\/span><\/strong><\/h2>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If your Coded UI Test project is part of Team build, to enable the project build on both client 2010 &amp; 2012, also to build it in as part of team build, you have to open the project at least once in Visual Studio 2012, let it get repaired and check in the updated project. Also if you have using any custom references, you have to fix them manually.<\/span><\/span><\/p>\n<h2><strong><span style=\"color: #2e74b5;font-family: Calibri Light;font-size: medium\">&nbsp;<\/span><\/strong><\/h2>\n<h2><strong><span style=\"font-size: medium\"><span style=\"color: #2e74b5\"><span style=\"font-family: Calibri Light\">Projects are not getting build in Build Agent 2012<\/span><\/span><\/span><\/strong><\/h2>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If you are trying to build a Coded UI Test project as part of team build where build agents are version 2012, you have to install either Visual Studio 2012 Ultimate or Visual Studio 2012 Premium.<\/span><\/span><\/p>\n<h2><strong><span style=\"color: #2e74b5;font-family: Calibri Light;font-size: medium\">&nbsp;<\/span><\/strong><\/h2>\n<h2><strong><span style=\"font-size: medium\"><span style=\"color: #2e74b5\"><span style=\"font-family: Calibri Light\">Ordered tests are not picking Coded UI Test<\/span><\/span><\/span><\/strong><\/h2>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If you have both Visual Studio 2012 &amp; Visual Studio 2010 Sp1 installed on the same machine, you may encounter issues with OrderedTest. &nbsp;For example when trying to open an ordered test from Test Explorer in Visual Studio 2012 IDE, you get error message as unable to load Coded UI Test assemblies.<\/span><\/span><\/p>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This happens because the default program which is assigned for Ordered Test is still Visual Studio 2010 Sp1, so when you do a double click on any ordered test in Visual Studio 2012 Ide, it launches Visual Studio 2010 SP1,where it fails to refer 10.0 references. To resolve this issue, please associate Visual Studio 2012 as default program for opening ordered test.<\/span><\/span><\/p>\n<h2><strong><span style=\"font-size: medium\"><span style=\"color: #2e74b5\"><span style=\"font-family: Calibri Light\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><\/strong><\/h2><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Visual Studio 2012, Coded UI Test projects provide silent upgrade features where if you open a Coded UI Test project which was created in Visual Studio 2010 SP1, it will get repaired automatically to support both Visual Studio 2012 &amp; Visual Studio 2010 SP1. Similarly if you create any new Coded UI Test project [&hellip;]<\/p>\n","protected":false},"author":101,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[226,1,252],"tags":[],"class_list":["post-3953","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ci","category-devops","category-testing"],"acf":[],"blog_post_summary":"<p>In Visual Studio 2012, Coded UI Test projects provide silent upgrade features where if you open a Coded UI Test project which was created in Visual Studio 2010 SP1, it will get repaired automatically to support both Visual Studio 2012 &amp; Visual Studio 2010 SP1. Similarly if you create any new Coded UI Test project [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/3953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/101"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=3953"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/3953\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=3953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=3953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=3953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}