Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

my sneaky Global Assembly Cache

Hi,

I'm trying to build an assemly, and register it in the Global Assemply Cache.  I often change the source and have to recompile, uninstall the assembly from GAC, then re-install the assembly in GAC.  No problem, just a couple lines in my batch file:

csc /t:library /out:FutureShirts.dll AssemblyInfo.cs Global.cs Futura.cs
gacutil /u FutureShirts
gacutil /i FutureShirts.dll

It uninstalls and reinstalls fine.. However,  when I try to access the new methods that I added to the assembly, I get this error:

Method not found: Int32 FutureShirts.Futura.Multiply(Int32, Int32)

Note that this is different from the error I get when I try to access a method that doesn't actually exist:

CS0117: 'FutureShirts.Futura' does not contain a definition for 'Multiplyd'

After a ridiculous amount of testing and changing the name of the namespace and assmebly, I have figured out that the only methods that will work are the methods that are in the assmembly when I register in the GAC the very first time.  After that, any code added will just produce the "Method not found.." error.  It's insane.  Also, I can put the dll in the bin directory, and just run the assembly from there and it works fine..  

So does anyone have any ideas?  I'm about ready to apply the sledge hammer..

Thx - Trevor
0
trevorhartman
Asked:
trevorhartman
  • 3
  • 2
2 Solutions
 
trevorhartmanAuthor Commented:
Note: i did this on another web server with another component and it worked fine.. the only difference is, in my AssemblyInfo.cs file, I forced the version to 1.0.0.0 so I don't have to change the <add assembly /> in my web.config:

[assembly: AssemblyVersion("1.0")]
[assembly: AssemblyKeyFile("FutureShirts.snk")]

Is this a problem?  

maybe I'll try letting it create a new version..
0
 
trevorhartmanAuthor Commented:
wow, THAT WAS IT!  sick.  i  changed it to:

[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyKeyFile("FutureShirts.snk")]

so it created a new version, i modified the web.config, and it works.  

ok so new question for 500 points is:

how do I force it to be version 1.0.0.0 all the time and make it still work..  or.. is there any way I can do this without having to modify the web.config every time?  I'm not using visual studio yet..

Thanks - Trevor
0
 
EugeneTrukhinCommented:
//After a ridiculous amount of testing and changing the name of the namespace and assmebly, I have figured out that the only methods that will work are the methods that are in the assmembly when I register in the GAC the very first time.  After that, any code added will just produce the "Method not found.." error.  It's insane.  Also, I can put the dll in the bin directory, and just run the assembly from there and it works fine..


Sometimes to fix this, you need to stop your IIS and clean-up your temporary ASP.Net files. In this way this kind of problem can be fixed.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
AerosSagaCommented:
0
 
trevorhartmanAuthor Commented:
I have tried manually removing the dll, and the assembly from the GAC.  It didn't work.  I bet it I would need to restart IIS to make it work..
0
 
AerosSagaCommented:
hmm...maybe so
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now