NBehave and NUnit-2.5.5.10112 can work together? - nunit

I'm using Unit-2.5.5.10112. How can I use also NBehave, if it has dependency on an older version of NUnit?
Should I ignore NBehave?

You can get NBehave 0.4.5 to use NUnit 2.5.5.10112 by doing the following:
First, create an NBehave-Console.exe.config containing the following:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="nunit.framework"
culture="neutral"
publicKeyToken="96d09a1eb7f44a77" />
<bindingRedirect oldVersion="2.5.2.9222" newVersion="2.5.5.10112" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
This tells the CLR loader that when NBehave-Console.exe looks for 2.5.2.9222 of nunit.framework, it should use 2.5.5.10112 instead.
Second, put nunit.framework.dll version 2.5.5.10112 in the C:\Program Files\NBehave\0.4.5.183 directory, replacing the older version.

Related

Ignoring Tabs and white spaces in VS Code Search

My solution has many projects, I want to check all of the *.config projects, to be sure if Microsoft.Extensions.DependencyInjection packages are in the version of 6.0.0.0 in all projects.
* But not from NuGet PackageManager Solution
I want to search for
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
As we can see, there are some white spaces or Tabs before <assemblyIdentity> and <bindingRedirect>.
How can I search all these 3 lines in the whole solution no matter of tabs or whitespaces before and after them in VS Code ?
ForExample if I search for
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
then the result could also be:
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>

How can I solve 'MathWorks.MATLAB.NET.Arrays.MWArray' threw an exception?

I got the following error with matlab in asp.net.
I installed "MATLAB Runtime" and followed the instruction by "Build a .NET Application" via
https://ww2.mathworks.cn/help/compiler_sdk/gs/create-a-dotnet-application-with-matlab-code.html
And when I run via "IIS Express(Chrome)" in VS2019, I got the following error.
and in Output display.
Exception thrown: 'System.TypeInitializationException' in MWArray.dll
An exception of type 'System.TypeInitializationException' occurred in MWArray.dll but was not handled in user code
The type initializer for 'MathWorks.MATLAB.NET.Arrays.MWArray' threw an exception.
When I check the "Environment variable"
and when I check the path, I found "mclmcrrt9_6.dll"
sys info.
VS2019
debug platform : x64
framework : 4.5.2
runtime of Web.config
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MWArray" publicKeyToken="E1D84A0DA19DB86F" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.19.0.0" newVersion="2.19.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.2.6.0" newVersion="5.2.6.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.2.6.0" newVersion="5.2.6.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
How can I solve this? Thanks in advance.

Could not load file or assembly EntityFramework in DotNetNuke

I have a old module in DotNetNuke. I used EF 5 in my project:
I added module to DotNetNuke and it worked properly. But when I add new module that requierd to EF 6 my module gives me an error:
Could not load file or assembly 'EntityFramework, Version=5.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference.
When installing this new module EntityFramework 6 dll file will be replaced with old version (Version=5.0.0.0) file and this causes old module doesn't work.
I read many post for solving this problem but I can't find a way for this issue.
It would be very helpful if someone could explain solution for this problem.
You can add this to your web.config
<configuration>
<runtime>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<codeBase version="6.0.0.0" href="bin/EntityFramework-6.1.3/EntityFramework.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework.SqlServer" publicKeyToken="b77a5c561934e089" culture="neutral" />
<codeBase version="6.0.0.0" href="bin/EntityFramework-6.1.3/EntityFramework.SqlServer.dll" />
</dependentAssembly>
</runtime>
</configuration>
You have to add a folder called EntityFramework-6.1.3 into bin folder then add two follow dll to that
1-EntityFramework.dll
2-EntityFramework.SqlServer.dll
You can add this to web.config
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.1.3.0" newVersion="6.1.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Transforming Web Config for release

I have the following XML in my web config and in release mode I need to remove dependentAssembly section depending on the name attribute of its child : assemblyIdentity. I tried the answer here:xdt transform locator that matches subnode content but no luck.
My web.config is something like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Resource" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///c:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter.DLL" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I have tried the following in my web.release.config to select the second dependentAssembly element for deletion based on the child element but no success.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" >
<dependentAssembly>
<!-- Attempt 1 -->
<assemblyIdentity xdt:Transform="RemoveAll"
xdt:Locator="Condition(#name='Microsoft.VisualStudio.QualityTools.Resource')"/>
</dependentAssembly>
</assemblyBinding>
<!-- Attempt 2 -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Remove"
xdt:Locator="Condition(assemblyIdentity/#name='Microsoft.VisualStudio.QualityTools.Resource')">
</dependentAssembly>
</assemblyBinding>
</runtime>
This code works for me.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Replace" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/#name='System.Web.Mvc')">
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
All credit to #Thommy's stackoverflow answer to this post.

Web.Config Transformation XPath

I've done the usual checks for similar posts on here and Google (etc) but to no avail.
Basically I have a Visual Studio 2010 MVC3 solution that is using Web.Config transformations and for the most part they're working great. However, I have some unit testing bindings that I want removed and they're a little tricky because of their XML location.
Here is the cut down version:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///C:/Program%20Files/Microsoft%20Visual%20Studio%2010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter.DLL" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.QualityTools.Common/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.QualityTools.Common.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.ExecutionCommon" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.QualityTools.ExecutionCommon/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Resource" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.QualityTools.Resource/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.QualityTools.Resource.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="AjaxMin" publicKeyToken="21ef50ce11b5d80f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.46.4422.26284" newVersion="4.46.4422.26284" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Esentially I want to remove the nodes that contain a child node with a name containing "Microsoft.VisualStudio".
So far I can get the nodes to empty using some verbose syntax in my transformation Web.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter" xdt:Transform="Remove" xdt:Locator="Match(name)" />
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Common" xdt:Transform="Remove" xdt:Locator="Match(name)" />
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.ExecutionCommon" xdt:Transform="Remove" xdt:Locator="Match(name)" />
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Resource" xdt:Transform="Remove" xdt:Locator="Match(name)" />
<codeBase version="10.0.0.0" xdt:Transform="RemoveAll" xdt:Locator="Match(version)" />
</dependentAssembly>
<dependentAssembly xdt:Locator="XPath(//runtime/*/*[not(node())])" xdt:Transform="RemoveAll" />
</assemblyBinding>
</runtime>
</configuration>
This sort of works but gives me empty nodes which I don't want.
Any ideas?
Cheers!
This is how I have removed the unneeded dependentAssembly references, not sure if it is the best way, but it works for me:
in Web.config, add a name to all the dependentAssembly entries that are not required for production, I chose to use "QualityTools".
<dependentAssembly name="QualityTools">
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///C:/Program%20Files/Microsoft%20Visual%20Studio%2010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter.DLL" />
</dependentAssembly>
<dependentAssembly name="QualityTools">
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.QualityTools.Common/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.QualityTools.Common.dll" />
</dependentAssembly>
<dependentAssembly name="QualityTools">
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.ExecutionCommon" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.QualityTools.ExecutionCommon/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll" />
</dependentAssembly>
<dependentAssembly name="QualityTools">
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Resource" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.QualityTools.Resource/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.QualityTools.Resource.dll" />
</dependentAssembly>
In your transform file, add a transform to remove all entries with the name "QualityTools"
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly name="QualityTools" xdt:Locator="Match(name)" xdt:Transform="RemoveAll" />
</assemblyBinding>
Note the Transform is RemoveAll, to remove all entries with that name.