![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | using external assemblies in Powershell scripts Hi all, In my company, we develop some native DLLs written in C, and for these DLLs, we also provide some .Net wrappers. I stored the native DLLs and .Net ones in the same folder. When I call: [Reflection.Assembly]::LoadFrom($path + "dll1.dll") [Reflection.Assembly]::LoadFrom($path + "dll2.dll") I get: GAC Version Location --- ------- -------- False v1.1.4322 <path>\dll1.dll False v1.1.4322 <path>\dll2.dll We have some object factories, factories are in the dll1 and some objects created by the factories are in the dll2. When I create, with a factory, an object totally hold in the dll1, no problem, it works. But when I create, always with a dll1 factory, an object hold in the dll2, I get a FileNotFoundException: "Could not load file or assembly 'dll2' or one of its dependencies'. The LogFusion gives me some interesting traces: === LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/WINDOWS/system32/WindowsPowerShell/v1.0/dll2.DLL. LOG: Attempting download of new URL file:///C:/WINDOWS/system32/WindowsPowerShell/v1.0/dll2/dll2.DLL. LOG: Attempting download of new URL file:///C:/WINDOWS/system32/WindowsPowerShell/v1.0/dll2.EXE. LOG: Attempting download of new URL file:///C:/WINDOWS/system32/WindowsPowerShell/v1.0/dll2/dll2.EXE. I don't really know what happens here, it seems my assembly dll2 has been unloaded a something similar. Any help would be greatly appreciated. Thanks in advance. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: using external assemblies in Powershell scripts On Aug 10, 6:14 am, Romu <R...@discussions.microsoft.com> wrote: > Hi all, > In my company, we develop some native DLLs written in C, and for these DLLs, > we also provide some .Net wrappers. > > I stored the native DLLs and .Net ones in the same folder. > > When I call: > [Reflection.Assembly]::LoadFrom($path + "dll1.dll") > [Reflection.Assembly]::LoadFrom($path + "dll2.dll") > > I get: > GAC Version Location > --- ------- -------- > False v1.1.4322 <path>\dll1.dll > False v1.1.4322 <path>\dll2.dll > > We have some object factories, factories are in the dll1 and some objects > created by the factories are in the dll2. > > When I create, with a factory, an object totally hold in the dll1, no > problem, it works. > > But when I create, always with a dll1 factory, an object hold in the dll2, I > get a FileNotFoundException: > "Could not load file or assembly 'dll2' or one of its dependencies'. > > The LogFusion gives me some interesting traces: > === > LOG: This bind starts in default load context. > LOG: No application configuration file found. > LOG: Using machine configuration file from > C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config. > LOG: Policy not being applied to reference at this time (private, custom, > partial, or location-based assembly bind). > LOG: Attempting download of new URL > file:///C:/WINDOWS/system32/WindowsPowerShell/v1.0/dll2.DLL. > LOG: Attempting download of new URL > file:///C:/WINDOWS/system32/WindowsPowerShell/v1.0/dll2/dll2.DLL. > LOG: Attempting download of new URL > file:///C:/WINDOWS/system32/WindowsPowerShell/v1.0/dll2.EXE. > LOG: Attempting download of new URL > file:///C:/WINDOWS/system32/WindowsPowerShell/v1.0/dll2/dll2.EXE. > > I don't really know what happens here, it seems my assembly dll2 has been > unloaded a something similar. > > Any help would be greatly appreciated. Thanks in advance. This may help: http://blogs.msdn.com/junfeng/archiv...31/423340.aspx - Oisin |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Powershell Assemblies | PowerShell | |||
| Powershell scripts not working with Vista powershell | PowerShell | |||
| Powershell assemblies | PowerShell | |||
| Powershell and loading dependent assemblies | PowerShell | |||