VS2012 build of solution reverts to VS2010 Coded UI test DLL's when built using MSBuild
-
Wednesday, August 29, 2012 1:34 PM
I have installed VS2012 RTM version on my machine, and I have upgraded a VS2010 Coded UI test solution to VS2012. When I build the projects in that solution using VS2012, there is no problem.
However, when I use MSBuild.exe to build the VS2012 solution, the DLL references to the Coded UI test tools revert to the VS2010 DLL's.
So when I attempt to run the tests on my test environment using these build files I get error messages:
System.IO.FileNotfoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITesting', Version 10.0.0.0 ... "
When I view the DLL reference paths via VS2012, the DLL references all point to the Version 11 DLL's. I can understand why they revert to version 10 when I load the solution up in VS2010, but why does it do this when I build the solution via MSBuild?
I have been using the .NET 4.0 MSBuild on my developer machine (C:\Windows\Microsoft.NET\Framework\v4.0.30319).
Any ideas how I can get MSBuild to NOT revert the DLL's to version 10?
- Moved by Amanda ZhuMicrosoft Contingent Staff Thursday, August 30, 2012 6:22 AM (From:Visual Studio Team System - Testing)
All Replies
-
Wednesday, August 29, 2012 2:02 PM
UPDATE: I was able to get it working - but it only seems to work when I add the following command switch to MSBuild:
/p:Configuration=Release
Why will it only work in Release mode? Why are my DLL's reverting to the version 10 DLL's in Debug mode? I can't see anything that stands out in my project configuration that would cause this to happen.
UPDATE 2: I noticed in my .csproj file, the references are all to the Version 10 DLL's, yet when I browsing the references of that exact same project - the version numbers say Version 11.
Why? Is this for backwards compatibility with VS2010? This is confusing.
-
Friday, August 31, 2012 5:36 AMModerator
Hi xbox360ciaran,
Can you show the content of your .csproj file?
Here is a thread which may be helpful to you:
http://social.msdn.microsoft.com/Forums/en/vsautotest/thread/dcd19386-98ae-4bf0-a539-4b269bf203ca
Best regards,
Ego [MSFT]
MSDN Community Support | Feedback to us
-
Monday, September 03, 2012 11:18 AM
Contents of the .csproj for one of my Coded UI test projects:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion> </ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{BF8C8FA6-CEC9-4CC1-AC4E-D2076C828594}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>CodedUISanity</RootNamespace> <AssemblyName>CodedUISanity</AssemblyName> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <SccProjectName>SAK</SccProjectName> <SccLocalPath>SAK</SccLocalPath> <SccAuxPath>SAK</SccAuxPath> <SccProvider>SAK</SccProvider> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> <IsCodedUITest>True</IsCodedUITest> <FileUpgradeFlags> </FileUpgradeFlags> <UpgradeBackupLocation> </UpgradeBackupLocation> <OldToolsVersion>4.0</OldToolsVersion> <PublishUrl>publish\</PublishUrl> <Install>true</Install> <InstallFrom>Disk</InstallFrom> <UpdateEnabled>false</UpdateEnabled> <UpdateMode>Foreground</UpdateMode> <UpdateInterval>7</UpdateInterval> <UpdateIntervalUnits>Days</UpdateIntervalUnits> <UpdatePeriodically>false</UpdatePeriodically> <UpdateRequired>false</UpdateRequired> <MapFileExtensions>true</MapFileExtensions> <ApplicationRevision>0</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> <IsWebBootstrapper>false</IsWebBootstrapper> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <Private>False</Private> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.XML" /> <Reference Include="UIAutomationTypes" /> <Reference Include="WindowsBase" /> </ItemGroup> <ItemGroup> <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> <ItemGroup> <Compile Include="Base\Config.cs" /> <Compile Include="Base\Log.cs" /> <Compile Include="Sanity\Phase1\AdminSiteLogon.cs" /> <Compile Include="Sanity\Phase1\AddBusinessProcessRole.cs" /> <Compile Include="Sanity\Phase1\AdminLogoff.cs" /> <Compile Include="Sanity\Phase1\CreateUserRole.cs" /> <Compile Include="Sanity\Phase1\CreateUser.cs" /> <Compile Include="Sanity\Phase1\CreateBusinessUnit.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Base\TestBase.cs" /> <Compile Include="Sanity\Phase1\UIMap.cs"> <DependentUpon>UIMap.uitest</DependentUpon> </Compile> <Compile Include="Sanity\Phase1\UIMap.Designer.cs"> <DependentUpon>UIMap.uitest</DependentUpon> </Compile> <Compile Include="Sanity\Phase2\BuyerLogonChangePassword.cs" /> <Compile Include="Sanity\Phase2\CreateProjectDept.cs" /> <Compile Include="Sanity\Phase2\UIMap1.cs"> <DependentUpon>UIMap1.uitest</DependentUpon> </Compile> <Compile Include="Sanity\Phase2\UIMap1.Designer.cs"> <DependentUpon>UIMap1.uitest</DependentUpon> </Compile> <Compile Include="Sanity\Phase3\CreateContract.cs" /> <Compile Include="Sanity\Phase3\CreateContractor.cs" /> <Compile Include="Sanity\Phase3\UIMapPhase3.cs"> <DependentUpon>UIMapPhase3.uitest</DependentUpon> </Compile> <Compile Include="Sanity\Phase3\UIMapPhase3.Designer.cs"> <DependentUpon>UIMapPhase3.uitest</DependentUpon> </Compile> <Compile Include="Sanity\Phase4\CreateTenderTemplateCategory.cs" /> <Compile Include="Sanity\Phase4\UIMap1.cs"> <DependentUpon>UIMap1.uitest</DependentUpon> </Compile> <Compile Include="Sanity\Phase4\UIMap1.Designer.cs"> <DependentUpon>UIMap1.uitest</DependentUpon> </Compile> <Compile Include="Base\TestAdmin.cs" /> </ItemGroup> <ItemGroup> <BootstrapperPackage Include=".NETFramework,Version=v4.0"> <Visible>False</Visible> <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName> <Install>true</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> <Visible>False</Visible> <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> <Install>false</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> <Visible>False</Visible> <ProductName>.NET Framework 3.5 SP1</ProductName> <Install>false</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Windows.Installer.4.5"> <Visible>False</Visible> <ProductName>Windows Installer 4.5</ProductName> <Install>true</Install> </BootstrapperPackage> </ItemGroup> <ItemGroup> <None Include="SanityTest1.orderedtest"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> <None Include="Sanity\Phase3\UIMapPhase3.uitest" /> <None Include="Sanity\Phase1\UIMap.uitest" /> <None Include="Sanity\Phase2\UIMap1.uitest" /> <None Include="Sanity\Phase4\UIMap1.uitest" /> </ItemGroup> <Choose> <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"> <ItemGroup> <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension.Firefox, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension.Silverlight, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> </ItemGroup> </When> </Choose> <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>
-
Monday, September 03, 2012 3:04 PM
I wasn't too sure what to make of the thread their proposed solution seemed overly complicated.
I installed the new VS2012 agent tools today and I just attempted to run my automated tests on my test environment.
I used MSBuild.exe to build the two projects I require, and I output them to my test environment. As I have been doing for the past week or so, I used the MSTest.exe that is supplied with the agent tools to launch the tests, but for the first time I encountered the errors that I have until now only got on our build machine (Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0 ...)
Why is this happening? I am attempting to run the tests on a test environment which only has the version 11 Coded UI test DLL's! And it is a solution and projects that were upgraded to VS2012 - and I can see in my solution explorer that all the DLL's are referencing the version 11 DLL's - so why are they reverting to the old ones when I try and launch the tests?
It makes absolutely zero sense to me.UPDATE:
From one of the projects I manually removed the Condition which references the version 10 DLL's from the .csproj file. I then built the projects onto my test environment and the tests executed.
Another observation that the builds only started to work when I specified /p:VisualStudioVersion=11.0 . Once I had specified this once, it appeared to work for a few times without having to specify the Visual Studio version, then all of a sudden I had to use it again. Why is this? Surely, this isn't something I will always have to specify, even after all developer environments upgrade to VS2012?
Among all of this, there has to be a bug somewhere in Visual Studio.
Also, because I removed the backwards compatibility code, my build is no longer able to be built by TFS on our build machine (assuming because we require VS2012?)
Thanks
- Edited by xbox360ciaran Monday, September 03, 2012 3:20 PM
- Edited by xbox360ciaran Monday, September 03, 2012 3:27 PM
- Edited by xbox360ciaran Monday, September 03, 2012 4:11 PM
- Edited by xbox360ciaran Monday, September 03, 2012 4:14 PM
- Edited by xbox360ciaran Monday, September 03, 2012 4:15 PM
- Edited by xbox360ciaran Monday, September 03, 2012 4:43 PM
-
Tuesday, September 18, 2012 7:43 AMModerator
Hi,
While I go through this scenario, open a legacy VS 2010 test project in VS 2012, it made change to project file so it builds without problem. I can build in either VS 2012 or msbuild, no specifying additional parameter to MSBuild.
Automatic migration add below code to project file, as well as two other related change:
<Choose> <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"> <ItemGroup> <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Private>False</Private> </Reference> </ItemGroup> </When> </Choose> <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />Please make sure the project is successfully migrated. This process makes the project could be working with both VS 2012 and VS 2010 SP1.
regards,
Forrest Guo | MSDN Community Support | Feedback to manager

