TypeLite fresh install doesn't work - typelite

I just installed TypeLite into my project via NuGet, but it doesn't work, and everything I've tried hasn't helped... This is the file that was created after installing:
<## template debug="false" hostspecific="True" language="C#" #>
<## assembly name="$(TargetDir)TypeLite.dll" #>
<## assembly name="$(TargetDir)TypeLite.Net4.dll" #>
<## assembly name="$(TargetDir)$(TargetFileName)" #>
<## import namespace="TypeLite" #>
<## import namespace="TypeLite.Net4" #>
<##output extension=".d.ts"#>
<##include file="Manager.ttinclude"#>
<# var manager = Manager.Create(Host, GenerationEnvironment); #>
<# var ts = TypeScript.Definitions()
.WithReference("Enums.ts")
.ForLoadedAssemblies();
#>
<#= ts.Generate(TsGeneratorOutput.Properties) #>
<# manager.StartNewFile("Enums.ts"); #>
<#= ts.Generate(TsGeneratorOutput.Enums) #>
<# manager.EndBlock(); #>
<# manager.Process(true); #>
This is the error I get:
Severity Code Description Project File Line
Error Running transformation: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at TypeLite.TsModelBuilder.Add(Assembly assembly)
at TypeLite.Net4.TypeScriptFluentExtensions.ForLoadedAssemblies(TypeScriptFluent ts)
at Microsoft.VisualStudio.TextTemplating097C215A707CB07DE5AACDA590F263DF8554A0CCA899B583BF1832F7C0C5D3E595312AE41D3DFD1BB9CA643458AA5D86FE3DBA281ED0000D4B4C1D87EA1DEFFB.GeneratedTextTransformation.TransformText() MyApp S:\MyApp\Scripts\TypeLite.Net4.tt 1
If I choose "Debug T4 template" this is what I get:
Severity Code Description Project File Line
Error Running transformation: System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
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(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
at TypeLite.Extensions.TypeExtensions.GetCustomAttribute[TType](Type type, Boolean inherit)
at TypeLite.TsModelBuilder.<Add>b__4(Type t)
at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
at TypeLite.TsModelBuilder.Add(Assembly assembly)
at TypeLite.Net4.TypeScriptFluentExtensions.ForLoadedAssemblies(TypeScriptFluent ts)
at Microsoft.VisualStudio.TextTemplating097C215A707CB07DE5AACDA590F263DF8554A0CCA899B583BF1832F7C0C5D3E595312AE41D3DFD1BB9CA643458AA5D86FE3DBA281ED0000D4B4C1D87EA1DEFFB.GeneratedTextTransformation.TransformText() in s:\MyApp\Scripts\TypeLite.Net4.tt:line 13
=== Pre-bind state information ===
LOG: DisplayName = System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/
LOG: Initial PrivatePath = NULL
Calling assembly : Breeze.WebApi2, Version=1.5.0.0, Culture=neutral, PublicKeyToken=f6085f1a45e2ac59.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/System.Web.Http.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/System.Web.Http/System.Web.Http.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/System.Web.Http.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/System.Web.Http/System.Web.Http.EXE.
LOG: Attempting download of new URL file:///S:/MyApp/bin/System.Web.Http.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
LOG: Attempting download of new URL file:///S:/MyApp/bin/System.Web.Http/System.Web.Http.DLL.
LOG: Attempting download of new URL file:///S:/MyApp/bin/System.Web.Http.EXE.
LOG: Attempting download of new URL file:///S:/MyApp/bin/System.Web.Http/System.Web.Http.EXE. MyApp s:\MyApp\Scripts\TypeLite.Net4.tt 13
If I add this to the file:
<## assembly name="System.Web.Http.dll" #>
Then I get:
Error Compiling transformation: Assembly 'WebUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' MyApp S:\MyASpp\Scripts\TypeLite.Net4.tt 1
Unfortunately I haven't been able to figure out where that 5.2.2 reference is; everything in my projects is 5.2.3. If I take the file path to my 5.2.3 DLL and put that in (which is c:\packages... from nuget), it works.
I guess my question is why doesn't it find the DLL reference via the project, or is there a better way to do this? I won't want to have to hard-code paths in this file, ideally I wouldn't need to specify them at all, but I don't know how else to do it at this point.

Got the same error. In my case, all the files that I wanted to be handled by typeLite were in the same assembly so I soved the problem by restricting to the one assembly using the following (in the .tt file):
<# var ts = TypeScript.Definitions()
.For(Assembly.GetAssembly(typeof(MyWebProject.SomeClass)));
#>

T4 templates doesn't know anything about packages installed in your project, so it is necessary to add reference to used assemblies manually.
Obviously T4 is trying to load a wrong version of the library. I would check whether your bin folder contains the correct version of the assembly and I would try to reference the library from there.
<## assembly name="$(TargetDir)System.Web.Http.dll" #>

Related

ServiceStack License not found when using NUnit 3 through Console Runner in TeamCity

I am using a valid license key. But I keep getting this error:
ServiceStack.LicenseException : The free-quota limit on '10 ServiceStack Operations' has been reached. Please see https://servicestack.net to upgrade to a commercial license or visit https://github.com/ServiceStackV3/ServiceStackV3 to revert back to the free ServiceStack v3.
So far I have tried the following:
Storing my license key in app.config
Storing my license key in web.config
Adding my key as a System Environment Variable called "SERVICESTACK_LICENSE"
Adding my key as a System Property through TeamCity Build Parameters
Adding my key as a System Environment Variable through TeamCity Build Parameters
Adding my key by calling Licensing.RegisterLicense before running AppHost.Init
When adding my key as a System Environment Variable through TeamCity Build Parameters I instead get an exception from JsConfig:
System.TypeInitializationException : The type initializer for 'ServiceStack.Text.JsConfig' threw an exception.
----> System.TypeInitializationException : The type initializer for 'ServiceStack.LicenseUtils' threw an exception.
----> System.IO.FileLoadException : Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at ServiceStack.Text.JsConfig.InitStatics()
at ServiceStack.AppHostHttpListenerPoolBase..ctor(String serviceName, Int32 poolSize, Assembly[] assembliesWithServices) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\AppHostHttpListenerPoolBase.cs:line 75
at ServiceStack.AppSelfHostBase..ctor(String serviceName, Assembly[] assembliesWithServices) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\AppSelfHostBase.cs:line 13
at Alstra.SG.Tests.AppSelfHost..ctor() in C:\TeamCity\buildAgent\work\a0903bf22b2d1e1c\Test\AppSelfHost.cs:line 31
at Alstra.SG.Tests.Private.BaseIntegrationTest..ctor() in C:\TeamCity\buildAgent\work\a0903bf22b2d1e1c\Test\Private\BaseIntegrationTest.cs:line 16
at Alstra.SG.Tests.Private.Integration.RespondentServiceTests..ctor()
--TypeInitializationException
at ServiceStack.LicenseUtils.Init()
at ServiceStack.Text.JsConfig..cctor() in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\JsConfig.cs:line 21
--FileLoadException
at System.MemoryExtensions.AsSpan(String text)
at ServiceStack.Text.Jsv.JsvReader`1.Parse(String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Jsv\JsvReader.Generic.cs:line 81
at ServiceStack.Text.TypeSerializer.DeserializeFromString[T](String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\TypeSerializer.cs:line 67
at ServiceStack.LicenseUtils.ToLicenseKeyFallback(String licenseKeyText) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\LicenseUtils.cs:line 446
at ServiceStack.LicenseUtils.RegisterLicense(String licenseKeyText) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\LicenseUtils.cs:line 252
at ServiceStack.Net45PclExport.RegisterLicenseFromConfig() in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\PclExport.Net45.cs:line 140
at ServiceStack.LicenseUtils..cctor() in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\LicenseUtils.cs:line 135
When adding my key by calling Licensing.RegisterLicense before running AppHost.Init I get the following exception instead:
System.IO.FileLoadException : Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at System.MemoryExtensions.AsSpan(String text)
at ServiceStack.Text.Jsv.JsvReader`1.Parse(String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Jsv\JsvReader.Generic.cs:line 81
at ServiceStack.Text.TypeSerializer.DeserializeFromString[T](String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\TypeSerializer.cs:line 67
at ServiceStack.LicenseUtils.ToLicenseKeyFallback(String licenseKeyText) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\LicenseUtils.cs:line 446
at ServiceStack.LicenseUtils.RegisterLicense(String licenseKeyText) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\LicenseUtils.cs:line 252
at Alstra.SG.Tests.Private.BaseIntegrationTest..ctor() in C:\TeamCity\buildAgent\work\a0903bf22b2d1e1c\Test\Private\BaseIntegrationTest.cs:line 17
at Alstra.SG.Tests.Private.Integration.ActivityServiceTests..ctor()
Happy to get some help!
I believe the version of ServiceStack you are using was built with a different version of System.Runtime.CompilerServices.Unsafe than what you are using in your Test project and because bindingredirect are not working in this context.
See Does redirecting assembly binding work for unit testing with a test runner?
As a workaround, you can try changing System.Runtime.CompilerServices.Unsafe in Nuget Package Manager to 4.5.2.
This version matches the missing assembly, Version=4.0.4.1.
Edit: If you are using NUnit 3 in your NUnit build step, you can then specify "Path to application configuration file: " to point to your app.config.
This should solve the root problem and let you use the most current version of your Nuget packages (since the correct bindingRedirects will then be applied).

Cake NuGetRestore always wants MSBuild14?

While trying to rig up a solution to build with Cake v0.19.1 on a machine that has only ever known Visual Studio 2017, I can't seem to get NuGetRestore to accept a setting of MSBuildVersion = NuGetMSBuildVersion.MSBuild15.
Is there some magic step to getting a specific MSBuild version into NuGetRestore that I am missing?
Output
...
========================================
RestoreNuGet
========================================
Executing task: RestoreNuGet
Failed to load msbuild Toolset
Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
An error occurred when executing task 'RestoreNuGet'.
Error: NuGet: Process returned an error (exit code 1).
Trimmed-down build.cake
var target = Argument("target", "Default");
var solution = "./some-random.sln";
Task("Default")
.Does(() => {
NuGetRestore(
solution,
new NuGetRestoreSettings {
MSBuildVersion = NuGetMSBuildVersion.MSBuild15,
}
);
});
RunTarget(target);
Update: getting NuGet v4
Per #devlead's answer, I pointed the build.ps1 file at the v4.0.0 of NuGet and got this output.
Cannot find the specified version of msbuild: '15'
An error occurred when executing task 'RestoreNuGet'.
Error: NuGet: Process returned an error (exit code 1).
In my full build.cake, I use vswhere for later MSBuildSettings which I can get to dump out the MSBuild path it found (and I confirmed that exe exists in Explorer).
C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/amd64/MSBuild.exe
What you could try is to use the MSBuild alias with the restore target, latest version of MSBuild should have build in NuGet support.
MSBuild(
"./some.sln",
configurator => configurator.WithTarget("restore"));
Make sure you're using the latest version of NuGet.exe, currently it's
v4.0.0 which is the latest version, but you can also see a list of available at https://dist.nuget.org
If you're using the default build.ps1 you could modify it to always download specific version of NuGet.exe
You can do this be remove the Test.Path parts - so it won't look for nuget.exe any where else but your tools folder.
Then change the download uri to not use latest stable (currently v3.5.0) but a specific version by in build.ps1 changing
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
to
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/v4.0.0/nuget.exe"
will ensure you always download v4.0.0 of the exe.
It's also possible with a little PowerShell to verify correct version in tools, example
if ((Get-ChildItem $NUGET_EXE `
| % VersionInfo `
| % ProductVersion `
| ? { $_ -eq '4.0.0' }|Measure-Object).Count -eq 1)
{
'Correct version'
} else {
'Incorrect version'
}

Using BSON type provider in F# Script

I'm trying to use the Bson type provider to do some work with a MongoDB database. in an F# script.
I've taken the following steps.
I've created the Bson files by using:-
mongodump /host:starbug /db:Logger /out:data
I've built the type provider from the source from https://github.com/visemet/FSharp.Data.Bson
I've created the following F# script file:
#I "../../FSharp.Data.Bson/bin" // Location of Dll's created by step 1.
#r "FSharp.Data.Bson.Runtime.dll"
#r "FSharp.Data.Bson.dll"
#r "MongoDB.Bson.dll"
open BsonProvider
type AccessLogs = BsonProvider<"./data/EkmLogger/access_logs.bson">
type SQLiteLogs = BsonProvider<"./data/EkmLogger/sqlite_logs.bson">
let accessLogs = AccessLogs.GetSamples().[0]
But the last line is showing the following error in VS 2013
The type provider 'BsonProvider.ProviderImplementation.BsonProvider' reported an error in the context of provided type 'BsonProvider.BsonProvider,Path="./data/Logger/access_logs.bson"', member 'GetSamples'.
The error: Could not load file or assembly 'FSharp.Data.Bson.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The system cannot find the file specified. C:\Development\fsharp-scripts\Logger\AccessSqliteStats.fsx
Any idea what's wrong?

Crystal report fails to load when application is deployed in IIS

I copied the packageTmp over to the inetpub/wwwroot, then added a website and included it as my path.
Installed the crystal report runtime, CRRuntime_32bit_13_0_4 - but still did not work.
I also have crystalreportviewers13 folder in wwwroot/aspnet _client/systemweb/4_0_30319
This is the error I encountered when I go to the page with crystal report. May i know where the path is defined? This problem occurs when I deploy my application in IIS.
Exception Details: System.Runtime.InteropServices.COMException: Invalid file name.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[COMException (0x800001fb): Invalid file name.]
CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +95
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +270
[CrystalReportsException: Load report failed.]
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +333
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +877
CrystalDecisions.CrystalReports.Engine.ReportClass.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob) +1183
CrystalDecisions.CrystalReports.Engine.ReportDocument.EnsureLoadReport() +113
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) +53
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)
....
This is the .cs code behind the .aspx code,for reportxx.rpt
m_reportxx = new reportxx();
CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
DataTable dt = data.GetReport();
reportxx.SetDataSource(dt);
CrystalReportViewer1.ReportSource = m_reportxx;
I tried this and it worked while debugging in the visual studio environment.
I know this is an old post. but For anyone still looking for the answer:
You need to register crystal reports in page markup
<% # Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
Set the property 'Copy to Output Directory' of the report to 'Copy always'
the path of the file in the crystalreportsource will be ~/bin/YOURFOLDER/YOURFILE
<CR: CrystalReportSource ID ="CrystalReportSource1" runat ="server">
<Report FileName="~/bin/oilmovement/rptOMDayEnd.rpt">
</Report>
</CR: CrystalReportSource>
Now the report should work
In my case, I found by 2 days the error and not see nothing wrong...Finally I used Procmon.exe (https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx?f=255&MSPPError=-2147217396) to trace the error.
I Filter by Result + is not + SUCCESS, I tried to run again the web application and appear the Error: ACCESS DENIED to Folder X.
I give the right permission to X folder and works fine.

Running nunit-console on a solution file leads to System.IO.FileLoadException

When I try to use nunit-console.exe to run all the tests in a solution file as such:
nunit-console.exe MyProject.sln
I get the following exception (shown below). However when run the console runner on ANY of the projects in my folder structure, the runner works just fine and never gives me the following exception. I also am pretty certain that the version of the nunit library that I am linking to is the same as the runner that I am using. Also, my solution doesn't reference any projects that are outside the directory structure containing my .sln file.
Does anyone have any clue what I can do!? :(
Thanks!
Phil
NUnit version 2.5.10.11092
Copyright (C) 2002-2009 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
CLR Version: 4.0.30319.1 ( Net 4.0 )
ProcessModel: Default DomainUsage: Default
Execution Runtime: net-4.0
Unhandled Exception:
System.IO.FileLoadException: Could not load file or assembly 'nunit.framework, Version=2.5.10.11092, Culture=neutral, Pu
blicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the
assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77'
Server stack trace:
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount,
IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInsta
ntiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHa
ndle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethod
Arguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope
, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilte
rType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMeth
odInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken,
Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecorate
dTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at NUnit.Core.CoreExtensions.InstallAdhocExtensions(Assembly assembly)
at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server,
Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExec
uteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NUnit.Core.TestRunner.Load(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
at NUnit.ConsoleRunner.Runner.Main(String[] args)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Try using the Fusion Log Viewer to see what assembly is failing to load. It should tell you not only what file it is failing on, but where it tried looking for that file.
In my case nunit-console.exe did not respect the assembly redirection from web|app.config. unless you provide /domain=multiple
My Problem:
EntityFrameworkTesting.Moq -> requests Moq, Version=4.2.1409.1722
I had already a newer assembly referenced.
The solution for me was to add /domain=multiple parameter. see the NUnit docs
So I run:
D:\tools\NUnit-2.6.4\bin\nunit-console.exe %SOLUTION_PATH%\Project.sln /config:Release /framework:net-4.0 /domain=multiple /xml=nunit-result.xml