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
LVL 8
trevorhartmanAsked:
Who is Participating?
 
EugeneTrukhinConnect With a Mentor Commented:
//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
 
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
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.