SQLite Assembly Error in VS 2010 - sqlite

I'm trying to develop a settings application whererby a developer can download a zip file containing a SQLite database and the relevant DLL's and simple use it by calling Setting.Set and Setting.Get in their code. Using a simple Key/Value pair in the database, this lets users store any setting, for anything.
However, I keep getting the error:
"Could not load file or assembly 'System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The system cannot find the file specified."
...when trying to integrate it into a new test app.
I've tried the
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
<requiredRuntime version="v4.0.20506"/>
</startup>
</configuration>
section in the App.config but this doesn't fix the problem.
I'm trying to make the "plug-in" as easy as possible for the end user/developer for re-usability but this is becoming very tedious indeed! >:-(
Any ideas guys?
Thank you for your help!!

You can start by using the latest System.Data.SQLite assembly:
http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
Somewhere on that page you'll find "Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 4.0)" which should be fine for packaging the System.Data.SQLite assembly with your app.
This should also allow you to not use the useLegacyV2RuntimeActivationPolicy="true" application setting.

Related

Where Does ASP.NET Store Assembly References Other Than web.config?

I am getting the classic exception
Could not load file or assembly 'XXX.Base, Version=11.0.0.0, Culture=neutral, >PublicKeyToken=xxxxxxxxx' or one of its dependencies. The located assembly's >manifest definition does not match the assembly reference. (Exception from >HRESULT: 0x80131040)
The assembly D:\xxx\xxxx\xxx\bin\xxx.xxx.xxx.xxx.dll was found but could not >be loaded.
It might have the same name as the referenced one but different version, >culture or public key token.
I know there are tons of these posts on SO and all over the web, but I have one question to which I have not been able to find an answer. Where else, other than web.config, does an ASP.NET get these version numbers from? In the references section of my app, the version is listed as 9.0.0.0. However, when I compile the app and put into IIS, I'm getting exceptions for the wrong version number.
I have already tried:
recompiling the app,
restarting the server,
restarting IIS,
clearing the ASP.NET temp files
restarting the app pool,
putting a newly recompiled version of the app onto the server,
checking the web.config (I can't even find some of these dlls referenced at all in the web.config file)
checking the packages.config file (it's not in here either)
Are there any other spots where these references are stored? I know that in visual studio I can expand references, but I'm assuming that list is stored in a file somewhere and I'm wondering where that file might be?
Where does my app get the idea that it needs version 11.0.0.0 of the assembly when it's listed as 9.0.0.0 in references?

Could not load file or assembly 'NuGet.Server, Version=2.11.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies

So I have created a NuGet Server via an ASP.Net Web Application following this tutorial: http://nugetserver.net/ which is hosted in IIS. I have placed the files on my D: drive on my server along with my packages.
IIS Sites Virtual Path:
I get the following error when I navigate to the url:
In case the picture is not clear enough, please see below:
Could not load file or assembly 'NuGet.Server, Version=2.11.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Here is my project's web.config file along with my publishing profile:
My target .NET Framework version is 4.6 but the packages themselves are those of an earlier version of .NET. Could this be the problem? I took the project folder and put it on my physical path on my local machine and it works just fine when I run the project in debug mode. Please see screenshot below:
NOTE: I have to hide the package names due to organizational confidentiality policies.
I am pointing to these package files:
D:\Backup\Dropbox\vox_server_01\nuget\Packages
The reason I am creating this NuGet server is because the existing one is buggy.
Could this be a permissions thing to the users group in IIS? This link Could not load file or assembly 'someProject' or one of its dependencies. Access is denied lead me to that question. Any suggestions on how I can get around this?
Update: Here are my package sources below:
I could not replicate your error, but here are some notes how nuget server problems can be solved:
The packagesPath key in web.config can be left blank, as you are already using the default folder \Packages.
When deploying to the server, you might find an error in the line of Access to the path server.cache.bin is denied. Just create a blank file with that name on your server.
Came here because of the same problem. Funny enough, I had my solution named "Nuget.Server" as well. Changing my Assembly name (under project properties) fixed it. Renamed it to "NugetServer"
If in your Web.config you have a reference to this NuGet.Server package, delete it from the file and try running again. Fairly similar to a BadImageFormatException from a bad reference in the web.config

app_code find assemblyqualifiedname of class

I have been following Scott Gutheries Blog on how to auto start an ASP.Net application and have an issue with assembly names.
Firstly the web site that I have been following is:
http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx
I have added the following code to my applicationHost config file, and as you may have guessed it does not work because of the type definition.
<serviceAutoStartProviders>
<add name="PreWarmMyCache" type="MyWebSiteName.PreWarmCache, MyWebSiteName" />
</serviceAutoStartProviders>
I have hunted around for a solution and came across this neat code.
Dim _a as New MyApp.PreWarmCache()
_a.GetType().AssemblyQualifiedName
This produces the following result.
"MyApp.PreWarmCache, App_Code.<#########>, Version=0.0.0.0, Culture=neutral, PublickKeyToken=null"
My problem comes from the ######### in the above assembly name as it is unique each time it is run and therefore I cannot use it in the applicationHost file above.
Is there a way to get that value fixed, so the value becomes fixed and does not change?
If you want control over the assembly name and version number that is generated for the site you should use a Web Application Projects instead of a Web Site Projects in Visual Studio.
You could read about the two types of projects on msdn : Web Application Projects versus Web Site Projects in Visual Studio.
With an application project the assembly name doesn't change for each build and you can easily reference the assembly.
To migrate from one type of project to another you will find advices here : Converting a Web Site Project to a Web Application Project
Add a new Class Library project to your ASP.NET website solution and call it Startup.
Create a new class in this library called "ApplicationPreload" that implements IProcessHostPreloadClient.
Add your new Startup class library as a Reference in your ASP.NET Website
Compile your Solution which will add Startup.dll to your website's Bin directory
Add the following to your applicationHost.config file right under the </sites> section
<serviceAutoStartProviders>
<add name="ApplicationPreload" type="Startup.ApplicationPreload, Startup, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /
</serviceAutoStartProviders>

Creating a Module for IIS 7.*

I currently am attempting to create a UI Module for IIS. I plan on using it on IIS 7 and up.
I have followed several different tutorials.
I used the source from this link for testing after it failed to work the first time.
Creating a UI Module For IIS7 to watch Current Requests
I did more looking here
How to Create a Simple IIS Manager Module
My end goal is to have a button within IIS (as it is in the first link).
I am getting the assembly into the GAC (%windir%/assembly), I checked that.
I then added
<add name="CurrentRequestsUI" type="CurrentRequestsUI.RequestModuleProvider, CurrentRequestsUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=269f1cc1a4bf892b" />
within the moduleProviders section of my administration.config (%windir%/System32/inetsrv/config)
then added <add name="CurrentRequestsUI" /> in the modules section of the same file.
Right now I'm just using sample source to see if I can get that to work before I start my project. I apologize for if I'm posting this in the wrong place. If you want me to provide more information, ask and I will provide it.
My question is how do I add a custom UI Module to IIS?
Thanks in advance for the help!
I had been editing the administration.config file within Visual Studio and Notepad++ (32-bit applications), but I then opened the 'same' file within Notepad (64-bit application). Making changes within Notepad made the changes within the proper file.
Opening 32-bit applications such as Notepad++ and Visual Studio 2010 opened the wrong file
%windir%/SysWOW64/inetsrv/administration.config
Opening 64-bit applications such as Notepad opened the correct file
%windir%/System32/inetsrv/administration.config

Using SMO on web server with ASP.NET

Is it required to have anything SQL Server related installed on a web server in order to make use of SMO? I've built a web app that programmatically creates a SQL Agent job, adds a step (which ultimately fires of dtexec to run an SSIS package), and executes.
This works fine on my local machine which has SQL client tools installed, however when I move to a web server, I get reference issues and I'm starting to think it's due to something not being installed.
Could not load file or assembly 'Microsoft.SqlServer.SqlClrProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
This is a rat hole.
The problem is that once you locate that assembly and copy it to the bin folder of your application it will complain about a completely different one.. or even the same file simply due to missing dependencies.
For more information read this: http://www.sqldbadiaries.com/2010/10/20/how-i-fixed-could-not-load-file-or-assembly-microsoft-sqlserver-smo-version10-0-0-0-issue/
That site lists the files you need and the fact you need to register and gac a few files. Quite frankly, you are much better off just biting the bullet and install the client tools on your web server.
Yes, your application requires this assembly in its bin directory to function. This error means that the server doesn't have the SMO (and its dependant) assemblies.
Back in your solution in Visual Studio, right click on the assembly above, and select/change the "Copy Local" to "True". Copy this for each SMO assembly that you've referenced.
When you publish your application, this will bring those .DLLs on your development machine along in your published bin directory.
Check your web.config file for any references as well
search your code for SqlClrProvider

Resources