This project is read-only.

Assembly "PowerQuery" and any dependency must be deployed to the GAC

Mar 21, 2009 at 3:42 PM
I'm getting a couple of error messages running through the example. I have a SQLEXPRESS with Northwind database on the local machine and .NET 3.5 SP1. Output is as follows:

578# add-pssnapin AlexPilotti.PowerQuery
579# # Set your connection string and target path (your temp folder in this sample)
580# $connStr = "Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=Northwind"
581# $assemblyParentPath = $Env:Temp
582# # Generate the assembly
583# New-DataModelAssembly $connStr "MyNorthwindModel" $assemblyParentPath "Northwind"

At line:1 char:22
+ New-DataModelAssembly  <<<< $connStr "MyNorthwindModel" $assemblyParentPath "Northwind"
584# # Load your LINQ to SQL DataContext
585# $ctx = New-Object "Northwind.MainDataContext" $connStr
New-Object : Cannot find type [Northwind.MainDataContext]: make sure the assembly containing this type is loaded.
At line:1 char:18
+ $ctx = New-Object  <<<< "Northwind.MainDataContext" $connStr
586# # Get the content of the Products table using the generated data model:
587# $ctx.Products
588# # Close the database connection and free al related resources
589# $ctx.Dispose()
Mar 21, 2009 at 8:46 PM
Hi cmille19,

could you please also tell me with which version of the PowerShell are you experiencing the problem?

Anyway, the error means that you didn't deploy the PowerQuery dlls to the GAC:

The easiest way is to launch the provided "RegisterPowerQuery.cmd" script with admin right (right click -> runas...),  as stated in the home page.

Please download the latest beta version release zip (dated 21 March)!!, as there was a small bug in the installation script preventing installutil.exe to work properly in previous releases.

Alternatively, use the Windows SDK gacutil.exe command to register all the dlls provided in the zip. 

Please let me know if this worked for you.



Mar 21, 2009 at 9:39 PM
Thanks for your quick response, I'm using Powershell V1 on a Vista machine with UAC enabled. I tried the latest cmd file from 3/21, however I stil received the same error messages. I was, however able to get it to work by using gacutil and registering all 4 dlls. I guess it needs to be installed to the GAC which installutil does not do.

By the way your project looks very interesting.
Mar 22, 2009 at 12:12 AM
Hi cmille19,

BTW the package includes also a GAC management Powershell which is called by the registration script: PowerGAC.dll (er... I guess I should look for a new naming pattern :-) )

I will document it in a proper place, but in the meantime here are some quick cmdlets usage info:

Add-PSSnapIn AlexPilotti.PowerGAC

# To deploy an assembly to the GAC :
Register-Assembly <assemblyPath.dll>

# To remove an assembly from the GAC:
Unregister-Assembly <assemblyPath.dll>

> By the way your project looks very interesting.

Thanks, next week I will hopefully find the time to finish the stored procedures support and the release of version 1.0.

After that the work will shift to the support of other database servers (Oracle, MySQL, PostgreSQL, etc).

Suggestions and requests are highly appreciated!



Jun 29, 2009 at 6:42 PM

Not sure what I'm doing wrong, but I'm still getting the above described error message.  I ran the registration script succesfully as well as ran Register-Assembly DynamicQuery.dll, Register-Assembly PowerQuery.dll and Register-Assembly L2SQLDataModelGenerator.dll.

Using GACUtil returns "Failure adding assempbly to the cache: Unknown Error"

This is in PowerQuery 1 RC1 with PowerShell 1 on Windows 2000 Server logged in as Admin.

Jun 29, 2009 at 6:50 PM


you need also .Net 3.5 SP1, which is not supported on Windows 2000!






Jun 29, 2009 at 7:42 PM

Sorry, I am using Server 2003 with .net 3.5.  I manually stepped through the registration script and got the DLLs intot he GAC.  Now I'm receiving the message New-DataModelAssembly : 'SCHEMA_NAME' is not a recognized function name.


Updating .net Framework just to be sure.

Jun 29, 2009 at 7:54 PM


what version of SQL Server are you using?




Jun 29, 2009 at 8:02 PM

2000 SP4.

Jun 29, 2009 at 8:07 PM


all tests have been performed againts SQL 2005 and SQL 2008.

I will prepare a SQL 2000 test setup and let you know. Probably the schema retrieval is using some T-SQL function introduced later.




Jul 1, 2009 at 5:39 PM


I just added support for SQL 2000 in the source tree. Here's a custom build for you:

Could you please tell me if it works for you?