FluentNhibernate and SQLite - unit-testing

I can't get SQLite Driver working in my sessionfactory.
I downloaded SQLite 1.0.48 from http://sqlite.phxsoftware.com/
I have added the references to System.Data.SQLite in my Tests project.
public static IPersistenceConfigurer GetSqlLiteConfigurer()
{
try
{
return SQLiteConfiguration
.Standard
.InMemory();
}
catch (Exception ex)
{
throw ex;
}
}
This is how I generate the Configurer
The problem is when I build my sessionfactory I get the following 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 <qualifyAssembly/> element in the application configuration file to specify the full name of the assembly.
at NHibernate.Driver.ReflectionBasedDriver..ctor(String driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.SQLite20Driver..ctor()
I have tried to change of SQLite version but did not fix the issue.
I can't find what's the problem and I have been working on this for 2 days now.
Let me know if you need more information.
Thanks for the help!
Charles

When I ran into this issue it was caused by running having my application's processor property set to anycpu and running on a 64bit system. To correct the issue I set my application processor property to x86.
I don't think the System.Data.SQLite.dll supports running under a x64 process.

I have fixed my problem by getting the System.Data.SQLite.dll file that is in the FluentNHibernate SVN Repository.
This is now working very well.
I should have checking this earlier ;)

Check, if you are using 4.0 as your target framework. The ADO-driver currently (1.0.66) supports only 3.5.

I am hitting the same problem on a build machine. It works fine when I open the project with Visual Studio, but when I run mstest.exe it fails with the above error. It also fails on my local development machine when I run by command line. Process Monitor shows no attempts to even locate the file by mstest.exe.
The build machine is 32-bit, my local machine is 64-bit. The assembly we are using is the one from the Fluent NHibernate trunk.
UPDATE: Figured it out - mstest.exe wasn't copying all of the assemblies when it was being run from the command line. I updated the localtestrun.config to include them under Deployment. Not sure why the behaviour is different from the IDE and command line test runner.

This issue should be fixed with the lastest NuGet package from Microsoft.
PM> Install-Package SQLitePCL
https://www.nuget.org/packages/SQLitePCL/3.8.2
http://msopentech.com/blog/2014/02/03/new-open-source-portable-class-library-sqlite/

Related

How to - Get Oracle.ManagedAccess driver to work with Installed VB.Net Application

I have a 32bit Application to Install on Win10 (x64 OS). All my Oracle functionality works from within the debugger. Oracle.ManagedAccess driver is correctly registered in the VS Projects and the application works as expected from within the debugger. However, when I build my WiX-Based install pack and run the installed application I get the following error:
What am I missing here? In the previous VS2013 incarnation of the code as recently as last month using the ODP.NET driver 'Oracle.DataAcess', the application worked fine when installed. I'm at a loss as to where else to take this. Any assistance most welcome.
Based on input from Stein Asmul, I jave resolved the problem. Solution simply involved including the Oracle.ManagedDataAccess.ddl in the product.wxs depositing the file in the application folder solved the problem.

Building Django on Visual Studio Online

I'm working on a Django (1.8.6) project and using Visual Studio Online's GIT source control. I am building the application successfully in my local environment and push the changes to the VSO. However, whenever I try to build the application on VSO to be able to benefit from "Continuous Integration" as a next step (will try to deploy Azure), it fails by giving the error below:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Python
Tools\Microsoft.PythonTools.Web.targets (235, 5) The environment 'env
(Python 3.4) (unavailable)' is not available. Check your project
configuration and try again.
Unexpected exit code received from msbuild.exe: 1
My build definition on VSO:
Build Definition Screenshot
Python Version: 3.4.3
VS Version: 2015
Any suggestions regarding to my case is highly appreciated.
This is a known issue for PTVS. MS is still working on it. Refer to this thread for details: https://github.com/Microsoft/PTVS/issues/128
There is a workaround in that thread you may use, I quote it here. The second link is unavailabe now, but the first one still works.
For deployment via PowerShell, I found this, which looks correct
AFAIK.
http://www.kenneth-truyers.net/2014/02/06/deploying-cloud-services-to-azure-with-powershell/
You can also use the Python Azure SDK to deploy, but that's not as
well documented. This is what this test does:
https://github.com/Azure/azure-sdk-for-python/blob/master/tests/test_servicemanagementservice.py#L940
Both of these assume that you are able to create the .cspkg, as that's
the file you have to upload to blob storage.

Microsoft Fakes: Team Build throws IO file not found exception

I am using Microsoft Fakes for my unit testing. On my local dev machine, i can create a fake assembly of a class library and everything works fine. But when check-in the team build on the build server throws
"System.IO.FileLoadException: Could not load file or assembly 'Business.DataAccess.Core, Version=19.0.0.9999, Culture=neutral, PublicKeyToken=925fe695533b6fca' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
In my local dev machine 'Business.DataAccess.Core.dll' version is 19.0.0.9999, but on the build server it will be get a proper version number such as 19.0.0.1250.
Business.DataAccess.Core.fakes xml file is as follows. I have removed the version tag.
<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/">
<Assembly Name="Business.DataAccess.Core" />
</Fakes>
I tried both by committing FakeAssemblies folder and not committing it. In both times its not working. My assumption was that fake assemblies will be created at compile time. But it's not working.
How can i get team build to run my unit tests using Microsoft Fakes.
When i fake just the EntityFramework.dll and commit the fake assemblies it works. This proves our build server is equipped with testing MS fakes. Build server has got VS 2013 ultimate version installed.
Much Appreciated!!!
The problem was with 'Business.DataAccess.Core.dll' getting a new version on the build server.
So, To fix this problem, removed 'GlobalAssemblyInfo.cs' file from the project and then in 'AssemblyInfo.cs' added a version.
I had to check-in FakeAssemblies folder with the fake assembly as well for this to work.

Running SpecFlow Report - ERROR - The attribute "Label" in element <Target> is unrecognized

I have been following the tutorial found here for a SpecFlow test report generator.
My issue is, when I run the tool, I receive the following message:
The attribute "Label" in element Target is unrecognized
I've found a few possible solutions, none of which have worked e.g. here
I am able to show that I am running version 4.x as when I run MSBuild using the Visual Studio 2012, command prompt I can see the following:
Microsoft (R) Build Engine version 4.0.30319.17929 [Microsoft .NET
Framework, version 4.0.30319.18052]
I have created a config file as suggested here
but unfortunately I am still getting the error. The project is running locally off git and this issue has been fixed in the past by using the config file, however since swapping to a VMware Virtual machine, it is now occurring again.
I have also right clicked > Properties which states that the file is using .NET 4.0, in addition created a Environment Variable linking directly to the MSBuild directory. I've spent a good while browsing the internet and cannot get this working. Please help!
Many thanks for any help you can provide,
Cheers!
Solved this with the internal devs. There was some problem with the Chromedriver update script which had been added by (I'm assuming NuGet)
Starting
<PropertyGroup Label="DownloadChromeDriverBuildTask">
and also:
<Target Name="DownloadChromeDriver" Label="DownloadChromeDriverBuildTask">
It was a small script that was installing ChromeDriver if it was not already available. Removing this seems to have resolved it. Hope this provides help to anyone with a similar issue.

How to build a VS2010 C++ Project on a BuildServer

I've a .NET Solution with a managed C++ assemlby Targeting .NET 3.5 created with VS2010. The command:
%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe MyProject.sln
compiles the solution on my dev machine.
On my BuildServer I get this error:
Build FAILED.
"F:\CruiseControl.NET\Projects\MyProject\MyProject.sln"
(default target) (1) ->
"F:\CruiseControl.NET\Projects\MyProject\MyProject\MyProject.csproj"
(default target) (2) ->
"F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj"
(default target) (3) ->
F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj(23,3):
error MSB4019: The imported project
"C:\Program
Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props"
was not found. Confirm that the path
in the <Import> declaration is
correct, and that the file exists on
disk.
0 Warning(s)
1 Error(s)
On my dev machine the claimed file
"C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props"
exists. On my build server not.
When I try to copy this files (and all others in the same directory) other errors occurred. So this is the wrong way.
EDIT: other errors means: When I copy the file "Microsoft.Cpp.Default.props" on the build server, MSBuild is claiming other files. That shows me, that just doing a copy of missing files is not what the build environment is expecting. I am looking for an MSI/whatever package that I could install on my build server and any C++ Project will build. Installing the SDK did not the trick. Or I did something wrong during SDK installation. Or it is not possible to compile Managed C++ VS2010 Solutions just with the SDK.
I believe that "other errors" has nothing to do with my problem. My Problem is: "How do I setup my build environment correctly". /EDIT
What I've done till now:
I have installed the latest Win7 SDK (Link)
I am targeting .net 3.5
I've tried playing with the Platform Toolset Property - but it was just playing
In my solution there is a managed C++ Assembly (my Problem)
I am using MSBuild 4.0 because the new VS2010 project files cannot be compiled with MSBuild 3.5
I am using CC.NET. compilation fails in CC.NET and on the command line. So it should not be a CC.NET issue.
Are there any tips and tricks how to configure my project properly to compile on my dev machine with VS2010 and on my build server? Is there anything more to install (except VS2010)?
Thanks, Arthur
For now, installing VS 2010 is your only safe option. The Windows SDK will be updated to enable your scenario, but I don't have a specific release date. Until then, you'll need to install VS 2010 with the C++ tools in order to build your 2010 solution with C++ projects. Make sure you let the C++ team know about how dissatisfaction with this situation via their team blog and/or MSDN Forum.
Even after installing VS 2010, you may need to invoke the appropriate vcvars*.bat file to setup your environment variables correctly.
Why don't you want to install VS2010 on your build server? If it's licencing, it's licenced per developer head not per install so I'm reasonably sure you are allowed to without buying another copy - or, at worst, you can install the express version which ought to at least install the config bits you're missing so you can use the platform SDK compiler.
If you're still having problems with msbuild you can then use devenv.com /build which exactly replicate the VS build env.
You may try those links:
http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/9055ca52-586b-459f-9dd1-a9d052d076b9/
or
http://msdn.microsoft.com/en-us/library/ee662426.aspx