Archive | .NET RSS for this section

Unable to See New Method on GAC’d Assembly

A team member and I were having a heck of a time a couple of weeks back as we tried to make use of a new method added to a POCO class that Ravi created.

For what appeared to be no reason (at the time), the newly created method was unavailable to external classes and assemblies.  The code looked something like this:


public class StringOperations
{
public static string NewOperation(string str)
{
return string.IsNullOrWhiteSpace(str) ? null : str;
}
...other operations
}

Nothing out of the ordinary here.  It’s a pretty simple function–just returns a null if you pass in a null or white-space string, otherwise the string itself.  However when this was referenced either by project reference or by referencing the assembly directly, it wasn’t available through intellisense and any attempt to build with a call to the function resulted in failure.

As we were scratching our heads, we tried a number of things you typically do when Visual Studio doesn’t allow you to build code with an external method call, such as:

  • Rebuild all the projects
  • Clean/Rebuild
  • Un-Reference/Re-Reference
  • Restart Visual Studio
  • Reboot the machine
  • …etc

The assembly had been deployed to the GAC previously, so we wanted to see if that played a role in our troubles.  As it turned out, it did.

When an assembly is in the GAC its definition, for better or worse, is contained there as well and it appears that, regardless of how we’re referencing it, Visual Studio likes to use that version.  So in our next attempt we wanted to remove the assembly from the GAC using gacutil like so:

gacutil /u [AssemblyName].dll

Unfortunately, this did not work either.  The next thing we tried was to un-GAC the assembly by manually deleting it from the cache.  This had worked for me in the past, but it failed here as well.

My colleague then tried using gacutil in a different way.  This time, giving a fully-qualified assembly reference, like so:

gacutil /u "[ourAssemblyName], Version=1.0.0.0, Culture=neutral, PublicKeyToken=[thePublicKey]"

Bingo!  That did it.  Perhaps through the build/re-build and gac/re-gac process of our development, we confused Visual Studio or .NET on our machines.  I have no idea.  But one more thing to try if you hit the gac/re-gac stage is to use the fully-qualified overload of gacutil /u.

Good luck!  I hope it helps!

Code Campin’ on April 27!

On Saturday, April 27, I’ll be presenting “Developing a Messaging Solution with BizTalk 2013” at the University of Minnesota campus as part of Twin Cities Code Camp.  It’s always fun to attend and present in this venue.  If you’re in the Twin Cities that day, I’d highly recommend checking out mine and as many of the other presentations as you can.  And it’s FREE!

Here’s the abstract for my bit:

Service Oriented Architectures and Message-Based solutions have been a mainstay in enterprise development over the past few years. This session will show how to use Microsoft BizTalk Server 2013 to implement a messaging solution using service-oriented principles. Topics include an overview of Microsoft BizTalk Server, creating a schema, configuring the messaging solution, and what’s new with BizTalk 2013.

Be sure to check out a list of all the sessions on the schedule.  You can register here.  See you at Camp!

Great Fun @ TechFuse!

Thanks to all the folks who attended my session on “Getting Started with WCF 4.5” at TechFuse 2013!  And also thanks to Benchmark Learning for putting on such a great, and well-attended event.   It was much fun and an honor to be able to teach in this venue.   If you’d like you can download the presentation slides here or the slides and demo code from my SkyDrive.

See You at TechFuse 2013!

I’ve been honored with the opportunity to present a session at TechFuse 2013.  I’ll be presenting “Getting Started with WCF 4.5“.

Here’s the abstract:

With the newly released Windows Communication Foundation (WCF) 4.5, Microsoft has done much to simplify the creation of services. In this session, we’ll show you how to create a service using WCF 4.5 and Microsoft Visual Studio 2012. Some of topics we’ll discuss are service oriented architecture (SOA) considerations, creating service and data contracts, hosting the service, consuming WCF services and an overview of some of the new features of WCF 4.5.

Thanks to Benchmark Learning for hosting such a great event.  If you’re in the Twin Cities and have the time, I hope to see you at the Minneapolis Convention Center on March 21!

http://www.benchmarklearning.com/Event/TechFuse/Default.aspx

%d bloggers like this: