<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unable to find assembly in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3337629#M57197</link>
    <description>&lt;P&gt;Just guessing here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps you can use getexecutingassembly path or location to add to the file you are trying to open?&lt;/P&gt;</description>
    <pubDate>Fri, 17 Feb 2012 23:28:22 GMT</pubDate>
    <dc:creator>fieldguy</dc:creator>
    <dc:date>2012-02-17T23:28:22Z</dc:date>
    <item>
      <title>Unable to find assembly</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3336491#M57194</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a dll which shows simple dialog, which in its constructor reads from a file located in the same folder as the dll, to populate some of the controls in the form, like combo boxes. The assembly works perfectly at local pc, but when I take release copy of the dll and the file at work, I cannot read from the file.&lt;/P&gt;&lt;P&gt;I am able to load the dll with the Netload, but when i start the command it shows - "Unable to find assembly 'Pressurized Pipes, Version=1.0.0.0, Culture=neutral, PublicKey Token=null'. And when I click OK button shows second dialog saying "Unhandled exception has occurred in a component in your application. If you continue, the application will ignore this error and attempt to continue. Invalid Argument=Value of '0' is not &amp;nbsp;valid for 'SelectedIndex'. Parameter name: SelectedIndex.&lt;/P&gt;&lt;P&gt;Details:&lt;/P&gt;&lt;P&gt;See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.&lt;/P&gt;&lt;P&gt;************** Exception Text ************** System.ArgumentOutOfRangeException: InvalidArgument=Value of '0' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value) at Plumbing_Pipes.Pressurized_Pipes_Form.populatePipeTypeComboBox() at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message&amp;amp; m) at System.Windows.Forms.Control.WndProc(Message&amp;amp; m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp;amp; m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)&lt;/P&gt;&lt;P&gt;It seems to me that I am not able to Deserialize the file and read from the list in the file, which list I use to populate the combobox.&lt;/P&gt;&lt;P&gt;I am using just the name of the file to deserialize it, assuming that the dll will look in the folder where the dll is located. Is that what I am doing wrong.&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2012 10:00:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3336491#M57194</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-17T10:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to find assembly</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3336659#M57195</link>
      <description>&lt;P&gt;i guess you fill a combobox with some data from the file, but the file was not found, so the combobox has no items and you try to select the first item of the combobox&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;don't select the item if the combobox is empty - that should solve the error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but what you really need is find the file you want to read&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how do you specify the path for that file? check if the path is not different on the other computer&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2012 13:06:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3336659#M57195</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-17T13:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to find assembly</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3337503#M57196</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and thank you for you quick responce.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The file which holds some data for initializing the controls is located in the same folder as dll. This is the constructor for the form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;public Pressurized_Pipes_Form()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileStream fs = new FileStream("Pressurized Pipe Settings.bin", FileMode.Open, FileAccess.Read);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BinaryFormatter bf = new BinaryFormatter();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; listPipeTypes = bf.Deserialize(fs) as List&amp;lt;PipeType&amp;gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception e)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(e.Message);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; finally&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fs.Close();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and later I try to populate the combobox like that:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;private void populatePipeTypeComboBox()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.cbPipeType.Items.Clear();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (PipeType pt in listPipeTypes)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.cbPipeType.Items.Add(pt.PipeTypeName);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.cbPipeType.SelectedIndex = iPipeType;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to be able to have dll and the file in same folder. &amp;nbsp;It still puzzels me why the code works in one case and not in others.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a bullet proof way to tell my consturctor: Take the folder of where the dll is run from and look for the file in it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont like to have absolute paths since they will change from pc to pc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for you help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2012 21:38:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3337503#M57196</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-17T21:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to find assembly</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3337629#M57197</link>
      <description>&lt;P&gt;Just guessing here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps you can use getexecutingassembly path or location to add to the file you are trying to open?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2012 23:28:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3337629#M57197</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2012-02-17T23:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to find assembly</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3337643#M57198</link>
      <description>&lt;P&gt;System.Reflection namespace may offer some tools of use.&amp;nbsp; Or, if you are demand loading you could check the registry to check the demand load path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Myself, I'm not too keen on forcing a datafile to exist in one&amp;nbsp;location unknown until runtime; if it were up to me I'd follow other applications and create a registry key to point to the install folder and a use a hard-coded relative path in the code, or a full path in the registry and a hard-coded file name, or a configuration file in the&amp;nbsp;active drawings folder, or some similar means of explicitly locating the file.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2012 23:59:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3337643#M57198</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2012-02-17T23:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to find assembly</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3338621#M57199</link>
      <description>&lt;P&gt;If you have the file in some of AutoCAD search paths, then you can use this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim myPath As String = HostApplicationServices.Current.FindFile("myFile.ext", HostApplicationServices.WorkingDatabase, FindFileHint.Default)&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2012 07:15:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3338621#M57199</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-20T07:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to find assembly</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3347161#M57200</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks guys for all of your suggestions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Last couple of days I was experimenting with all of them and none of them helped. &amp;nbsp;I really liked and implemented the idea of using reflection to find the path to the dll and thus location of my file. &amp;nbsp;I am really scared to work with registry, and going in that direction for a simple dll like mine, was no for me. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Just for fun, I tried to test my dll on third pc at work and for my surprise it worked perfectly. &amp;nbsp; Both pcs, where I was able to run the dll, have AutoCAD 2012, while the one where I cannot, have AutoCAD MEP 2011 and Revit 2012 installed.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It seems to me now, that may be not finding the file, but&amp;nbsp;deserialization of my list&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is the culprit. &amp;nbsp;The list is not deserialize, combobox is empty and exception is thrown when I try to set the selected item to the first one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas if having AutoCAD MEP 2011 and Revit 2012 can mess up the serialization / deserialize process?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2012 07:54:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-find-assembly/m-p/3347161#M57200</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-25T07:54:13Z</dc:date>
    </item>
  </channel>
</rss>

