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:
I faced this issue for running Migration command.Update-Database
in Package Manager console.
Accepted answer didn't solve my problem.
I had to change Build Action from Compile
to Embedded Resource
and It worked for me.
You can do the same using below steps:
When I tried sharing a resource.resx file from one C# project with another C# project, I got this problem. The suggestion on moving the Form class to the beginning of its file wasn't appropriate. This is how I solved it. You essentially use a link from the second project to the first, then enable regeneration of the resource.designer.cs
file.
Properties/Resources.resx
fileProperties/Resources.resx
file as a LINK to the Properties folder in the second project. Don't add it to the root level of the project.Properties/Resources.designer.cs
!Resources.resx
, add ResXFileCodeGenerator
as the CustomToolResources.resx
and select "Run Custom Tool". This will generate a new designer.cs file.Note: I would avoid editing the resource.designer.cs file, as this is autogenerated.
Double Click properties in Application section check Assembly name and default namespace are the same
It happens because the *.resх
is excluded from migration.
I have a WinForms application with a single project in the solution.
Targeting .NET Framework 4.0
Using SharpDevelop 4.3
as my IDE
Sounds silly, but I happened to have the Logical Name
property set to "Resources"
on my "Resources.resx"
file. Once I cleared that property, all works hunky-dory.
Normally, when you add random files as EmbeddedResource
, you generally want to set the Logical Name
to something reasonable, for some reason, I did the same on the Resources.resx
file and that screwed it all up...
Hope this helps someone.
I found that deleting the designer.cs file, excluding the resx file from the project and then re-including it often fixed this kind of issue, following a namespace refactoring (as per CFinck's answer)