This is REALLY frustrating! I have a common library of code I use across projects. However for some reason my extensions have stopped working in this project. I have used them in plenty of other projects and I have no idea what’s stopping them working now! Grr!
Here’s an example extension so you can see how they’re set up.
public static string ToAlphaNumeric(this string InputString)
{
string OutputString = string.Empty;
OutputString = Regex.Replace(InputString, @"[^a-zA-Z_0-9]+", "-");
OutputString = Regex.Replace(OutputString, "[_]+", "-");
OutputString = OutputString.Trim(new char[] { '-' });
return OutputString;
}
My current project is v4.0 and my code library is 3.5, though I have tried upgrading it to 4.0 but that dosn’t fix it. I add a reference to the top of every page because I can’t get defining it in the web.config to work.
It is definitely referenced on my page and found in the intellisense. However when I build the project I get an error which says ‘string’ does not contain a definition for ‘ToAlphaNumeric’. But it does! Why do I get this error?
I apologise if I’ve missed any needed info, tried to include everything I can think of.
Thanks!
Set both projects to 3.5 – no real answer to this issue..