locked
PowerPacks 2.0 and 3.0

    Question

  • Hi,

    I need to sort something out. I'm researching the difference between having, or not, a PowerPack toolbar in VS 2008 and under what circumstances an erorr would be generated.

    I received an error message when I attempted to open a (project) VB file in VS 2008 Professional Edition. The (project) VB file has a reference named Microsoft.VisualBasic.PowerPacks (version 3.0) in Solution Explorer. The project included a PrintFrom component.

    My VS installation has version 2.0 PowerPacks

    Microsoft.VisualBasic.PowerPacks.Vs
    Version 9.0.0.0
    Runtime v2.0.50727
    Path C:\Program Files\Common Files\Microsoft Shared\Visual Basic Power Packs\1.1\Microsoft.VisualBasic.PowerPacks.Vs.dll

    The error message is:

    [begin]

    The designer cannot process the code at line 213:

    Me.PrintForm1.DocumentName = "document"

    The code within the method 'InitializeComponent' is generated by the designer and should
    not be manually modified.  Please remove any changes and try opening the designer again.

    [end]

    To work on this problem I downloaded and installed version 3.0 PowerPacks. When I re-opened the VS project I did not receive an error. It was gone. I read the known issues .htm and see there is something noted for VB 2005 Express and VS 2008 Express; the new tools are not automatically added to the toolbox. I have VS 2008 Professional Edition so this didn't appear to apply to my situation.

    The download was; http://www.microsoft.com/downloads/details.aspx?FamilyId=371368A8-7FDC-441F-8E7D-FE78D96D4063&displaylang=en
    2.7 megs dated 02/15/2008

    Now the Solution Explorer References list object named Microsoft.VisualBasic.PowerPacks is fixed and its properties includes a path:
    c:\Program Files\Microsoft Visual Basic 2005 Power Packs\3.0\Microsoft.VisualBasic.PowerPacks.dll

    Previously, when the file was in an error state, the reference to Mircosoft.VisualBasic.PowerPacks had no path. Its properties included only a name: Microsoft.VisualBasic.PowerPacks, and matching identity. Its version was 0.0.0.0

    Now that I have 3.0 I started a new project. I added a line (the graphics tool) to a form using the new line tool. I also added a PrintFrom component from the toolbox, but the one I selected was the PowerPacks (2.0) component. The IDE immediately produced an error;
    'PrintForm' is ambiguous in the namespace 'Microsoft.VisualBasic.PowerPacks.Printing'.

    Is this because version 2 PowerPacks PrintForm component is no longer available? And I should now use the version 3 PrintForm component? I know how to 'right-click' on the particular tool and remove it. Looking at Solution Explorer I see references to both power packs; neither apprears to be in an error state.

    I removed the version 2 PrintForm component from the form and replaced it with the version 3 PrintForm component. Now I have no error messages but both referenced PowerPacks remain in Solution Exporer. I saved the project so I could test re-opening it.

    Next I un-installed version 3.0 PowerPacks and when I re-opened my project the original error message is back but now includes additional errors for the graphics line that I added.

    Is this normal? Un-installing 3.0 revomed the related DLL PowerPacks.DLL? And restored the 2.0 DLL PowerPacks.Vs.dll? Now both the PrintForm component and graphics line object in the project are a problem for my installation?

    Is it possible to have 3.0 installed and produce these erorrs?

    If I have 3.0 and my friend has 2.0 and I send my project with graphics and the 3.0 PrintForm component, will my friend experience an error? It is possible for him to have 3.0 and receive this error?

    Is it possible to have support for both DLL's. When I had only 2.0 I checked the 'new' resources list and 3.0 was not listed. When I had 3.0 I checked the list and 2.0 was not listed.

    I can imagine two PrintForm components may present a problem, maybe I should use the newer version, but in order to have the graphics tools; installing 3.0. Do I automatically loose support for 2.0?

    My testing included creating a project knowing I had 3.0 installed, but then trying to open the project on a computer that I knew did not have 3.0. I get an error every time. Is it possible to not have 3.0 but open a file that has components that need it?

    If there something I've omitted that can help answer my question, please let me know.

    Thanks for any advise.

    David Dollar

    Monday, September 22, 2008 8:15 PM

Answers

  •  

    Thanks David for all of the questions.

     

    The PowerPacks are designed to be installed side by side so that you can have projects that use 1.0 or 2.0 or 3.0.  They do all have the same namespace (Microsoft.VisualBasic.PowerPacks) so this means components from two or more powerpacks cannot be used in the same project.    If you try to you will get an ambiguous reference error because VS cannot resolve the assembly.

     

    In addition if you’re using VS 2008 the powerpacks are now installed with the product in the assembly Microsoft.VisualBasic.PowerPacks.VS.DLL. Notice the addition of VS to the name, the namespace remains the same but the assembly name changed.

     

    The PowerPacks that originally shipped with VS 2008 only contained the PrintForm component and the Printer library.  If you install VS 2008 Sp1 (http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en) you will find that all components including the Line and Shape controls as well as the DataRepeater are not included in Visual Studio.

     

    I would recommend using the latest 3.0 version or if you have VS 2008 use the version installed with Sp1.  However, if do need to use earlier versions or run into errors like you have when opening a project that used a different version

     all you should need to do is check the project references, remove missing references and add a reference to the version you have installed and make sure you only have a reference to one powerpack.

     

    I hope that helps.  If this doesn’t solve a particular issue you’re seeing please let me know.


    John Hart (Microsoft)
    Tuesday, September 23, 2008 6:55 PM
  • Hi Again John,

    I believe I have found my answer. The program referenced version 3.0 PowerPacks and did so because the PrintForm component that was used in the program came from the Power Packs 3.0 toolbar.

    That created this line in the .vbproj file;
    <Reference Include ="Microsoft.VisualBasic.Powerpacks, Version=9.0.0.0, Culture=neutral, PublickeyToken=b03f5f7f11d50a3a">

    Had the developer used the [regular] Power Packs (2.0) PrintForm component the .vbproj file would have listed;
    <Reference Include ="Microsoft.VisualBasic.Powerpacks.Vs, Version=9.0.0.0, Culture=neutral, PublickeyToken=b03f5f7f11d50a3a">

    The error was displayed because the computer/software attempting to open the file did not have PowerPacks 3.0 installed.

    Short of commenting out lines as I did in my other post; disabling the reference and object, you'd need to install 3.0 to open the file error free.

    Sound right to you?

    Thanks,
    David Dollar
    Thursday, September 25, 2008 2:23 PM

All replies

  •  

    Thanks David for all of the questions.

     

    The PowerPacks are designed to be installed side by side so that you can have projects that use 1.0 or 2.0 or 3.0.  They do all have the same namespace (Microsoft.VisualBasic.PowerPacks) so this means components from two or more powerpacks cannot be used in the same project.    If you try to you will get an ambiguous reference error because VS cannot resolve the assembly.

     

    In addition if you’re using VS 2008 the powerpacks are now installed with the product in the assembly Microsoft.VisualBasic.PowerPacks.VS.DLL. Notice the addition of VS to the name, the namespace remains the same but the assembly name changed.

     

    The PowerPacks that originally shipped with VS 2008 only contained the PrintForm component and the Printer library.  If you install VS 2008 Sp1 (http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en) you will find that all components including the Line and Shape controls as well as the DataRepeater are not included in Visual Studio.

     

    I would recommend using the latest 3.0 version or if you have VS 2008 use the version installed with Sp1.  However, if do need to use earlier versions or run into errors like you have when opening a project that used a different version

     all you should need to do is check the project references, remove missing references and add a reference to the version you have installed and make sure you only have a reference to one powerpack.

     

    I hope that helps.  If this doesn’t solve a particular issue you’re seeing please let me know.


    John Hart (Microsoft)
    Tuesday, September 23, 2008 6:55 PM
  • Hi John,

    Thank you for your response. I've continued testing by opening a specific project that I know references Microsoft.VisualBasic.PowerPacks 3.0 and uses a PrintForm component.

    On a computer that has both PowerPacks 3.0 and PowerPacks.Vs 2.0 the project opens and runs as expected.

    On a computer that has only PowerPacks.Vs 2.0 the following error (jpg) is displayed.

    Error when opening VS 2008 (VB) Project


    This error didn't offer any immediate help and after searching the web and finding only a few simple postings I decided to post here for clarification.

    One other note I made is now that I've removed 3.0 from my VS 2008 and installed SP1, I do have the additional tools, just what I need. But, when I try to open that project the error is back. When I had 3.0 it was gone.

    In the linked jpg I have highlighted the reference in Solution Explorer so its properties would be visible. There is no path. The version is 0.0.0.0. That's pretty much broken isn't it? Also, on the right (oops, I meant left) the tool bar no longer has section for Power Packs 3.0 but I do have the additional tools 3.0 offered. The error indicates PrintForm1 and the method 'InitializeComponent'.

    Does this mean the PrintForm component was the 3.0 version; that's why Microsoft.VisualBasic.PowerPacks is listed as a reference?
    And to sucessfully open the file I would still need version 3.0? The DLL no longer exists on my computer.

    Or, I can keep the file intact but make a few adjustments?

    It doesn't really matter that the PrintFrom component remains does it? Both versions of PowerPacks use it. It was the PowerPack version that expains the error. But without one of the PowerPacks the PrintForm component would still produce an error? It can't be there alone?

    In the Designer.vb file I can simply comment out;

    From Private Sub InitializeComponent()
    Me.PrintForm1 = New Microsoft.VisualBasic.PowerPacks.Printing.PrintForm(Me.components)
    '
    'PrintForm1
    '
    Me.PrintForm1.DocumentName = "document"
    Me.PrintForm1.Form = Me
    Me.PrintForm1.PrintAction = System.Drawing.Printing.PrintAction.PrintToPrinter
    Me.PrintForm1.PrinterSettings = CType(resources.GetObject("PrintForm1.PrinterSettings"), System.Drawing.Printing.PrinterSettings)
    Me.PrintForm1.PrintFileName = Nothing

    'And this private component in another section
    Friend WithEvents PrintFrom1 As Microsoft.VisualBasic.PowerPacks.Printing.PrintForm

    'Also I would need to coment out the procedure in the WhatEverFormName.vb file
    Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
        ' Print (Preview) the Form.

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
        PrintForm1.Print()
    End Sub

    Then I could run the program with error? But the print component would be disabled? I sucessfully tested this but wanted to confirm this would be the correct way to modify the program in a way that it would run without having to actually removing anything.

    Thanks again,
    David Dollar


    • Edited by ddollar Thursday, September 25, 2008 2:24 PM
    Thursday, September 25, 2008 12:06 AM
  • Hi Again John,

    I believe I have found my answer. The program referenced version 3.0 PowerPacks and did so because the PrintForm component that was used in the program came from the Power Packs 3.0 toolbar.

    That created this line in the .vbproj file;
    <Reference Include ="Microsoft.VisualBasic.Powerpacks, Version=9.0.0.0, Culture=neutral, PublickeyToken=b03f5f7f11d50a3a">

    Had the developer used the [regular] Power Packs (2.0) PrintForm component the .vbproj file would have listed;
    <Reference Include ="Microsoft.VisualBasic.Powerpacks.Vs, Version=9.0.0.0, Culture=neutral, PublickeyToken=b03f5f7f11d50a3a">

    The error was displayed because the computer/software attempting to open the file did not have PowerPacks 3.0 installed.

    Short of commenting out lines as I did in my other post; disabling the reference and object, you'd need to install 3.0 to open the file error free.

    Sound right to you?

    Thanks,
    David Dollar
    Thursday, September 25, 2008 2:23 PM