I am trying to write a windows service(My first windows service) that uploads a file to sftp using SshNet. When i install and debug the service i get the error:
Could not load file or assembly 'Renci.SshNet, Version=2013.4.7.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.
I think when i build the application the reference is not being copied to the exe file. Not sure though. Any help would be great. Also I added the reference with nuget if that helps.
Related
I am trying to write an SSIS package programmatically using C#.
I have installed SQL Server Integration Services Projects v16 and added all the references like Microsoft.SqlServer.ManagedDTS and using Microsoft.Dts.Runtime.
However, at runtime, I am getting an error:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.SqlServer.DTSRuntimeWrap, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.'
I tried to manually add the DLL "Microsoft.SqlServer.DTSRuntimeWrap" from "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\SSIS\160\Binn" but it throws the same error.
My Microsoft SQL Server Integration Services Projects is version 16.0.5035.3 and hence, I added the reference from the \160\Binn.
However, it seems that the code is asking for another version (Version=13.0.0.0).
Can someone please tell me what's going wrong?
Much appreciated!
I am using PdfSharpCore version 1.3.40 in a MVC ASP.Net netcoreapp2.1 and it works perfectly on my windows localhost, but when I publish it on a server Linux running Apache the follow exception occurs:
Could not load file or assembly 'PdfSharpCore, Version=1.3.40.0, Culture=neutral, PublicKeyTo ken=null'. The system cannot find the file specified.
I already checked that the PdfSharpCore dll is there, but the system couldn't find it.
Does anyone know what's going on?
We managed to solve the problem, we were forgetting to replace the .deps.json file that contains the dependencies with the new PdfSharpCore.dll dll included in the project. Solved!
I've created a webjob with a simple C# Console application. I make use of the Azure blobs and a database connection - locally everything works like a charm.
In Azure portal I've made a simple app where I added my exe and force it to run. From the logs i get:
[10/09/2016 20:38:52 > ed5cb9: ERR ] Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Don't mind the 6.0.0.0 version, I've tried 7.0.0.0 and the latest 7.2.1, the result does not differ.
Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
According to the error you provided, I recommend that you could try to make sure the specific assembly is deployed to Azure. You could use Kudu Console (Can be accessed from Azure : App Service > Web App> Development Tools > Advanced Tools)
and check your assembly in the following path:
d:\home\site\wwwroot\app_data\jobs\[triggered|continuous]\{job name}
Additionally, if you deploy your WebJob via the Azure Portal, you could directly upload a zip file that contains the WebJob's files. For more details about Web Jobs, you could follow this tutorial.
I have a ASP.Net application which references an assembly with some re-usable code (common utils, data access, etc.). The assembly references IBM.Data.DB2.dll. However, I am not using DB2 in my application, the IBM.Data.DB2.dll is simply a dependency (in case an app needs to connect to DB2). Recently, i've run into the following error:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ReportingServices.Interfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.ReportingServices.Interfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
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 Unity.AutoRegistration.AutoRegistration.<ApplyAutoRegistration>b__5(Assembly a)
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Unity.AutoRegistration.AutoRegistration.ApplyAutoRegistration()
The only file in the entire application that contains Microsoft.ReportingServices.Interfaces is the IBM.Data.DB2.dll file. I do not have any need of SQL Server or the overhead of a SQL Server installation locally much less on the server when the app is deployed. Bear in mind I am required to use the assembly which has the dependency on IBM.Data.DB2.dll and this error has not happened in the past, it seems to be recent.
I have tried binding redirects, installed Microsoft.ReportingServices.Interfaces via Nuget all to no avail.
Would anyone know why this error is occurring and more importantly....how to resolve it?
If IBM.Data.DB2.dll references Microsoft.ReportingServices.Interfaces, you will probably have to manually copy Microsoft.ReportingServices.Interfaces.dll into your bin folder. Here is a post that can help you with that:
Microsoft.ReportingServices.Interfaces.dll missing for SSRS 2005
I have created a windows service in C# VS2008 that uses a reference to an external class library to wrote. I have added the reference to it in VS2008. When I run start the service it throws an exception when trying to access the external DLL:
Could not load file or assembly 'vcribAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
The DLL is in the same directory as the service.exe file. Is there something special that I need to do for windows services like putting the DLL in another directory?
It could be that vcribAPI.dll relies on other assemblies as well. I suggest using Reflector and open up the dll to see what other dll's it might reference.
I encountered exactly the same error.
The working directory of services is different from the application directory (typically C:\Windows\System32).
For example, the method AssemblyName.GetAssemblyName throws a FileNotFoundException if you try to locate an assembly deployed in the application directory.
In this case, the solution is to define Environment.CurrentDirectory with the application directory before assembly loading.
Sample code :
const string SCHEMA_FILE = #"file:\";
var appAssembly = Assembly.GetExecutingAssembly();
var path = Path.GetDirectoryName(appAssembly.CodeBase);
if (path.StartsWith(SCHEMA_FILE))
path = path.Remove(0, SCHEMA_FILE.Length);
Environment.CurrentDirectory = path;
Does you service have rights to read in the folder?
Does the assembly have other dlls or assemblies it depends on?
If so, they also need to be in this directory.
To be certain, start up the Assembly Loader Log (fusion log). See this howto (Debugging Assembly Loading Failures).