I have a problem with SpecFlow. We are using Azure Devops and when I build solution on my local machine it works perfectly but during Azure Devops build I am getting following error:
[error]C:\Windows\ServiceProfiles\NetworkService\.nuget\packages\specflow.tools.msbuild.generation\3.1.86\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): Error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'TechTalk.SpecFlow, Version=3.1.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41'. The system cannot find the file specified.
File name: 'TechTalk.SpecFlow, Version=3.1.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41'
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType)
at TechTalk.SpecFlow.Generator.Plugins.GeneratorPluginLoader.LoadPlugin(PluginDescriptor pluginDescriptor)
at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.LoadPlugins(ObjectContainer container, GeneratorPluginEvents generatorPluginEvents, UnitTestProviderConfiguration unitTestProviderConfiguration, IEnumerable`1 generatorPlugins)
at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.CreateContainer(SpecFlowConfigurationHolder configurationHolder, ProjectSettings projectSettings, IEnumerable`1 generatorPluginInfos, IObjectContainer parentObjectContainer)
at SpecFlow.Tools.MsBuild.Generation.WrappedGeneratorContainerBuilder.BuildGeneratorContainer(SpecFlowConfigurationHolder specFlowConfigurationHolder, ProjectSettings projectSettings, IReadOnlyCollection`1 generatorPluginInfos, IObjectContainer rootObjectContainer)
at SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTaskExecutor.Execute()
at SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
<PackageReference Include="FluentAssertions" Version="5.10.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="Selenium.Support" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
<PackageReference Include="SpecFlow" Version="3.1.86" />
<PackageReference Include="SpecFlow.MsTest" Version="3.1.86" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.1.86" />
I have tried using it with nUnit, MsTest, xUnit and it alway fails.
Target framework: .NET Core 3.1.
Build agent: vs2019-win2019
We've encountered same problem, after longer digging I found that there is an issue created for this in their git repo https://github.com/SpecFlowOSS/SpecFlow/issues/1912.
Quoting from git issue:
MSBuild 16.5 has a new assembly loading approach for tasks that may have side effects. (which has been an ask for years, but it behaves a bit differently when loading dependencies)
You can try to set MSBUILDSINGLELOADCONTEXT=1 (env var) to get the old behavior.
Try to set it in your build pipeline as:
variables:
...
MSBUILDSINGLELOADCONTEXT: '1'
...
This helped in our case.
EDIT:
This issue seems to be fixed in newer version of SpecFlow (3.3.15+).
Had the same problem for SpecFlow 3.4.8 after migration from SpecFlow 2.
Since After version SpecFlow 3.3.30 don’t need to add the SpecFlow.Tools.MSBuild.Generation package anymore
so i have removed SpecFlow.Tools.MSBuild.Generation package, however issue still there.
After that i have added specflow.json to test project and issue gone
Had the same problem, turned out that it was version issues between .net core SDK and Specflow. We downgraded .net core sdk to 3.1.102 and that helped
Uninstalling and reinstalling specflow and SpecFlow.Tools.MsBuild.Generation worked for me
I had this issue after specflow runner installation. Removing it solved the problem
The error message says:
Could not load file or assembly 'TechTalk.SpecFlow, Version=3.1.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41'. The system cannot find the file specified.
File name: 'TechTalk.SpecFlow, Version=3.1.0.0
You have SpecFlow v3.1.86 installed. I would expect it to be loading TechTalk.SpecFlow 3.1.86, which matches the NuGet package version.
Either:
Uninstall and reinstall the SpecFlow package using the Package Manager Console:
uninstall-package SpecFlow -force -project NameOfYourTestProject
install-package SpecFlow -version 3.1.86 -project NameOfYourTestProject
Edit the .csproj file for your test project and ensure the <Reference> element importing the DLL file is pointing to the correct file
<Reference Include="TechTalk.SpecFlow, Version=3.0.0.0, Culture=neutral, PublicKeyToken=..., processorArchitecture=MSIL">
<HintPath>..\packages\SpecFlow.3.1.86\lib\FRAMEWORK_VERSION\TechTalk.SpecFlow.dll</HintPath>
</Reference>
Note: Replace FRAMEWORK_VERSION with net45, netstandard2.0, etc depending on the .NET framework version of your test project.
You can always open Windows File Explorer and browse to the DLL file in order to discover the correct path.
Last ditch effort, try restoring NuGet packages manually from the command line, assuming you have NuGet.exe available in your %PATH% (See https://learn.microsoft.com/en-us/nuget/install-nuget-client-tools for more info)
nuget restore Path/To/YourSolution.sln
So glad this post exists. The tests would run on my machine but not in azure pipeline.
I upgraded to the latest specflow and SpecFlow.NUnit and this solved the issue ... updated from 3.7.13 to 3.9.8. I don't understand but glad it worked.
Related
I'm building an .NetCoreApp1.1 webapi. We have the typical business and data layer assemblies broken out. When we added EntityFrameworkCore 2.x to the data access project, I was able to test functionality that went across projects. But the webapi stopped working! We were no longer able to start the app. program.cs-main failed with the exception:
System.MissingMethodException: "Method not found: 'System.IServiceProvider >MicrosoftExtensions.DependencyInjection.ServiceCollectionContainerBuilderExtens>ions.BuildServiceProvider...'
Articles indicated a package type mismatch but I couldn't find anything out of place. The EntityFrameworkcore in the data layer was suspect since it was version 2.0.0-preview1-final. In VS2017 there is a new feature to mark packages as private to the assembly. This made sense to do this with EF in the data layer so I opened the project and marked them PrivateAsset="All"
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0-preview1-final" **PrivateAssets="All"** />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0-preview1-final" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0-preview1-final" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="2.0.0-preview1-final" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview1-final" PrivateAssets="All" />
<PackageReference Include="WindowsAzure.Storage" Version="8.1.4" />
</ItemGroup>
This solved my problem. I was able to rebuild and run the webapi application. But, now my test failed with:
Message: Test method
ACMEAppTests.AppTests_FileManagerSave.FileManager_SaveFile threw exception: >System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
This makes no sense. The assembly is there. So it seems I can't get both applications working at the same time. The errors make no sense to me. There seems to be little information on the PrivateAsset="All" feature for packages. I found this description:
Tip
A private package reference (PrivateAssets="All") means this dependency is local to the current project. For example, if Project A has a build only dependency and Project B depends on A, dotnet restore will not add A's build-only dependencies into Project B.
reference
.Net Command Line Tools
How to resolve this? Figure out why the webapi stopped working (Method not found) or debug the missing assembly reference that isn't, from what I can tell, missing?
All help appreciated.
You can't mix ASP.NET Core 1.1 with EF Core 2.0. They share some common dependencies (e.g. Logging, DependencyInjection, etc.) which means all your Microsoft.* package versions need to more-or-less align.
See the documentation about PrivateAssets. Adding PrivateAssets="All" prevents your data layer's dependencies from propagating into your app. Hence, you get could not load assembly errors.
I am using ASP.NET Core 1.1 and I have the following on startup:
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.AddUserSecrets();
I am using csproj file instead of JSON where I added:
<PropertyGroup>
<UserSecretsId>8844d677-223b-4527-a648-387a65933d55</UserSecretsId>
</PropertyGroup>
But when I run the command:
dotnet ef migrations add "InitialCommit"
I get the error:
An error occurred while calling method 'ConfigureServices' on startup class 'Startup'. Consider using IDbContextFactory to override the initialization of the DbContext at design-time. Could not find 'UserSecretsIdAttribute' on assembly 'ef, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60"
Any idea why?
You have run into this issue: https://github.com/aspnet/Configuration/issues/543
The solution is to change your call .AddUserSecrets() to .AddUserSecrets(Assembly assembly)
See this announcement about how deprecating project.json required a breaking change to user secrets: https://github.com/aspnet/Announcements/issues/209
I had this issue also. My solution was to install the nuget package Microsoft.Extensions.Configuration.UserSecrets.
It finally worked for me when I changed a version of package in .csproj:
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.2" />
to:
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.1" />
I have a console app c# project that depends on NHibernate 3.3.2 and ShapArch.NHibernate 2.0.4.628 which has been compiled with NHibernate 3.3.1 (as far as I know - I might be wrong, but when I created a 2.0.4 SharpArch project it downloaded NH 3.3.1 via Nuget ).
Why does Visual Studio show NHibernate as being version 3.3.1.4000 when the referenced dll is 3.3.2.4000? The Specific Version property is set to false for all references. And the version for SharpArch appears in VS 2.0.0.0 instead of 2.0.4 which is the file/product version.
In the app config I have:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.1.4000" newVersion="3.3.2.4000" />
</dependentAssembly>
</assemblyBinding>
</runtime>
The app fails to load with:
System.IO.FileLoadException was unhandled
Message=Could not load file or assembly 'NHibernate, Version=3.3.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source=MyApp.ResourcesGenerator
FileName=NHibernate, Version=3.3.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
FusionLog=""
StackTrace:
at MyApp.ResourcesGenerator.Program.InitializeNHibernateSession()
at SharpArch.NHibernate.NHibernateInitializer.InitializeNHibernateOnce(Action initMethod) in d:\Builds\SharpArch2\Solutions\SharpArch.NHibernate\NHibernateInitializer.cs:line 54
at MyApp.ResourcesGenerator.Program.Initialize() in C:\projects\tc\Trunk\Source_LibsUpgrade\Applications\PerformanceManagement\MyApp.ResourcesGenerator\Program.cs:line 149
at MyApp.ResourcesGenerator.Program.Main(String[] args) in C:\projects\tc\Trunk\Source_LibsUpgrade\Applications\PerformanceManagement\MyApp.ResourcesGenerator\Program.cs:line 31
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.IO.FileLoadException
Message=Could not load file or assembly 'NHibernate, Version=3.3.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
FileName=NHibernate, Version=3.3.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
I am not even sure why it's trying to load 3.3.0.4000 when sharp architecture has been compiled with 3.3.1.
NHibernate 3.3.2.GA has a file version of 3.3.2.4000 but the assembly version is still 3.3.1.4000. This was done to allow an upgrade of NHibernate without needing binding redirects. All future minor version upgrades of NHibernate will also follow this pattern.
So the solution for you is just to remove the binding redirect.
The confusing part here is that the Windows Explorer only shows the file and product versions but Visual Studio only shows the assembly version.
The current version of SysCache does not appear to work with NHibernate 3.3. I replaced the NHibernate dlls in my web/bin directory and left the SysCache dll (which works with 3.2) untouched. Now when IIS tries to do a pre-bind it loads the SysCache dll and tries to bind it to NHibernate 3.2.0.4000 and fails.
[FileLoadException: Could not load file or assembly 'NHibernate,
Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'
or one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)] System.RuntimeTypeHandle.GetTypeByName(String name,
Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName,
ObjectHandleOnStack type) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +95
System.RuntimeType.GetType(String typeName, Boolean throwOnError,
Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
+54 System.Type.GetType(String typeName) +50 NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName
name, Boolean throwOnError) +338
NHibernate.Cfg.SettingsFactory.CreateCacheProvider(IDictionary`2
properties) +175
[HibernateException: could not instantiate CacheProvider:
NHibernate.Caches.SysCache.SysCacheProvider,
NHibernate.Caches.SysCache]
NHibernate.Cfg.SettingsFactory.CreateCacheProvider(IDictionary2
properties) +256
NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary2 properties)
+3449 NHibernate.Cfg.Configuration.BuildSettings() +29 NHibernate.Cfg.Configuration.BuildSessionFactory() +44
If I comment out the configuration in the web.config all is well:
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache" >true</property>
<property name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache</property>
The download site for NHibernate caches at NHibernate Contrib does not have a download for the latest version.
A different and slightly simpler approach is to override the reference to the 3.2 version of NHibernate in your web.config or app.config with a reference to the desired version 3.3 like so:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NHibernate" culture="neutral" publicKeyToken="aa95f207798dfdb4" />
<bindingRedirect newVersion="3.3.0.4000" oldVersion="0.0.0.0-3.3.0.4000" />
</dependentAssembly>
</assemblyBinding>
</runtime>
I've just tried this myself and it works as expected.
The issue probably is that the SysCache Dll is built using NHibernate 3.2.0 and it is not compatible with NHibernate 3.3.0. An easy way around this is to checkout the trunk of the nhibernate config project or the Cache solution only from https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHibernate.Caches
update the NHibernate reference to use the version that you are using and then rebuild and use the latest cache dlls. Since its a minor upgrade there shouldnt be any code changes required and you should be safe.
Try it and let me know how it goes.
I know this question has been posted here before, and I've trawled through as many answers as I could find, but I still can't get the simplest test in the world working.
1) I created my test and ensured it was working in in VS2008 and then opened the the solution in VS2010 (so it's all definlaty working, and all 3.5 code with all the assembly references 2.0/3.0/3.5 references)
2) I added the following config
<runtime>
<loadFromRemoteSources enabled="true"/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="System.Data.SQLite" fullName="System.Data.SQLite, Version=1.0.60.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
</assemblyBinding>
</runtime>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
3) I tried the test against both the 1.0.60.0 x86 and 1.0.66.0 x64 SqlLite dlls
4) I tried running the tests in x86 and x64 modes
Still not passing. What have I missed?
(oh, and i'm using SQLite20Driver, and Copy Local is set to true)
The test is a simple Configure()
var cfg = Fluently.Configure(new NHibernate.Cfg.Configuration().Configure())
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<UserMap>()
.Conventions.AddFromAssemblyOf<RequiredPropertyConvention>())
.BuildConfiguration();
var sessionFactory = cfg.BuildSessionFactory();
Error
NHibernate.HibernateException: "The
IDbCommand and IDbConnection
implementation in the assembly
System.Data.SQLite could not be found.
Ensure that the assembly
System.Data.SQLite is located in the
application directory or in the Global
Assembly Cache. If the assembly is in
the GAC, use
element in the application
configuration file to specify the full
name of the assembly."
Stack Trace
at NHibernate.Driver.ReflectionBasedDriver..ctor(String driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.SQLite20Driver..ctor()
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type)
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings)
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings)
at NHibernate.Connection.ConnectionProvider.Configure(IDictionary`2 settings)
at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2 settings)
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties)
at NHibernate.Cfg.Configuration.BuildSettings()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
NHibernate Config
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
<property name="connection.connection_string">Data Source=nhibernate.db;Version=3</property>
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="query.substitutions">true=1, false=0</property>
</session-factory>
</hibernate-configuration>
If you’re migrating a VS2008 project to 2010, or even starting off a new project chances are that your project references a 3rd party assembly that has not yet been compiled against the .NET 4 framework (yet). To get a V2.0 assembly to run in the .Net 4 runtime you need to enable Mixed Mode, by adding the following to your web.config/app.config:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
useLegacyV2RuntimeActivationPolicy: This tells the runtime to bind assemblies built against older version of .NET against the V4 runtime instead of the runtimes they were built with (force them to use V4)
supportedRuntime: Letting .NEt know that your application supports the V4 runtime and to load your application in the V4 runtime.
For UnitTesting, adding this to the app.config of the project containing the TestFixtures isn’t enough. You need to add this to the app.config of the application actually running the tests, so for NUnit GUI you need to add it to the nunit.exe.config. Furthermore, you’ll need to ensure that you’re using a 2.5.3+ version of NUnit.
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<requiredRuntime version="v4.0" />
<supportedRuntime version="v4.0"/>
</startup>
<runtime>
<loadFromRemoteSources enabled="true" />
</runtime>
</configuration>
loadFromRemoteSources: CAS has been deprecated in .Net 4 and this line forces partial trust V2 assemblies to be run in full trust.
requiredRuntime: This is because NUnit was built against V2 of the runtime, to load in V4 it needs to be told that it must run in the V4 runtime. (as opposed to only ‘supporting’ it)
If you using a different test runner, such as ReSharper’s test runner, TestDriven.Net or DXCore’s test runner you will need to ensure that you’ve changed their app.config’s to match the above (or wait for .Net 4 builds of them to be released)
Finally, if you’re using 3rd party assemblies that were compiled to target x86 specifically (this will mostly be assemblies that wrap other C/C++ assemblies, like System.Data.SQLite), you either need to grab the 64bit versions of them (as VS2010 by default compiles to x64 when using Any CPU as the Target) or change your Target to x86.