-->
![Could Not Load Microsoft.visualbasic.powerpacks.vs Could Not Load Microsoft.visualbasic.powerpacks.vs](http://www.vbforums.com/attachment.php?attachmentid=154683&d=1513856810)
'Could not load file or assembly 'Microsoft.VisualBasic.PowerPacks.Vs, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 'If, I remove that Add Assembly line from web.config then its work perfectly.
This week an ISV logged a support incident to determine why their Visual Studio Tools for Microsoft Dynamics GP (VSTools) form wouldn't open. The customization worked fine on the developer's machine (of course) but didn't work when deploying it to the customer site.
The ISV was using the Menus for Visual Studio Tools for Microsoft Dynamics GP application to display a menu for their .NET VSTools form. The menu displayed correctly but when the item was selected, the window didn't open. No error messages, just nothing. I received the assembly from the ISV and found I could repro the issue here as well.
I had an idea of the issue but the first step is to run a Script.log to determine if anything is going wrong on the Dexterity side of the Menus for Visual Studio Tools application.
Script.log Result
The Script.log is above from my own test is above. I added the line numbers for clarification.
Looking at the Script.log, I could tell that everything seemed to be working correctly. The only that that we don't know and cannot tell is what the Tag for this command is. So there is a possibility there is an issue with returning the correct tag. However this is a GP menu and there are no known issues with commands in the core dictionary.
What is the code above doing and why do I suspect that all is OK?
The explanation for the Script.log lines are below.
- This is you clicking on the menu item and the Dexterity command being invoked. It is the 'Command00' (number 0) item by name. So this was the first menus for VSTools item registered. Probably the only one that exists on the system if you only have the one window.
- Shows the command calling the Process() function and passes in the command selected (the numeric value; 0-99). Since this is a function the first param is the return value (which we don't see because Script.log is 'in' only) and the number of the command which was 0. So far so good.
- Had me stumped for bit is that seems a different command that was selected. But it isn't. The Process() function has likely has pass through sanScript in it which Dexterity assigns temp resids to compile the pass through sanScript and they sometimes match up with real ones which show in the Script.log as something else. That is what #3 is -the pass through. And we know that for sure because we see 1 parameter passed to it (the 0) and a command cannot have parameters. Since there wasn't a crash, we know that didn't really happen and it was a method call
- This the 'run script' on the CmdID field that your VSTools event triggers on. In the dex code, nothing is happening as there isn't any code on that field
- This is your VSTools code calling the Callback function to get the current tag. VSTools events that access a field, run a field script, or execute a procedure show as [0] in the Script.log.Tag = MenusForVisualStudioTools.Functions.Callback.Invoke();
- Lastly, this is the Callback function itself running.
From here, there are 2 reasons I can think of that would cause your .NET form to not open.
- The tag returned isn't the one that you received on registration. While possible, I find this unlikely to be the issue.
- Your code is opening your form however it is causing an exception which Dexterity/Dynamics does not display.
I'm going with #2 on this one, but how to prove it?
Two ways that I can think of.
- Load Visual Studio or Windbg and your source code on the machine. Attach to the Dynamics.exe process and set a breakpoint in your code and step through your code. You should see that a first chance exception happened. Apart from the licensing aspect of installing VS2008 on the customer machine (full version as the Express version cannot attach to process), you have to deploy source etc. So we went with the 2nd option.
- Recode your application slightly to trap and display the exception.
Code ISV had to open the form
DynamicsGPForm1 f = new DynamicsGPForm1();
f.Show();
f.Show();
Because I was sure that the form was throwing an unhandled exception which was caught silently by Dexterity, the solution is to catch and show the exception in the ISV application.
Suggested Code Change
try
{
DynamicsGPForm1 f = new DynamicsGPForm1();
f.Show();
}
catch (Exception fException)
{
MessageBox.Show(fException.Message);
}
{
DynamicsGPForm1 f = new DynamicsGPForm1();
f.Show();
}
catch (Exception fException)
{
MessageBox.Show(fException.Message);
}
After making the change and deploying the new code, we hit pay dirt. An exception was caught - the error was:
Can't load file
Could not load file or assembly 'Microsoft.VisualBasic.Powerpacks.Vs, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f57f11d50a3a' of one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.VisualBasic.Powerpacks.Vs, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f57f11d50a3a' of one of its dependencies. The system cannot find the file specified.
Now we're getting somewhere. We just need to install this assembly on the client machine and we should be good.
The name didn't seem familiar to me and so I did a search for the assembly. I learned a few things in my search:
- The assembly is from the Visual Basic Powerpack
- There are versions 2.0 and 3.0 available on MSDN for free
- It is installed with Visual Studio 2008 SP1.
After installing both the 2.0 and 3.0 versions on my machine, I found I still couldn't access the form. Why not?
Well, apparently there was a 'name change' in the dll. In the public downloadable version, the name of the assembly is Microsoft.VisualBasic.Powerpacks.dll. Note that there is no 'Vs' at the end as hers was using.
From a bit more research, I found that is the version that is included with VS 2008 SP1 and you cannot download it 'standalone'. The only way to get the 'Vs' version installed to the client is to make an installer package that invokes the bootstrapper assembly for the package.
This form post talks about it. I'm sure you can find more information if you search.
Because the ISV really wanted to use this component, the only solutions would be to:
- Create the installer to invoke the Powerpacks bootstrapper (a bit of work)
- Load the 3.0 version on the development machine(since the most recent). Switch the reference to the new version. Recompile and fix any name issues. Then on the customer machines, just manually download and install the 3.0 Visual Basic Powerpack and your .NET addin form should open correctly.
Regards
Patrick
Patrick
// Copyright © Microsoft Corporation. All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)
-->Implements the basic functionality common to line and shape controls.
Namespace:Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Inheritance Hierarchy
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Microsoft.VisualBasic.PowerPacks.Shape
Microsoft.VisualBasic.PowerPacks.LineShape
Microsoft.VisualBasic.PowerPacks.SimpleShape
System.MarshalByRefObject
System.ComponentModel.Component
Microsoft.VisualBasic.PowerPacks.Shape
Microsoft.VisualBasic.PowerPacks.LineShape
Microsoft.VisualBasic.PowerPacks.SimpleShape
Syntax
Constructors
Name | Description |
---|---|
Shape() | Initializes a new instance of the Shape class. |
Shape(ShapeContainer) | Initializes a new instance of the Shape class. |
Properties
Name | Description |
---|---|
AccessibilityObject | Gets the AccessibleObject that is assigned to the control. |
AccessibleDefaultActionDescription | Gets or sets the default action description of the control for use by accessibility client applications. |
AccessibleDescription | Gets or sets the description of the control that is used by accessibility client applications. |
AccessibleName | Gets or sets the name of the control that is used by accessibility client applications. |
AccessibleRole | Gets or sets the accessible role of the control. |
Anchor | Gets or sets the edges of the container to which a shape is bound, and determines how a shape is resized when its parent is resized. |
BorderColor | Gets or sets the color of the border of a shape or line control. |
BorderStyle | Gets or sets the border style for a shape or line control. |
BorderWidth | Gets or sets the width of a line or shape control's border. |
CanFocus | Gets a value indicating whether a line or shape control can receive focus. |
CanRaiseEvents | (Inherited from Component.) |
CanSelect | Gets a value indicating whether a line or shape control can be selected. |
Container | Gets the IContainer that contains the Component. |
ContainsFocus | Gets a value indicating whether a line or shape control currently has the input focus. |
ContextMenu | Gets or sets the shortcut menu associated with a line or shape control. |
ContextMenuStrip | Gets or sets the ContextMenuStrip associated with a line or shape control. |
Created | Gets a value indicating whether a line or shape control has been created. |
Cursor | Gets or sets the cursor that is displayed when the mouse pointer is resting on a line or shape control. |
DefaultBorderColor | Gets the default border color for a line or shape control. |
DesignMode | (Inherited from Component.) |
Disposing | Gets a value indicating whether the base Shape class is disposing. |
Enabled | Gets or sets a value indicating whether a line or shape control can respond to user interaction. |
Events | (Inherited from Component.) |
Focused | Gets a value indicating whether a line or shape control currently has the input focus. |
IsAccessible | Gets or sets a value indicating whether a line or shape control is available to accessibility applications. |
IsDisposed | Gets a value indicating whether a line or shape control has been disposed of. |
ModifierKeys | Gets a value indicating which of the modifier keys (SHIFT, CTRL, and ALT) is in a pressed state. |
MouseButtons | Gets a value indicating which of the mouse buttons is in a pressed state. |
MousePosition | Gets the position of the pointer in screen coordinates. |
Name | Gets or sets the name of a line or shape control. |
Parent | Gets or sets the parent container of a line or shape control. |
Region | Gets or sets the window region associated with a line or shape control. |
SelectionColor | Gets or sets the selection color of a shape. |
Site | (Inherited from Component.) |
Tag | Gets or sets the object that contains data about a line or shape control. |
UseWaitCursor | Gets or sets a value indicating whether to use the wait cursor for the current line or shape control. |
Visible | Gets or sets a value indicating whether a line or shape control is displayed. |
Methods
Name | Description |
---|---|
BringToFront() | Brings a line or shape control to the front of the z-order. |
CreateAccessibilityInstance() | Creates a new accessibility object for a line or shape control. |
CreateObjRef(Type) | (Inherited from MarshalByRefObject.) |
Dispose() | (Inherited from Component.) |
Dispose(Boolean) | Releases the unmanaged resources used by a line or shape control and optionally releases the managed resources.(Overrides Component.Dispose(Boolean).) |
DrawToBitmap(Bitmap, Rectangle) | Supports rendering to the specified bitmap. |
Equals(Object) | (Inherited from Object.) |
Finalize() | (Inherited from Component.) |
FindForm() | Retrieves the form that a line or shape control is on. |
Focus() | Sets input focus to a line or shape control. |
GetContainerControl() | Returns the next ContainerControl up in a line or shape control's chain of parent controls. |
GetHashCode() | (Inherited from Object.) |
GetLifetimeService() | (Inherited from MarshalByRefObject.) |
GetService(Type) | (Inherited from Component.) |
GetType() | (Inherited from Object.) |
Hide() | Conceals a line or shape control from the user. |
HitTest(Int32, Int32) | Gets information about a line or shape control at the specified position on the screen. |
InitializeLifetimeService() | (Inherited from MarshalByRefObject.) |
Invalidate() | Invalidates a specific region of a line or shape control and causes a paint message to be sent to the control. |
IsKeyLocked(Keys) | Determines whether the CAPS LOCK, NUM LOCK, or SCROLL LOCK key is in effect. |
MemberwiseClone() | (Inherited from Object.) |
MemberwiseClone(Boolean) | (Inherited from MarshalByRefObject.) |
OnClick(EventArgs) | Raises the Click event. |
OnContextMenuChanged(EventArgs) | Raises the ContextMenuChanged event. |
OnContextMenuStripChanged(EventArgs) | Raises the ContextMenuStripChanged event. |
OnCursorChanged(EventArgs) | Raises the CursorChanged event. |
OnDoubleClick(EventArgs) | Raises the DoubleClick event. |
OnEnabledChanged(EventArgs) | Raises the EnabledChanged event. |
OnEnter(EventArgs) | Raises the Enter event. |
OnGotFocus(EventArgs) | Raises the GotFocus event. |
OnInvalidated(InvalidateEventArgs) | Raises the Invalidated event. |
OnKeyDown(KeyEventArgs) | Raises the KeyDown event. |
OnKeyPress(KeyPressEventArgs) | Raises the KeyPress event. |
OnKeyUp(KeyEventArgs) | Raises the KeyUp event. |
OnLeave(EventArgs) | Raises the Leave event. |
OnLostFocus(EventArgs) | Raises the LostFocus event. |
OnMouseClick(MouseEventArgs) | Raises the MouseClick event. |
OnMouseDoubleClick(MouseEventArgs) | Raises the MouseDoubleClick event. |
OnMouseDown(MouseEventArgs) | Raises the MouseDown event. |
OnMouseEnter(EventArgs) | Raises the MouseEnter event. |
OnMouseHover(EventArgs) | Raises the MouseHover event. |
OnMouseLeave(EventArgs) | Raises the MouseLeave event. |
OnMouseMove(MouseEventArgs) | Raises the MouseMove event. |
OnMouseUp(MouseEventArgs) | Raises the MouseUp event. |
OnMouseWheel(MouseEventArgs) | Raises the MouseWheel event. |
OnMove(EventArgs) | Raises the Move event. |
OnPaint(PaintEventArgs) | Raises the Paint event. |
OnParentChanged(EventArgs) | Raises the ParentChanged event. |
OnPreviewKeyDown(PreviewKeyDownEventArgs) | Raises the PreviewKeyDown event. |
OnQueryAccessibilityHelp(QueryAccessibilityHelpEventArgs) | Raises the QueryAccessibilityHelp event. |
OnRegionChanged(EventArgs) | Raises the RegionChanged event. |
OnVisibleChanged(EventArgs) | Raises the VisibleChanged event. |
PointToClient(Point) | Computes the location of the specified screen point into client coordinates. |
PointToScreen(Point) | Computes the location of the specified client point into screen coordinates. |
RectangleToClient(Rectangle) | Computes the size and location of the specified screen rectangle in client coordinates. |
RectangleToScreen(Rectangle) | Computes the size and location of the specified client rectangle in screen coordinates. |
Refresh() | Forces a control to invalidate its client area and immediately redraw itself and any child controls. |
ResumePaint(Boolean) | Resumes usual painting logic, optionally forcing an immediate layout of pending paint requests. |
Scale(SizeF) | Scales a shape by the specified scaling factor. |
Select() | Enables a control. |
SendToBack() | Sends a line or shape control to the back of the z-order. |
Show() | Displays a shape to the user. |
SuspendPaint() | Suspends the painting logic for a shape. |
ToString() | (Inherited from Component.) |
Update() | Causes the control to redraw the invalidated regions within its client area. |
Events
Name | Description |
---|---|
ChangeUICues | Occurs when the focus or keyboard user interface (UI) cues change. |
Click | Occurs when the shape is clicked. |
ContextMenuChanged | Occurs when the value of the ContextMenu property changes. |
ContextMenuStripChanged | Occurs when the value of the ContextMenuStrip property changes. |
CursorChanged | Occurs when the value of the Cursor property changes. |
Disposed | (Inherited from Component.) |
DoubleClick | Occurs when the shape is double-clicked. |
EnabledChanged | Occurs when the Enabled property value has changed. |
Enter | Occurs when the shape is entered. |
GotFocus | Occurs when the shape receives focus. |
Invalidated | Occurs when a shape's display requires redrawing. |
KeyDown | Occurs when a key is pressed and the shape has focus. |
KeyPress | Occurs when a key is pressed and the shape has focus. |
KeyUp | Occurs when a key is released and the shape has focus. |
Leave | Occurs when the input focus leaves the shape. |
LostFocus | Occurs when the shape loses focus. |
MouseClick | Occurs when the shape is clicked by the mouse. |
MouseDoubleClick | Occurs when the shape is double-clicked by the mouse. |
MouseDown | Occurs when the mouse pointer is over the shape and a mouse button is pressed. |
MouseEnter | Occurs when the mouse pointer enters the shape. |
MouseHover | Occurs when the mouse pointer rests on the shape. |
MouseLeave | Occurs when the mouse pointer leaves the shape. |
MouseMove | Occurs when the mouse pointer is moved over the shape. |
MouseUp | Occurs when the mouse pointer is over the shape and a mouse button is released. |
MouseWheel | Occurs when the mouse wheel moves and the shape has focus. |
Move | Occurs when the shape is moved. |
Paint | Occurs when the shape is redrawn. |
ParentChanged | Occurs when the Parent property value changes. |
PreviewKeyDown | Occurs before the KeyDown event when a key is pressed and focus is on the shape. |
QueryAccessibilityHelp | Occurs when an AccessibleObject is providing Help to accessibility applications. |
RegionChanged | Occurs when the value of the Region property changes. |
VisibleChanged | Occurs when the Visible property value changes. |
Remarks
You do not typically inherit from Shape. To create your own line or shape class, inherit from the LineShape or the SimpleShape class.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
LineShape
OvalShape
RectangleShape
SimpleShape
Microsoft.VisualBasic.PowerPacks Namespace
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)
Introduction to the Line and Shape Controls (Visual Studio)
OvalShape
RectangleShape
SimpleShape
Microsoft.VisualBasic.PowerPacks Namespace
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)
Introduction to the Line and Shape Controls (Visual Studio)
Return to top