none
codebase declaration not working RRS feed

  • Question

  • <assemblyIdentity name="MyDll" publicKeyToken="909411620047c296" culture="neutral"/>
    <codeBase version="1.0.0.0" href="file://c:/lib/MyDll.dll" />

    For the life of me I cannot get the codebase setting to work. I keep getting the following error. My dll is strongly named but codebase does not seem to work. Ideas?

    System.IO.FileNotFoundException was unhandled
    Message: Could not load file or assembly
    'MyDll, Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=909411620047c296'
    or one of its dependencies.
    The system cannot find the file specified

    Monday, November 19, 2012 1:59 PM

Answers

  • Hi Daustin,

    Would you like to test this scenario in a separately project?

    I test it with the following config in a whole new project, it works fine:

    <?xml version="1.0"?>
    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="ConApp-CreateDll" publicKeyToken="41b8b67c1ee37ec3" culture="neutral" processorArchitecture="x86"/>
            <codeBase version="1.0.0.0" href="E:\ConApp-CreateDll.exe"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

    Which config file did you modify?

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by daustin_dev Wednesday, November 21, 2012 3:46 PM
    Wednesday, November 21, 2012 5:02 AM
    Moderator

All replies

  • Hi Daustin,

    Welcome to the MSDN Forum.

    Please try this value: 

    <codeBase version="1.0.0.0" href="c:/lib/MyDll.dll" />

    Without file://

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, November 20, 2012 11:28 AM
    Moderator
  • href="c:/lib/MyDll.dll"

    This does not work either.

    We have many console applications that use one ore more of the same Dlls (the console apps are  launched by windows scheduled tasks)  So are structure might be the follow for the console applications

    C:\consoleapp1\app1.exe

    C:\consoleapp2\app2.exe

    C:\consoleapp3\app3.exe

    What we would then like to do is have a shared folder such as

    C:\Lib

    which would contain any shared Dlls used by the console applications and we would then just set the codebase for the console applications to point to the dll in C:\Lib

    No matter what I try I cannot get this to work. According to the documentation it should but it's obviously not finding my dll

    Tuesday, November 20, 2012 1:05 PM
  • I guess you need a third / like: href=file:///

    Hannes

    If you have got questions about this, just ask.

    In a perfect world,
    users would never enter data in the wrong form,
    files they choose to open would always exist
    and code would never have bugs.

    C# to VB.NET: http://www.developerfusion.com/tools/convert/csharp-to-vb/

    Tuesday, November 20, 2012 3:53 PM
  • Hi Daustin,

    Would you like to test this scenario in a separately project?

    I test it with the following config in a whole new project, it works fine:

    <?xml version="1.0"?>
    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="ConApp-CreateDll" publicKeyToken="41b8b67c1ee37ec3" culture="neutral" processorArchitecture="x86"/>
            <codeBase version="1.0.0.0" href="E:\ConApp-CreateDll.exe"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

    Which config file did you modify?

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by daustin_dev Wednesday, November 21, 2012 3:46 PM
    Wednesday, November 21, 2012 5:02 AM
    Moderator
  • I modified the app.config for my console app.  I'm going to start fresh with a test dll and test console app and see where that gets me.
    Wednesday, November 21, 2012 12:58 PM
  • I did get it to work now.  As far as I can tell if we have multiple executables sharing the assembly in a shared location then everytime we need to update the assembly we could deploy the new version of the assembly but we would still need to update each executable's app.config to update the new assembly version in the codebase declaration.  Is that correct?
    Wednesday, November 21, 2012 3:50 PM
  • Hi Daustin,

    >>we would still need to update each executable's app.config to update the new assembly version in the codebase declaration.  Is that correct?

    Yes, this is right.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, November 22, 2012 6:40 AM
    Moderator