Upgrading Magenic/MAQS from V4 to V5

If you get an error like this while upgrading Magenic/MAQS from V4 to V5:

Severity Code Description Project File Line Suppression State
Error Could not install package ‘Microsoft.Extensions.Configuration 2.1.1’. You are trying to install this package into a project that targets ‘.NETFramework,Version=v4.5’, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Tried clearing the NuGet cache in VS 2017 but that didn’t help.

Solution

Troy Walsh suggested this solution…

Unfortunately, there is no clean upgrade path from V4 to V5.
The team has made several big changes, such as moving to .Net Standard 2.0, lazy initialization of the web driver, support for multiple web drivers in a single test, slitting of the config file sections and adding support for .Net Core to name just a few.

So there are 2 ways to upgrade

The hard way:

  1. Make sure you are using VS2017 or above
    https://marketplace.visualstudio.com/items?itemName=NuGetTeam.NuGetPackageManagerforVisualStudio2015#review-details
  2. Update your projects to 4.61 or above – https://docs.microsoft.com/en-us/dotnet/standard/net-standard

  3. Update your using statments
    using Magenic.MaqsFramework to using Magenic.Maqs
  4. Use the system under test configurations
    Config.GetValue(“WebSiteBase”) to SeleniumConfig.GetWebSiteBase()
  5. Remove any project references to Microsoft.VisualStudio.QualityTools.UnitTestFramework
  6. Use nuget to add the MSTest.TestAdapter package
  7. Update your app.config so it has a Selenium specific section
  8. Set the App.config to copy always

The easy way:

  1. Install the latest MAQS templates. – https://marketplace.visualstudio.com/items?itemName=vs-publisher-1465771.MAQSOpenFramework
  2. Create a new project

Copy your code into the new project
Note* You will need to update your using statements and any place you use the config settings

SOURCE: https://github.com/Magenic/MAQS/issues/5#issuecomment-407429302