Page 1 of 1

Are you missing a using directive or an assembly reference?

Posted: Fri Aug 14, 2009 3:01 am
by Marinus
I generate a report:

The data comes from a server. A Myservice.Bike.Model.dll is in the bin-catalogue (just like the Stimulsoft-dll's).

Myservice.Bike.Model.Ordersns.Product[] data = ServiceProvider.OrderService.RetrieveAllProducts();
StiReport report = new StiReport();
report.RegData("MyData", data);
report.Design();

The hiearchical list with Products shows fine in the Dictionary under the DataSource-node.
In the report-code "Myservice.Bike.Model" shows up in several places.
For instance:

public virtual Myservice.Bike.Model.Ordersns.ProductIdent ProductIdent
{
get
{
return ((Myservice.Bike.Model.Ordersns.ProductIdent)(StiReport.ChangeType(this["ProductIdent"], typeof(Myservice.Bike.Model.Ordersns.ProductIdent), true)));
}
}

When I try to preview the report I get an error:
c:\Users\.....\AppData\Local\Temp\xdmonrkw.0.cs(147,28) : error CS0246: :shame:
The type or namespace name 'Myservice' could not be found (are you missing a using directive or an assembly reference?)

Do I have my dll's in the wrong place. What to do?

Are you missing a using directive or an assembly reference?

Posted: Fri Aug 14, 2009 3:48 am
by Marinus
Sorry for the question. I found the answer... :shame:

Myservice.Bike.Model.Ordersns.Product[] data = ServiceProvider.OrderService.RetrieveAllProducts();
StiReport report = new StiReport();

string[] references = report.ReferencedAssemblies;
// Converting the the array to a collection
List newReferences = references.ToList();
// Add your Assembly to the list
newReferences.Add("Myservice.Bikes.Model.dll");
// Reset the array of referenced assembly with the converted collection
report.ReferencedAssemblies = newReferences.ToArray();

report.RegData("MyData", data);
report.Design();


Are you missing a using directive or an assembly reference?

Posted: Fri Aug 14, 2009 6:19 am
by Andrew
Great!

Thank you.