New error: 'Could not load file or assembly...'

Last post 08-14-2007 3:04 PM by stupid. 7 replies.

Sort Posts:

  • New error: 'Could not load file or assembly...'

    08-13-2007, 2:33 PM
    • Member
      414 point Member
    • stupid
    • Member since 06-19-2006, 10:44 AM
    • Posts 130

    I just recently ran into a new error that is confusing me quite a bit.  I took a 3 week vacation and when I came back, I get this error, but ONLY on my local machine (never happened before I left).  The code runs fine on the production box.  Also, keep in mind that we do constant updates where I work, so that is what I am suspecting caused the problem.  Here is the error: 

    Could not load file or assembly 'System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The module was expected to contain an assembly manifest.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.BadImageFormatException: Could not load file or assembly 'System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The module was expected to contain an assembly manifest.

    Source Error:

    Line 477:        SqlCommand cmdFillData = new SqlCommand(strFillData, conExists);
    Line 478:
    Line 479:        conExists.Open();
    Line 480:
    Line 481: 

    One of my coworkers said that this could be caused by a machine.config file being altered, but my local machine never was.  Any ideas?  Thank you very much, and please let me know if there is anything I can clarify.

    "If God exists, I hope he has a good excuse."
    -Woody Allen

    DailyAtheistQuote
    naspinski.net
    AuctionConstructor
  • Re: New error: 'Could not load file or assembly...'

    08-13-2007, 3:38 PM
    • Star
      11,196 point Star
    • Bruce L
    • Member since 02-08-2007, 1:53 PM
    • Posts 1,879

    System.Transaction should be part of .NET framework and it should be installed in the GAC.  I suspect your update somehow removed it from the GAC.

    Check to see if system.transaction is in the GAC.

    • Open Windows Explorer
    • Navigate to c:\windows\assembly
    • Check if System.Transaction is there
    • If not, you may need to reinstall the assembly into the GAC.

     

    Bruce
    DiscountASP.NET - ASP.NET Hosting Experts
    Voted 2009 "Best ASP.NET Hosting" by asp.netPRO Magazine
    Win2008/IIS7.0, ASP.NET 2.0/3.5 SP1, MVC, AJAX, Silverlight, SQL 2008/2005
  • Re: New error: 'Could not load file or assembly...'

    08-14-2007, 12:11 PM
    • Member
      414 point Member
    • stupid
    • Member since 06-19-2006, 10:44 AM
    • Posts 130

    Ok, I do see:

     System.Transactions Version 2.0.0.0

    Is that the one I need?  Or is there a seperate one called 'System.Transaction' with no S?

    Also, what is the GAC and how would I go about reinstalling it?

    Thanks for trying to help!

    "If God exists, I hope he has a good excuse."
    -Woody Allen

    DailyAtheistQuote
    naspinski.net
    AuctionConstructor
  • Re: New error: 'Could not load file or assembly...'

    08-14-2007, 12:35 PM

    Looks like the reference path has been alterered. Pls check your references path for the assembly in the VS .NET IDE.

    Sridhar
  • Re: New error: 'Could not load file or assembly...'

    08-14-2007, 1:01 PM
    Answer
    • Contributor
      2,024 point Contributor
    • kckriegs
    • Member since 08-15-2005, 7:55 PM
    • Posts 435
    1. GAC reinstallation - use "gacutil.exe assemblypath -i", from your vs.net command prompt
  • Re: New error: 'Could not load file or assembly...'

    08-14-2007, 1:15 PM
    • Member
      414 point Member
    • stupid
    • Member since 06-19-2006, 10:44 AM
    • Posts 130

    SRIDHAR ANJANAPPA:

    Looks like the reference path has been alterered. Pls check your references path for the assembly in the VS .NET IDE.

     How do I do that?

    "If God exists, I hope he has a good excuse."
    -Woody Allen

    DailyAtheistQuote
    naspinski.net
    AuctionConstructor
  • Re: New error: 'Could not load file or assembly...'

    08-14-2007, 1:42 PM
    • Member
      414 point Member
    • stupid
    • Member since 06-19-2006, 10:44 AM
    • Posts 130

    kckriegs:
    1. GAC reinstallation - use "gacutil.exe assemblypath -i", from your vs.net command prompt

    Ok, I tried typing in: 'gacutil.exe c:\windows\assembly -i' into my VS2005 prompt, turns out that wasn't the correct syntax.  THen I figured out it was:

    Gacutil /i assembly path [options]

    So I tried: 'Gacutil /i C:\WINDOWS\assembly'

    And that didn't work, so I tried 'Gacutil /i C:\WINDOWS\assembly /f' to force it and that gave me the same error which is:

    'Failure adding assembly to the cache: The Filename, directory name, or volume label syntax is incorrect.'

    Now that is exactly the path I find my assemblies at now, what could be the problem, or what am I doing wrong? 

    Thanks again everyone.

     UPDATE

    Ok, figured out how to add it to my GAC, and that is still not it.  (its 'gacutil -I "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll" from the regular prompt at C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin)

    Now it is either a 'dependancy' as the error states, or something completely different.  Can I just puss an entire GAC assembly reinstall?

    "If God exists, I hope he has a good excuse."
    -Woody Allen

    DailyAtheistQuote
    naspinski.net
    AuctionConstructor
  • Re: New error: 'Could not load file or assembly...'

    08-14-2007, 3:04 PM
    Answer
    • Member
      414 point Member
    • stupid
    • Member since 06-19-2006, 10:44 AM
    • Posts 130

    WOOHOO!  figured it out.  After I reinstalled the 'System.Transactions' into my GAC, it didn't work, BUT - I forgot to restart VS, once I did... boom, it worked.  Thank you ASP.net forums!!!

     To install it into your GAC, simply navigate to:

    C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin

    in your command prompt (not the .NET on, the regular one) and type in:

    gacutil -I "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll"

    or change it to whatever .dll file you need installed

    "If God exists, I hope he has a good excuse."
    -Woody Allen

    DailyAtheistQuote
    naspinski.net
    AuctionConstructor
Page 1 of 1 (8 items)