I am using OpenXML to generate Excel file using C# in an SSIS package.
I did this because we do not have Excel installed on the Server so this should work without needing Excel installed.
This works locally, but is failing when moving to the PROD server. It is failing on the script task and I am getting this error:
Executed as user: MI\SQLAgentAccount. Microsoft (R) SQL Server Execute Package Utility Version 11.0.5058.0 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 10:46:49 AM Error: 2015-10-15 10:46:50.49 Code: 0x00000001 Source: Save To Excel Without Excel Description: Exception has been thrown by the target of an invocation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 10:46:49 AM Finished: 10:46:50 AM Elapsed: 0.827 seconds. The package execution failed. The step failed.
I am including in the references the OpenXML and WindowBase objects and adding them with the "using" statements.
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
Do these need to be registered with the GAC? Or is there a way to include them in the project (inside the script task within SSIS)? There is the setting for "Copy To Local" inside the C# script task in SSIS, but not sure what/how this would work inside SSIS.
Any help would be appreciated.
Yes, you need to ensure you have it available from the GAC and also copy the assembly to C:\WINDOWS\Microsoft.NET\Framework\
Just doing some research on this myself and found the following link that confirmed the issue and resolution:
http://beyondrelational.com/modules/2/blogs/81/posts/11263/referencing-an-assembly-inside-ssis-script-task.aspx
Related
I'm trying to write a timer-triggered Azure Function that downloads a bunch of data and processes it into a SQLite database. I've written code that does this and runs fine on my own machine. But, the same code in Azure yields a DllNotFoundException, complaining that the system can't load "e_sqlite3."
Here is the full error message (for the inner exception):
Exception while executing function: FnordFunction
Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception
while executing function: FnordFunction --->
System.TypeInitializationException : The type initializer for
'SQLite.SQLiteConnection' threw an exception. --->
System.DllNotFoundException : Unable to load DLL 'e_sqlite3': The
specified module could not be found. (Exception from HRESULT:
0x8007007E)
at
SQLitePCL.SQLite3Provider_e_sqlite3.NativeMethods.sqlite3_libversion_number()
at
SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number()
at SQLitePCL.raw.SetProvider(ISQLite3Provider imp)
at SQLitePCL.Batteries_V2.Init()
at SQLite.SQLiteConnection..cctor()
End of inner exception
Here are the steps to reproduce:
In Visual Studio 2017, I created an Azure Function project using the latest template.
I added my code files to the project, and edited the "Run" method to call the code.
Using NuGet, I added sqlite-net-pcl, and some other libraries I need. (I've also tried this with EntityFrameworkCore, using SQLite; that didn't work either).
Build
Publish
Run. Failure.
The problem might be that my code is wrong--but it works fine when I just make a console .exe.
The problem might be that VS2017 is not bundling the correct dll for SQLite when it builds. I'm not sure how to fix that. I've seen from other searches that the same error message pops up when the platform target is set to "Any CPU," but changing that to x86 or x64 does not fix the problem.
The problem might be that the SQLite libraries I have tried won't run in the Azure Functions sandbox. If so, are there any simple SQLite libraries that will run in the sandbox?
Thanks in advance...
The problem is that when running in a Function App, native binaries can't be automatically loaded from your bin folder, so it's not finding the DLL.
One way to solve this is to drop it in your D:\home\site\tools folder (e.g. using Kudu Console), as that folder is automatically place on the PATH.
I am creating a SSIS project via Biml (Using the current version of BimlExpress per the Varigence BimlExpress page) that uses a script component within a Data Flow Task. The project is created without issue however errors when it gets to the Script Component:
Could not load file or assembly 'Microsoft.SqlServer.DTSPipelineWrap, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
at ScriptMain.PreExecute()
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()
I can see this dll within the GAC and when I try to add the reference manually, SSIS states that I can't add it as it is already included in the project.
However, if I open the Script Component and manually Build it - but change nothing else - the Data Flow Task will run through without issue.
To clarify, I know I have changed nothing else as I am recreating this project from the Biml each time I want to test a new approach, which provides a consistent baseline.
Does anyone know why a Script Component that includes a reference to a GAC dll, will only work when manually Built but not beforehand?
I have used this exact Biml before without issue, though on a different environment. Worked using Visual Studio 2012 against a SQL Server 2016 instance yet doesn't here within Visual Studio 2015 (targeting 2012) against a SQL Server 2016 instance.
For further context I have also tested this outputting the SSIS Project targeted at SQL Server 2012, 2014 and 2016 with the exact same error message.
Update
This appears to definitely be a dll version problem in the project as output from BimlExpress, in that if I manually create the v4.0_14.100.0.0__89845dcd8080cc91 folder with the version 13 dll inside at C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.DTSPipelineWrap the script component now errors out with the following:
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{ID removed just in case}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper100 wrapper)
I guess your problem may be related to the Express version.
See at the related page the differences between Express and BimlStudio versions (Feature Comparison Chart under "Compare with BimlStudio" button):
https://www.varigence.com/BimlExpress
I had the same issue with the Data Profiling component. I used the following post.
ssis-data-profiling-task-editor-return-error-codes
We have an ASP.NET web application project in BitBucket which has a reference to a Class Library using Telerik Reporting. Telerik Reporting has a license associated (licenses.licx file).
Azure deployment fails with the message:
CSC : error CS1566: Error reading resource '[Project].dll.licenses' -- 'Could not find file 'D:\home\site\repository\src\[Project]\obj\Release\[Project].dll.licenses'.'
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\Home\[PathTo].csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d2bd89fc1c1e79";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="D:\home\[PathTo]\"
This existing question *.dll.licenses file in obj directory not created with msbuild in TeamCity and linked MSDN forum post seem to resolve this by installing extra tools - but I don't believe that would be an option in Azure?
The licenses.licx file in the class library is also set as an Embedded Resource which apparantly trips it up if not set correctly.
We were able to resolve the problem by removing the licenses.licx file from the repository (and ignoring it).
I am trying to call CPLEX (a mathimatical optimizer) from .NET VS 2013 on win 7.
I have installed optimization.framework.
I have added
using Optimization.Solver.Cplex;
in the code.
I try to run the example at:
http://www-01.ibm.com/support/docview.wss?uid=swg21400073&aid=1
I commented out
//using ILOG.Concert;
//using ILOG.CPLEX;
It can be built. But, I got error:
Unable to load DLL 'cplex100.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I change the DLL to cplex.dll but the same error.
In
using Optimization.Solver
when I typed ctrl+space , I can see that it includes many solvers, including CPLEX.
Why i got this error.
thanks
If you want to use CPLEX, you need to install it. The DLLs that you need are related to the CPLEX version you install, so cplex100.dll is from CPLEX 10.0, cplex124.dll would be from CPLEX 12.4, and so on. It is a commercial licenced product, but academics can get free/cheap copies.
You need to locate cplex100.dll in your installation and add an appropriate path to your project's linker properties – for your convenience: in detail described here.
I've downloaded the IKVM sources (http://www.ikvm.net/) from http://sourceforge.net/cvs/?group_id=69637
Now I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?
I've tried opening the ikvm8.sln, which opens all the projects, but trying to build the solution leads to a bunch of "type or namespace could not be found" errors.
As you can probably guess I'm no Visual Studio expert, but rather am used to working with Java in Eclipse.
So again, I'm looking for either: step-by-step instructions or a link to documentation on how to build IKVM in Visual Studio.
Let me know if you need any more info. Thanks for any help!
Edit: I've also tried a manual "MsBuild.exe IKVM8.sln", but also get a bunch of:
JniInterface.cs(30,12): error CS0234: The type or namespace name 'Internal' does not exist in the namespace 'IKVM' (a
re you missing an assembly reference?)
JniInterface.cs(175,38): error CS0246: The type or namespace name 'ClassLoaderWrapper' could not be found (are you mi
ssing a using directive or an assembly reference?)
JniInterface.cs(175,13): error CS0246: The type or namespace name 'ClassLoaderWrapper' could not be found (are you mi
ssing a using directive or an assembly reference?)
Edit #2: I noticed a "ikvm.build" file so I downloaded and ran nant on the folder, which got me a step further. A few things start to build successfully, unfortunately I now get the following error:
ikvm-native-win32:
[mkdir] Creating directory 'C:\Documents and Settings\...\My Documents\ikvm\ikvm\native\Release'.
[cl] Compiling 2 files to 'C:\Documents and Settings\...\My Documents\ikvm\ikvm\native\Release'.
BUILD FAILED
C:\Documents and Settings\...\My Documents\ikvm\ikvm\native\native.build(17,10):
'cl' failed to start.
The system cannot find the file specified
Total time: 0.2 seconds.
Edit #3: OK solved that by putting cl.exe in the path, still getting other errors though. Note this is all for building it on the console e.g. with Nant. Is there no way to get it to build in Visual Studio? That would be sad...
Edit #4: Next step was installing GNU classpath 0.95, and now it looks like I need a specific OpenJDK installation... Linux AMD64?!
[exec] javac: file not found: ..\..\openjdk6-b12\control\build\linux-amd64\gensrc\com\sun\accessibility\internal\resources\accessibility.java
[exec] Usage: javac <options> <source files>
[exec] use -help for a list of possible options
Edit #5: Got an answer from the author. See below or at http://weblog.ikvm.net/CommentView.aspx?guid=7e91b51d-6f84-4485-b61f-ea9e068a5fcf Let's see if it works...
Edit #6 As I feared, next problem: "cannot open windows.h", see separate question here.
Final Edit: Found Solution! After getting the Platform SDK folders in the Lib and Path environment variables, the solution I described below worked for me.
I don't know that this would do it for you but can you try building from the command line?
msbuild ________
I think that's how I built the application due to the same issues.
OK just got the following reply from the author: http://weblog.ikvm.net/CommentView.aspx?guid=7e91b51d-6f84-4485-b61f-ea9e068a5fcf
If you want to build from cvs, you're on your own. However, you can more easily build from source if you use an official release.
If you download ikvm-0.36.0.11.zip, classpath-0.95-stripped.zip and openjdk-b13-stripped.zip from SourceForge (the last two are under the ikvm 0.36.0.5 release) you have all the sources that are needed.
Now you'll have to open a Visual Studio 2008 Command Prompt (i.e. one that has cl.exe and peverify in the path).
Then in the ikvm root directory, do a "nant clean" followed by "nant". That should build the whole project. After you done that, you should be able to build in Visual Studio (debug target only), but you may need to repair the assembly references in the projects (unless you have ikvm installed in c:\ikvm).
Regards,
Jeroen
Edit: After making sure the Platform SDK folders were in the Path and Lib environment variables, this worked for me. Thanks, Jeroen!
This is how I built IKVM 8.1.5717.0 from source. Visual Studio is not required.
Create a folder:
c:\ikvm\
Add the above folder to PATH (e.g. set PATH=%PATH%;c:\ikvm and leave command prompt open for later).
Download:
ikvmsrc-8.1.5717.0.zip (http://www.frijters.net/ikvmsrc-8.1.5717.0.zip)
Unzip and place "ikvm-8.1.5717.0" folder in c:\ikvm\
Download:
openjdk-8u45-b14-stripped.zip (http://www.frijters.net/openjdk-8u45-b14-stripped.zip)
Unzip and place "openjdk-8u45-b14" folder in c:\ikvm\
Download:
Java 8 SDK (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
Install and make sure location is added to path
Download:
NAnt 0.92 (https://sourceforge.net/projects/nant/files/nant/0.92/nant-0.92-bin.zip/download)
Unzip and place "nant-0.92" folder in c:\ikvm\
ICSharpCode.SharpZipLib.dll (http://www.icsharpcode.net/opensource/sharpziplib/Download.aspx)
Place "ICSharpCode.SharpZipLib.dll" in C:\ikvm\ikvm-8.1.5717.0\bin\
Open the following file in a text editor and change the version number:
C:\ikvm\ikvm-8.1.5717.0\CommonAssemblyInfo.cs.in
Using command prompt from earlier, cd to:
C:\ikvm\ikvm-8.1.5717.0\ikvm\
Run:
..\nant-0.92\bin\NAnt.exe
If successful all the binaries will be in:
C:\ikvm\ikvm-8.1.5717.0\bin