Running Nh 3.2 using SQLite throws the following exception:
---> NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
I use the latest (net 4 compatible) version of SQlite: version 1.0.74.0. I have added the following to my config:
.Database(SQLiteConfiguration.Standard.InMemory().Raw("hbm2ddl.keywords", "none").ShowSql())
I, also added in the config file:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
The weird thing is that first it worked. And now I get the above error.
I fixed the issue using the solution provide above (thanks), but also figured out that by using nuget you can simply install System.data.sqlite straight to your project via the package manager, and you dont need any of the web.config settings.
Install-Package System.Data.Sqlite.x86
You probably know this, but just in case. Latest version of SQLite for .NET is distributed as 2 dlls.
System.Data.SQLite.dll
SQLite.Interop.dll
Both dlls need to be present in the same folder as your EXE. Interop dll is platform specific so you have to manually (or Post-build) copy x86 or x64 version. One thing to keep in mind is that SQLite.Interop.dll depends on MSVCR100.DLL. This is part of Visual C++ 2010 SP1 Redistributable Package, you need to make sure that you have it. Please see this answer.
Also in the web environment you might need this configuration:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite"/>
<add
name="SQLite Data Provider"
invariant="System.Data.SQLite"
description=".Net Framework Data Provider for SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"/>
</DbProviderFactories>
</system.data>
use the version that came with fluentnhibernate binaries 1.0.60.0
Related
I am trying to install the trail version of Sitefinity but running into this error
Server Error in '/' Application.
________________________________________
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'MySql.ConnectorInstaller, Version=6.10.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 284: <siteMap>
Line 285: <providers>
Line 286: <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.ConnectorInstaller, Version=6.10.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
Line 287: </providers>
Line 288: </siteMap>
Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line: 286
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.ConnectorInstaller, Version=6.10.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.
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].
________________________________________
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2623.0
I see the database was made though I choose SQL Sever not mysql, so I am not sure why this error is talking about MySql.
Looks like the error is coming from your machine.config file. I definitely don't have that value in neither machine.config nor the Sitefinity's web.config file.
Maybe try deleting it and restart IIS.
I have a .Net Core API project.
It must use some 3rd party library for .Net Framework (not compatible with net core) so we have changed in the .csproj the TargetFramework property from "netcoreapp2.0" to "net47":
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<!-- <TargetFramework>netcoreapp2.0</TargetFramework> -->
<TargetFramework>net47</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
```
Everything is working fine apart from the fact that I'm not able to create test projects on this.
I like to use NUnit.
I tried to create .net core test project (using both MS Unit Test and XUnit) but them are both unable to run the test.
"Run test" is simply ignored.
I created also a .Net Framework test project and in this case I have an error at runtime when the test try to use some classes from the "fake" .Net Core project.
The error is this:
Message: System.BadImageFormatException : Could not load file or assembly 'MyCompany.ProjectA.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Another developer that use ReSharper can run the test created with .Net Core without any problem.
It is discovered (using ReSharper) and it can be debugged.
Please do not suggest me to NOT use "net47" in the project file.
It is not an option.
Additional info.
The test project is loading the correct packages:
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
<PackageReference Include="NUnit" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
same problem (test dot discovered or ignored on "run") adding these:
<PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.2.0" />
When the test is ignored the error in the console is this:
[19/02/2018 16:01:28 Warning] Exception System.InvalidOperationException, Exception thrown executing tests in D:\Data\GIT\MyCompany.ProjectA.UnitTests.API_2\bin\Debug\net47\MyCompany.ProjectA.API.dll
[19/02/2018 16:01:28 Warning] Operation is not valid due to the current state of the object.
[19/02/2018 16:01:28 Warning] at Mono.Cecil.ModuleDefinition.ProcessDebugHeader()
at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader)
at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters)
at Mono.Cecil.ModuleReader.CreateModuleFrom(Image image, ReaderParameters parameters)
at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
at NUnit.VisualStudio.TestAdapter.NavigationDataProvider.CacheNewTypes(String assemblyPath, IDictionary`2 types) in C:\Users\Terje\Source\Repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NavigationDataProvider.cs:line 103
at NUnit.VisualStudio.TestAdapter.NavigationDataProvider.GetNavigationData(String className, String methodName) in C:\Users\Terje\Source\Repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NavigationDataProvider.cs:line 48
at NUnit.VisualStudio.TestAdapter.TestConverter.MakeTestCaseFromXmlNode(XmlNode testNode) in C:\Users\Terje\Source\Repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\TestConverter.cs:line 144
at NUnit.VisualStudio.TestAdapter.TestConverter.ConvertTestCase(XmlNode testNode) in C:\Users\Terje\Source\Repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\TestConverter.cs:line 79
at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, TestFilter filter) in C:\Users\Terje\Source\Repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 249
[Solution]
I've removed the RID from the API project and the is found and run.
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
I tried to change it to "win-x86" or to change the test project from non-selection (= any CPU) to x86 or x64.
None of these is a good solution.
I think you're having a 32-bit / 64-bit conflict, you can see this answer: Could not load file or assembly ... An attempt was made to load a program with an incorrect format (System.BadImageFormatException)
I'm trying to figure out how ASP.NET 5 Web API supports Content Negotiation. In order to support XML (in addition to the default JSON support), according to another answer here on Stack Overflow, I need to add that support from an optional NuGet package.
Things have changed a bit since that answer, but I pulled down the Microsoft.AspNet.Mvc.Xml package and edited my Startup.cs file:
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc().AddMvcOptions(options =>
{
options.InputFormatters.Add(new XmlSerializerInputFormatter());
});
}
This, however, doesn't compile:
The type 'InputFormatter' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.AspNet.Mvc.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null'.
Here are the full compilation error messages:
1>C:\Users\mark\Desktop\WebApplication1\src\WebApplication1\Startup.cs(33,17,33,44): DNX 4.5.1 error CS0012: The type 'InputFormatter' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.AspNet.Mvc.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null'.
1>C:\Users\mark\Desktop\WebApplication1\src\WebApplication1\Startup.cs(33,45,33,78): DNX 4.5.1 error CS1503: Argument 1: cannot convert from 'Microsoft.AspNet.Mvc.Xml.XmlSerializerInputFormatter' to 'Microsoft.AspNet.Mvc.Formatters.IInputFormatter'
1>C:\Users\mark\Desktop\WebApplication1\src\WebApplication1\Startup.cs(33,17,33,44): DNX Core 5.0 error CS0012: The type 'InputFormatter' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.AspNet.Mvc.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null'.
1>C:\Users\mark\Desktop\WebApplication1\src\WebApplication1\Startup.cs(33,45,33,78): DNX Core 5.0 error CS1503: Argument 1: cannot convert from 'Microsoft.AspNet.Mvc.Xml.XmlSerializerInputFormatter' to 'Microsoft.AspNet.Mvc.Formatters.IInputFormatter'
The error message seems fairly clear, but the project already includes Microsoft.AspNet.Mvc.Core, although not quite in the desired version:
Id Versions
-- --------
Microsoft.AspNet.IISPlatformHandler {1.0.0-rc1-final}
Microsoft.AspNet.Mvc {6.0.0-rc1-final}
Microsoft.AspNet.Mvc.Core {6.0.0-rc1-final}
Microsoft.AspNet.Mvc.Xml {6.0.0-beta5}
Microsoft.AspNet.Server.Kestrel {1.0.0-rc1-final}
Microsoft.AspNet.StaticFiles {1.0.0-rc1-final}
Microsoft.Extensions.Configurati... {1.0.0-rc1-final}
Microsoft.Extensions.Configurati... {1.0.0-rc1-final}
Microsoft.Extensions.Logging {1.0.0-rc1-final}
Microsoft.Extensions.Logging.Con... {1.0.0-rc1-final}
Microsoft.Extensions.Logging.Debug {1.0.0-rc1-final}
As I'm writing this, ASP.NET 5 is only available in a Release Candidate version, so the above packages are the most recent available.
Clearly, Microsoft.AspNet.Mvc.Core 6.0.0.0 isn't available. In a normal .NET project, I'd attempt to solve this issue with a binding redirect, but since this is ASP.NET 5, that's apparently no longer the way to do things.
How can I make my code compile?
I believe you have to use the Microsoft.AspNet.Mvc.Formatters.Xml package instead. Also see this issue on github.
Also a hot tip: Use http://packagesearch.azurewebsites.net/ to search for which NuGet-package contains the class you are looking for.
currently I have a problem with getting a DLL into the Windows GAC. I tried to follow the steps of creating a DLL and loading it as described in this blog post:
http://blogs.technet.com/b/cloudpfe/archive/2014/02/01/how-to-create-a-custom-authentication-provider-for-active-directory-federation-services-3-0-part-2.aspx
At the point where I try calling the following command:
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7514a164b89fa979")
I get an error which tells me that System.EnterpriseServices could not be found:
Exception calling "Load" with "1" argument(s): "Could not load file or
assembly 'System.EnterpriseServices, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=7514a164b89fa979' or one of its dependencies. The
system cannot find the file specified."
The specified DLL (System.EnterpriseServices) does exist* on the machine.
So now my question is, why can't this method find the DLL and what do I have to do/change to get this command to work?
NOTE: I Tried this on a vanilla Windows Server 2012 R2 with just ADFS parts installed; And I've called the command from the Powershell.
*UPDATE: The System.EnterpriseServices DLL resides in
C:\Windows\Microsoft.NET\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a
and
C:\Windows\WinSxS\amd64_system.enterpriseservices_b03f5f7f11d50a3a_4.0.9600.16384_none_53a3f9b13fac0ba5\
So it should be available from the GAC.
I think your public Key token is incorrect, you found your own answer with your update :) .
It should be
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
Give this a try.
I have a VS2005 web application I am using the MySQL active record templates and is perfectly working in VS2008 however I get this error:
Custom tool error: An Exception was thrown while running the transformation code. The process cannot continue. The following Exception was thrown:
System.Runtime.Serialization.SerializationException: Type 'Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService' in Assembly 'Microsoft.VisualStudio.TextTemplating.VSHost, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.
View Full Exception Details:
http://pastebin.com/rF8iQJW2
I have the following packages installed to make it work for vs2005:
http://goo.gl/uINkV
Guidance Automation Toolkit for Visual Studio 2005 - February 2008 Release
http://goo.gl/OEUNP
Guidance Automation Extensions - February 2008 Release
Subsonic 3.0 doesn't work for VS2005 as it requires .NET framework 3.5
Previous answer is not correct. The T4 system now runs out of process and sets up an Ipc channel back to the Host. This transport channel ( based on remoting ) uses a Binary serializer and cannot transport the Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService over that channel because it is not marked as serializable, exactly as the exception message says.
Incidently, you can get access to this service by changing the template directive hostspecific="true" and accessing the "Host" property.
There are also some parts of the EnvDTE.DTE that cannot be accessed via T4 templates for the same reason ( like DTE.Windows or DTE.WindowConfiguration ).