Skip to content

Mismatch between the .NET version used by the VS extension and the .NET Framework version of the test project. #160

@A95535

Description

@A95535

Used Visual Studio

Visual Studio 2022

Are the latest Visual Studio updates installed?

Yes

Content of reqnroll.json (if present)

### This is Error we got after build a project

Info: OnActivityStarted: Starting Visual Studio Extension...
Info: CreateProjectScope: Initializing project: Kiwa.Dataverse.Plugins.Tests
Info: StartRetryInitializeTimer: Project settings not available yet, retry in 5 seconds...
Info: OnSettingsInitialized: Project settings initialized: .NETFramework,Version=v4.6.2,SpecFlow:3.9.74
Warning: AndDiscoveryProviderSucceed: Error during binding discovery. 
Command executed:
  C:\Users\AnushaOruganti\source\repos\D365CE\Main\Kiwa.Dataverse.Plugins.Tests\bin\Debug\net462> C:\Program Files\dotnet\dotnet.exe exec c:\users\anushaoruganti\appdata\local\microsoft\visualstudio\17.0_29dec9ce\extensions\yok2auca.1z0\Connectors\SpecFlow-Generic-net8.0\specflow-vs.dll discovery C:\Users\AnushaOruganti\source\repos\D365CE\Main\Kiwa.Dataverse.Plugins.Tests\bin\Debug\net462\Kiwa.Dataverse.Plugins.Tests.dll C:\Users\AnushaOruganti\source\repos\D365CE\Main\Kiwa.Dataverse.Plugins.Tests\App.config
Exit code: 0
Message: 
System.TypeLoadException: Could not load type 'System.Xml.XmlNode' from assembly 'System.Xml.ReaderWriter, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
   at SpecFlowConnector.SpecFlowProxies.SpecFlowConfigurationLoader.<>c__DisplayClass2_0.<Load>b__0(FileDetails configFile)
   at Some`1.Map[TResult](Func`2 map)
   at SpecFlowConnector.SpecFlowProxies.SpecFlowConfigurationLoader.Load(SpecFlowConfiguration specFlowConfiguration)
   at TechTalk.SpecFlow.Configuration.DefaultRuntimeConfigurationProvider.LoadConfiguration(SpecFlowConfiguration specFlowConfiguration)
   at TechTalk.SpecFlow.Infrastructure.ContainerBuilder.CreateGlobalContainer(Assembly testAssembly, IRuntimeConfigurationProvider configurationProvider)
   at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactoryVLatest.CreateObjectContainer(Assembly testAssembly, ContainerBuilder containerBuilder, IRuntimeConfigurationProvider configurationProvider, IDefaultDependencyProvider dependencyProvider)
   at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactoryVLatest.CreateObjectContainer(Assembly testAssembly, Object containerBuilder, IRuntimeConfigurationProvider configurationProvider, Object dependencyProvider)
   at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactory.<>c__DisplayClass2_0.<GetBindingRegistry>b__0(Object dependencyProvider)
   at FunctionalExtensions.Map[TSource,TResult](TSource this, Func`2 fn)
   at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactory.GetBindingRegistry(AssemblyLoadContext assemblyLoadContext, Assembly testAssembly, Option`1 configFile)
   at SpecFlowConnector.Discovery.SpecFlowDiscoverer.Discover(IBindingRegistryFactory bindingRegistryFactory, AssemblyLoadContext assemblyLoadContext, Assembly testAssembly, Option`1 configFile)
   at SpecFlowConnector.Discovery.DiscoveryCommand.<>c__DisplayClass6_0.<Execute>b__0(IBindingRegistryFactory bindingRegistryFactory)
   at FunctionalExtensions.Map[TSource,TResult](TSource this, Func`2 fn)
   at SpecFlowConnector.Discovery.DiscoveryCommand.Execute(AssemblyLoadContext assemblyLoadContext)
   at SpecFlowConnector.ReflectionExecutor.<>c__DisplayClass3_0.<Execute>b__6(DiscoveryCommand cmd)
   at FunctionalExtensions.Map[TSource,TResult](TSource this, Func`2 fn)
   at SpecFlowConnector.ReflectionExecutor.<>c__DisplayClass3_1.<Execute>b__2()
   at EitherAdapters.Try[T](Func`1 act)
Info Found V3.9.74.14555 at C:\Users\AnushaOruganti\source\repos\D365CE\Main\Kiwa.Dataverse.Plugins.Tests\bin\Debug\net462\TechTalk.SpecFlow.dll
Info Chosen BindingRegistryFactoryBeforeV310000 for 309074
Error System.TypeLoadException: Could not load type 'System.Xml.XmlNode' from assembly 'System.Xml.ReaderWriter, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
   at SpecFlowConnector.SpecFlowProxies.SpecFlowConfigurationLoader.<>c__DisplayClass2_0.<Load>b__0(FileDetails configFile)
   at Some`1.Map[TResult](Func`2 map)
   at SpecFlowConnector.SpecFlowProxies.SpecFlowConfigurationLoader.Load(SpecFlowConfiguration specFlowConfiguration)
   at TechTalk.SpecFlow.Configuration.DefaultRuntimeConfigurationProvider.LoadConfiguration(SpecFlowConfiguration specFlowConfiguration)
   at TechTalk.SpecFlow.Infrastructure.ContainerBuilder.CreateGlobalContainer(Assembly testAssembly, IRuntimeConfigurationProvider configurationProvider)
   at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactoryVLatest.CreateObjectContainer(Assembly testAssembly, ContainerBuilder containerBuilder, IRuntimeConfigurationProvider configurationProvider, IDefaultDependencyProvider dependencyProvider)
   at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactoryVLatest.CreateObjectContainer(Assembly testAssembly, Object containerBuilder, IRuntimeConfigurationProvider configurationProvider, Object dependencyProvider)
   at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactory.<>c__DisplayClass2_0.<GetBindingRegistry>b__0(Object dependencyProvider)
   at FunctionalExtensions.Map[TSource,TResult](TSource this, Func`2 fn)
   at SpecFlowConnector.SpecFlowProxies.BindingRegistryFactory.GetBindingRegistry(AssemblyLoadContext assemblyLoadContext, Assembly testAssembly, Option`1 configFile)
   at SpecFlowConnector.Discovery.SpecFlowDiscoverer.Discover(IBindingRegistryFactory bindingRegistryFactory, AssemblyLoadContext assemblyLoadContext, Assembly testAssembly, Option`1 configFile)
   at SpecFlowConnector.Discovery.DiscoveryCommand.<>c__DisplayClass6_0.<Execute>b__0(IBindingRegistryFactory bindingRegistryFactory)
   at FunctionalExtensions.Map[TSource,TResult](TSource this, Func`2 fn)
   at SpecFlowConnector.Discovery.DiscoveryCommand.Execute(AssemblyLoadContext assemblyLoadContext)
   at SpecFlowConnector.ReflectionExecutor.<>c__DisplayClass3_0.<Execute>b__6(DiscoveryCommand cmd)
   at FunctionalExtensions.Map[TSource,TResult](TSource this, Func`2 fn)
   at SpecFlowConnector.ReflectionExecutor.<>c__DisplayClass3_1.<Execute>b__2()
   at EitherAdapters.Try[T](Func`1 act)
Warning: AndDiscoveryProviderSucceed: The project bindings (e.g. step definitions) could not be discovered. Navigation, step completion and other features are disabled. 
  Please check the error message above and report to https://github.com/reqnroll/Reqnroll.VisualStudio/issues if you cannot fix.

Issue Description

I am using the Reqnroll Visual Studio Professional 2022 extension (2026.1.477) with a .NET Framework (4.6.2) test project.
When building the project, I get the following error:

System.TypeLoadException: Could not load type 'System.Xml.XmlNode'
from assembly 'System.Xml.ReaderWriter'

This seems like a mismatch between the .NET version used by the VS extension
and the .NET Framework version of the test project.

Note: SpecFlow bindings are visible and working, so the issue is only with this TypeLoadException.

Steps to Reproduce

Install a Visual studio professional 2022 and install latest Reqnroll extension version (2026.1.477)
Try to create a project and create a .feature file for unit test cases.
then Try to build project then we can get error.

Link to a project repository that reproduces the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions