Results 1 to 9 of 9

Thread: Template with DLL Reference

  1. #1

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Pointless Forest 38.517,-92.023
    Posts
    9,301

    Template with DLL Reference

    I am working on creating a new starting point(template) for all of our new applications so that as much as possible they have the same look and feel. The template has reference to a common DLL we have written. I am able to export the template without issue.

    When I create a new project based on the template the path to the DLL is missing which causes a bunch of errors.

    The prior attempt at creating this standard template has a DLL and when I export it and then use it doesn't have the same issue. I am having difficulty spotting the difference.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  2. #2
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Template with DLL Reference

    Quote Originally Posted by dbasnett View Post
    I am working on creating a new starting point(template) for all of our new applications so that as much as possible they have the same look and feel. The template has reference to a common DLL we have written. I am able to export the template without issue.

    When I create a new project based on the template the path to the DLL is missing which causes a bunch of errors.
    Does the problem manifest itself on the machine/account used to develop the template, or only on other accounts?

    When you say the path is missing, do you mean that the "<HintPath>" tag in the .vbproj file is missing?

  3. #3

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Pointless Forest 38.517,-92.023
    Posts
    9,301

    Re: Template with DLL Reference

    Quote Originally Posted by TnTinMN View Post
    Does the problem manifest itself on the machine/account used to develop the template, or only on other accounts?

    When you say the path is missing, do you mean that the "<HintPath>" tag in the .vbproj file is missing?
    Same machine, same account.

    When I create the new project from the template the path in the references section of the project properties says, "<The system cannot find the reference specified>"
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  4. #4
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Template with DLL Reference

    The only way that I could reproduce that type of error is if the template source project references a class library from a secondary project within the same solution. Does that ring a bell?

  5. #5

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Pointless Forest 38.517,-92.023
    Posts
    9,301

    Re: Template with DLL Reference

    Quote Originally Posted by TnTinMN View Post
    The only way that I could reproduce that type of error is if the template source project references a class library from a secondary project within the same solution. Does that ring a bell?
    I have a project that produces the DLL. The template project has a reference to that.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  6. #6
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Template with DLL Reference

    All I can suggest at this point is to unzip the template and take a look at the ProjName.vbproj file with a text editor to figure out where it is trying to find the DLL. It is just an Xml file.

    Look for a ItemGroup block that looks something like the one below. This one has an absolute path, but they can also be relative.
    Code:
      <ItemGroup>
        <Reference Include="NativeMethods">
          <HintPath>E:\My Documents\Visual Studio 2008\Projects\NativeMethods\NativeMethods\bin\Debug\NativeMethods.dll</HintPath>
        </Reference>
        <Reference Include="System" />
        <Reference Include="System.Data" />
        <Reference Include="System.Deployment" />
        <Reference Include="System.Drawing" />
        <Reference Include="System.Windows.Forms" />
        <Reference Include="System.Xml" />
        <Reference Include="System.Core" />
        <Reference Include="System.Xml.Linq" />
        <Reference Include="System.Data.DataSetExtensions" />
      </ItemGroup>

  7. #7

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Pointless Forest 38.517,-92.023
    Posts
    9,301

    Re: Template with DLL Reference

    Quote Originally Posted by TnTinMN View Post
    All I can suggest at this point is to unzip the template and take a look at the ProjName.vbproj file with a text editor to figure out where it is trying to find the DLL. It is just an Xml file.

    Look for a ItemGroup block that looks something like the one below. This one has an absolute path, but they can also be relative.
    Code:
      <ItemGroup>
        <Reference Include="NativeMethods">
          <HintPath>E:\My Documents\Visual Studio 2008\Projects\NativeMethods\NativeMethods\bin\Debug\NativeMethods.dll</HintPath>
        </Reference>
        <Reference Include="System" />
        <Reference Include="System.Data" />
        <Reference Include="System.Deployment" />
        <Reference Include="System.Drawing" />
        <Reference Include="System.Windows.Forms" />
        <Reference Include="System.Xml" />
        <Reference Include="System.Core" />
        <Reference Include="System.Xml.Linq" />
        <Reference Include="System.Data.DataSetExtensions" />
      </ItemGroup>
    The problem is that the hint path has a relative path instead of an absolute path. The path in the reference is absolute.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  8. #8
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Template with DLL Reference

    Quote Originally Posted by dbasnett View Post
    The problem is that the hint path has a relative path instead of an absolute path. The path in the reference is absolute.
    I do not know how to force the template wizard to use absolute paths. It is probably easiest to just edit the path yourself, save it, and re-zip the template files.

    See: Manually Updating an Existing Template

  9. #9

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Pointless Forest 38.517,-92.023
    Posts
    9,301

    Re: Template with DLL Reference

    Quote Originally Posted by TnTinMN View Post
    I do not know how to force the template wizard to use absolute paths. It is probably easiest to just edit the path yourself, save it, and re-zip the template files.

    See: Manually Updating an Existing Template
    In the .vbproj file for the project that creates the template I changed the HintPath to have the absolute pathname of the DLL. I then created the template and when I used it, the resulting project had the correct path.

    I created a new project and added the same reference. When I looked at the HintPath is had the absolute value. So the question is how did the original path get hosed.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width