QPR
asked on
Where to put the dll
I have created a DLL in visual studio 2010 (c# and v3.5)
An app that we have includes an integrated scripting environment that you can use to run functions within the program.
It is simple VB and you can reference a DLL by simply typing
references my.dll
imports my.dll
However I cannot get it to "find" my DLL at runtime.
I have put the DLL in the GAC using gacutil but still nothing.
After throwing it into a few random areas of the app's server folders I got it to see the DLL when checking syntax but at runtime it still says it cannot find my DLL.
Is there a way to know where this app is looking, what path it is checking? I can't ask the vendor because (although they offer the environment) they do not provide support for custom code.
My recent DLL experience has either been in the GAC or in the bin folder of an app.
So a generic question, if putting a DLL outside of the gac, do you still have to reg the dll these days?
An app that we have includes an integrated scripting environment that you can use to run functions within the program.
It is simple VB and you can reference a DLL by simply typing
references my.dll
imports my.dll
However I cannot get it to "find" my DLL at runtime.
I have put the DLL in the GAC using gacutil but still nothing.
After throwing it into a few random areas of the app's server folders I got it to see the DLL when checking syntax but at runtime it still says it cannot find my DLL.
Is there a way to know where this app is looking, what path it is checking? I can't ask the vendor because (although they offer the environment) they do not provide support for custom code.
My recent DLL experience has either been in the GAC or in the bin folder of an app.
So a generic question, if putting a DLL outside of the gac, do you still have to reg the dll these days?
ASKER
The DLL itself is the entire project (windows class library)
Can you please attach a zipped version of the project?
ASKER
I'm not sure i understand why, I have a compiled DLL that I need another app to be able to reference via its internal scripting feature.
ASKER
The project is a simple cs file, a web service reference and a key
I am referencing the dll in the scripted environment add trying to use AddListItems()
My DLL cannot be found at runtime (of the script) apparently.
Here is the contents of the CS file.
using System;
using System.Collections.Generic ;
using System.Linq;
using System.Text;
using System.Xml;
namespace PR2Sharepoint
{
public class SPFunctions
{
public static void GetListItems(string theTitle) // Get the title field for all items in the sample list
{
SPSampleList.Lists client = new SPSampleList.Lists();
client.Credentials = System.Net.CredentialCache .DefaultNe tworkCrede ntials;
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement viewFields = xmlDoc.CreateElement("View Fields");
viewFields.InnerXml = "<FieldRef Name=\"Title\" />";
try
{
XmlNode listItems = client.GetListItems("sampl e", null, null, viewFields, null, null, null);
foreach (XmlNode node in listItems)
if (node.Name == "rs:data")
for (int f = 0; f < node.ChildNodes.Count; f++)
{
if (node.ChildNodes[f].Name == "z:row")
{
string title = node.ChildNodes[f].Attribu tes["ows_T itle"].Val ue;
Console.WriteLine(title);
}
}
//Console.ReadKey(false);
}
catch (Exception ex)
{
Console.WriteLine(ex.Messa ge);
Console.WriteLine(ex.Targe tSite);
Console.ReadKey(false);
}
}
public static void AddListItems(string title)
{
SPSampleList.Lists client = new SPSampleList.Lists();
client.Credentials = System.Net.CredentialCache .DefaultNe tworkCrede ntials;
XmlDocument doc = new XmlDocument();
XmlElement batch_element = doc.CreateElement("Batch") ;
string item = "<Method ID=\"1\" Cmd=\"New\">" + "<Field Name=\"ID\">New</Field>" + "<Field Name=\"Title\">" + title + "</Field>" + "</Method>";
batch_element.InnerXml = item;
client.UpdateListItems("sa mple", batch_element);
}
}
}
I am referencing the dll in the scripted environment add trying to use AddListItems()
My DLL cannot be found at runtime (of the script) apparently.
Here is the contents of the CS file.
using System;
using System.Collections.Generic
using System.Linq;
using System.Text;
using System.Xml;
namespace PR2Sharepoint
{
public class SPFunctions
{
public static void GetListItems(string theTitle) // Get the title field for all items in the sample list
{
SPSampleList.Lists client = new SPSampleList.Lists();
client.Credentials = System.Net.CredentialCache
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement viewFields = xmlDoc.CreateElement("View
viewFields.InnerXml = "<FieldRef Name=\"Title\" />";
try
{
XmlNode listItems = client.GetListItems("sampl
foreach (XmlNode node in listItems)
if (node.Name == "rs:data")
for (int f = 0; f < node.ChildNodes.Count; f++)
{
if (node.ChildNodes[f].Name == "z:row")
{
string title = node.ChildNodes[f].Attribu
Console.WriteLine(title);
}
}
//Console.ReadKey(false);
}
catch (Exception ex)
{
Console.WriteLine(ex.Messa
Console.WriteLine(ex.Targe
Console.ReadKey(false);
}
}
public static void AddListItems(string title)
{
SPSampleList.Lists client = new SPSampleList.Lists();
client.Credentials = System.Net.CredentialCache
XmlDocument doc = new XmlDocument();
XmlElement batch_element = doc.CreateElement("Batch")
string item = "<Method ID=\"1\" Cmd=\"New\">" + "<Field Name=\"ID\">New</Field>" + "<Field Name=\"Title\">" + title + "</Field>" + "</Method>";
batch_element.InnerXml = item;
client.UpdateListItems("sa
}
}
}
1. I do not see a 'using' statement mentioning your 'my.dll'. Typically it will look like:
using my;
or
using my.[someNameSpace];
2. Is the SPSampleList.Lists class declared in your my.dll assembly? If not, I don't where in the AddListItems method you are referencing a class from your my.dll assembly.
Once again, please attach your project and I will be better able to help you.
Arun
using my;
or
using my.[someNameSpace];
2. Is the SPSampleList.Lists class declared in your my.dll assembly? If not, I don't where in the AddListItems method you are referencing a class from your my.dll assembly.
Once again, please attach your project and I will be better able to help you.
Arun
ASKER
You will not see that anywhere in the dll because the place where I am referencing and importing the dll is within a scripting environment within a 3rd party application.
There is no problem with my dll - my dll works perfectly, I can use it with a console app.
I now need to distribute this compiled dll to a place on the server where this 3rd party application can "see" it.
I have tried the GAC (using gacutil) and the bin directory of the 3rd party application. But the scripting feature of the 3rd party application says cannot find my.dll when I try to execute the script.
This question is all about where I need to gac/regsvr/regasm in order for this app to be able to see it.,
There is no problem with my dll - my dll works perfectly, I can use it with a console app.
I now need to distribute this compiled dll to a place on the server where this 3rd party application can "see" it.
I have tried the GAC (using gacutil) and the bin directory of the 3rd party application. But the scripting feature of the 3rd party application says cannot find my.dll when I try to execute the script.
This question is all about where I need to gac/regsvr/regasm in order for this app to be able to see it.,
What does the 3rd party application owner say about this? Since they are the ones who are providing the 'scripting feature'.
Thanks,
Arun
Thanks,
Arun
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Not 100% sure - they provide the environment but not support for custom DLLs.
Their own scripts reference their own DLLs as well as .NET framework DLLs such as system.windows....
So I thought putting it in the GAC would have done the trick. There are many other potential candidates it could go but all so far are prooving fruitless.
Not sure what these are: DLLIMPORT (cdecl) or WINAPI (stdcall)
Their own scripts reference their own DLLs as well as .NET framework DLLs such as system.windows....
So I thought putting it in the GAC would have done the trick. There are many other potential candidates it could go but all so far are prooving fruitless.
Not sure what these are: DLLIMPORT (cdecl) or WINAPI (stdcall)
ASKER
Same directory as the exe.
Thanks! this got it to run fine
Thanks! this got it to run fine
See if you can add the dll as a reference to your project. All you need to do then is to compile it in Release mode and publish the application. This way it will ensure that all the references will be 'visible' to your application.
Thanks,
Arun