I'm trying to resolve this warning from unit test runs in Visual Studio:
[6/7/2019 7:16:21 PM Warning] Test run will use DLL(s) built for framework .NETFramework,Version=v4.5 and platform X64. Following DLL(s) do not match framework/platform settings. MyProject.Tests.dll is built for Framework 4.6.2 and Platform AnyCPU. Go to http://go.microsoft.com/fwlink/?LinkID=236877&clcid=0x409 for more details on managing these settings.
I know that I need to update the runsettings file with a targetframework version matching the framework of the unit test project (4.6.2). I just can't figure out what the magic string is.
Here's the starting point:
<!-- Configurations that affect the Test Framework -->
<RunConfiguration>
<!-- Path relative to solution directory -->
<ResultsDirectory>.\TestResults</ResultsDirectory>
<!-- [x86] | x64
- You can also change it from menu Test, Test Settings, Default Processor Architecture -->
<TargetPlatform>x64</TargetPlatform>
<!-- Framework35 | [Framework40] | Framework45 -->
<TargetFrameworkVersion>Framework45</TargetFrameworkVersion>
<!--
TargetFrameworkVersion needs to be updated, but documentation is unclear on how
cf. https://github.com/Microsoft/vstest-docs/issues/163
<TargetFrameworkVersion>.NETFramework,Version=v4.6.2</TargetFrameworkVersion>
-->
</RunConfiguration>
Every value I can find to try results in the following exception:
[6/7/2019 8:34:20 PM Error] Failed to configure settings for runsettings plugin 'VSTest Run Configuration' as it threw following exception: 'An error occurred while loading the settings. Error: Invalid setting 'RunConfiguration'. Invalid value 'net462' specified for 'TargetFrameworkVersion'..' Please contact the plugin author.
[6/7/2019 8:34:20 PM Diagnostic] Generate test run settings exception:System.Xml.XmlException: An error occurred while loading the settings. Error: Invalid setting 'RunConfiguration'. Invalid value 'net462' specified for 'TargetFrameworkVersion'.. at Microsoft.VisualStudio.TestWindow.VSTest.TestRunSettingsService.ValidateRunConfigurationSettings(XPathNavigator runSettingsNavigator) at Microsoft.VisualStudio.TestWindow.VSTest.TestRunSettingsService.MergeRunSettingsAndFindCompatibleSources(Architecture& platform, FrameworkVersion& framework, String resultsDirectory, String solutionDirectory, IDictionary`2 sourceSettings, IXPathNavigable inputRunSettings, String& incompatibleSourcesWarning) at Microsoft.VisualStudio.TestWindow.VSTest.TestRunSettingsService.AddRunSettings(IXPathNavigable inputRunSettingDocument, IRunSettingsConfigurationInfo configurationInfo, ILogger log) at Microsoft.VisualStudio.TestWindow.Controller.Request.GenerateTestRunSettings(RunSettingConfigurationInfoState infoState)
Values I've tried:
- .NETFramework,Version=v4.6
- .NETFramework,Version=v4.6.2
- v4.6.2
- net46
- net462
- Framework46
Similar: