Subscribe to this thread
Home - General / All posts - Linq not recognized
mcerk100 post(s)
#03-Jun-11 16:01

Hello, I have a a script in Manifold (VB.NET) that displays this error:

Namespace or type specified in the Imports 'System.Linq' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. BC40056

The script has this imports on the top:

Imports Manifold.Interop.Scripts

Imports System

Imports System.Linq

Imports Microsoft

Imports Microsoft.VisualBasic

Imports Microsoft.VisualBasic.FileIO

Class Script

Shared Sub Main

'initial declarations

Dim app As Manifold.Interop.Application = Context.Application

Dim d As Manifold.Interop.Document = app.ActiveDocument

.....

I have created the script using Visual Studio and it works ok there. When I want to run it from Manifold it just doesnt (I guess due to not finding Linq library). In Visual Studio I used .NET Framework version 4.0.

Thank you in advance,

Matej

KlausDE

6,410 post(s)
#03-Jun-11 16:24

In Visual Studio I used .NET Framework version 4.0

and that is the problem. see this thread or this one.


Do you really want to ruin economy only to save the planet?

mcerk100 post(s)
#04-Jun-11 08:11

I see, this sohould be a problem, but however not in my case. I have changed the reference to 3.5 and tried to run it again (from script). It still does not work. The System.Linq library is not recognized when running from script.

When I run it from Visual studio, it works. I never tried compiling and installing as Add-In. But I believe it should also be able to run from script component?

Any other suggestions?

KlausDE

6,410 post(s)
#04-Jun-11 08:40

If I do nothing but add End Sub and End Class this runs for me. I get the error you quote if I provoce an error like delete 'End Class'. In that case the compiler still lists the unreferenced System.Linq. So the rest of Error message may be more important.


Do you really want to ruin economy only to save the planet?

jkelly


1,234 post(s)
#05-Jun-11 23:47

Manifold does not reference all the same assemblies as Visual Studio, so you may have to physically reference the system.linq assembly.

If you go to Script - References in the opened script, you will see what Manifold references by default, in mine it is System.dll, System.Data.dll, System.Drawing.dll, System.Windows.Forms.dll and System.Xml.dll. You just have to add a reference to the assembly that contains linq, and then add the Imports System.Linq into the script and it should work.

Hope this helps


James Kelly

http://www.locationsolve.com

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.