I have two ASP.NET Web projects (ProjectA and ProjectB). When class in ProjectA is instantiating a class of ProjectB which uses a resource file Blah.resx, I get this error:
Another thing to check is if you have LogicalName or ManifestResourceName defined on the EmbeddedResource. Make sure those are defined appropriately if your project file is using them as they can cause the resources to live under a name you are not expecting.
As far as this case is concerned check if the assembly containing resources has the default namespace set to the same text (Project->Properties->Default namespace; in VS) Check as well if the resx file has a property BuildAction set to "Embedded resource" Enjoy... ;)
In my case a series of badly thought global text replacements had inadvertently changed this line in the resource designer cs file.
Since the namespace in that argument did not match the namespace of the class anymore, the application got confused at run time.
Check that the namespace of the designer matches the string argument in that line.
In my case, the issue caused by defining class the wrong way:
namespace MyBuggyWorld
{
public class BackendObject //This hack broke the VS 2017 winform designer and resources linker!
{
public TcpClient ActiveClient { get; set; }
public BackgroundWorker ActiveWorker { get; set; }
}
public partial class FormMain : Form
{
}
}
After Reallocating BackendObject
to the end (better to separate file), doing project clean + rebuild resolved the issue.
One approach would be to put the shared classes/resources in a separate class library project and refer them in both the web sites.
Just another case. I copied a solution with two projects and renamed them partially in the Windows explorer (folder names, .sln and .csproj file names) and partially with a massive Find & Replace action in Visual Studio (namespaces etc.). Nevertheless the exception stated by the OP still occurred. I found out that the Assembly and Namespace names were still old.
Although the project and everything else was already named OfficeStyle the Assembly name
and Default namespace
were still named Linckus.
After this correction everything worked fine again, compile and run time :)