Resource file "**/*.resx" cannot be found. (MSB3552) on VS for Mac
Asked Answered
P

20

47

We can't build solution on vs for Mac version but the same solution can build on vs for windows (vs 2017) and it's worked.

How to fix on this problem ? and can support on both (vs on windows & vs on Mac)

Thanks you. enter image description here enter image description here

/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets

Puglia answered 10/8, 2017 at 7:22 Comment(3)
Just experienced this after trying a debug run from VSCode, reverted all of the changes to a version that built, now even that is failing with the same error, very annoying, proly will have to reinstall .NET Core SDK and Runtime. Removing bin, obj and clean rebuilds did not help me.Avra
Can you share error exception when you build ?Puglia
Hi @Uthen, I've resolved the issue. The scenario I had was the expected one but took me a while. What was happening is that my code was copying the .csproj file inside the project structure on a even deeper path. I had an error with some path resolution in my code which was working fine on the FIRST run. On the second build, the newly created csproj was included but before manually inspecting the project folder I was not aware of this. Removing the additional .csproj and new folder structure and fixing the path gen code fixed this. So seeing this error it must be sth with bad path of a file.Avra
A
50

I was running dotnet core on osx and had the same issue. The problem was that I generated a folder using a windows path. When created on disk, it was not visible in Finder due to its naming \Uploads. Do a ls -la and see if there are any strange folders or files in there. See Image

Alcoholometer answered 24/1, 2019 at 20:42 Comment(9)
On mac as well. I had a strange reference to a folder with a Windows slash too.Vagrant
This was my issue as well. Created C:\ProgramData\SomeFolder on mac, in my working directory.Gitlow
Just had this happen on Ubuntu. Thanks for the hint!Diacaustic
This issue arises when you work with file upload or download and store on a windows location in your code which doesn't work in mac...Prudy
Happened to me on linux as well and helped me find the culprit, thanksCilia
this saved my bacon. Trying to switch over to running inside docker container, I had a piece of code logging to "C:\logs" which created a directory called "C:\logs"Operand
I ran into this issue as well. In my case, the windows path was deeper in the project's file hierarchy so using the Tree command made it easier to find quickly.Khamsin
Had the same issue, in my case a bin\debug\xx folder that I had to manually delete. I'm running MacOS which uses /Woodnote
Also happens if file/folder have trailing whitespaceFormosa
G
21

Check into Finder, in my case, the problem was with the path:

enter image description here

Grandeur answered 2/11, 2021 at 14:36 Comment(0)
V
18

I was trying to fix that problem like a two months and finally found what's wrong. I had backward slash '\' in project files which is Windows style path, but I am using Mac so it was creating directory with plain name 'wwwroot\test' (not nested). If I remove that folder it successfully builds.

Verb answered 29/5, 2018 at 9:4 Comment(0)
D
7

To find the offending files you need to delete, search for a backslash e.g.

find ~/my-project-folder -name '*\\*'
Dewberry answered 3/11, 2022 at 15:12 Comment(1)
This helped me to find out the cause, in my case. I opened a solution that I had been working under Windows a while ago under Linux. The database path configuration value was set to an absolute Windows path, so it created a directory like C:\data under the project's directory. I deleted that directory, and rebuilt the solution.Nacreous
T
4

I'm not sure if you have the same problem that I had. I have a .NET Core project that is running on Windows, but when I tried to run the project on macOS I was getting the error message:

error MSB3552: Resource file "**/*.resx" cannot be found".

In my project, I have a config to store the log files in the folder

"WriteTo": [
  {
    "Name": "RollingFileAlternate",
    "Args": {
      "logDirectory": ".\\Logs",
      "fileSizeLimitBytes": 10485760
    }
  }
]

The first time I run the project, this will create a folder named Logs, but when I run on macOS it will create a hidden folder named .\Logs. So this is a problem, as after that the project will get that error when building.

The solution is to change the config to:

 "WriteTo": [
  {
    "Name": "RollingFileAlternate",
    "Args": {
      "logDirectory": "Logs",
      "fileSizeLimitBytes": 10485760
    }
  }
]

Now, the project can run on macOS.

Because Windows uses the backslash in the directory path, but macOS uses the slash, when you need to build the project in Windows for macOS, you should check all of code related to files, folder, and paths (e.g., the code to create the folder to save log files, create the folder to save upload files, etc.).

Teplitz answered 17/4, 2018 at 9:44 Comment(1)
I would probably have had to ditch the folder tree and re-clone the project to get around this without this tip. From experiencing several years of 'Microsoftisms' using Visual Studio, I knew it was something like this even though this was found while using VS Code on Linux.Alchemy
P
3

Same problem over here. A simple clean did not work for me. I ended up removing the bin and obj folder. After that do a restore of the packages and everything is fine again. Probably a package caching issue.

Promethean answered 11/12, 2017 at 8:16 Comment(0)
T
3

"dotnet run" command was creating an unnecessary keys file every time I run that command. I had to delete this folder to make it work again. This is caused due to usage of windows style path like "C:\SharedDataProtectionKeys" instead of relative path that works for both windows and Linux environments Unnecessary key file

Tumid answered 24/8, 2021 at 21:44 Comment(0)
A
2

I experienced the same thing this evening and I got it to work. I ended up just doing a clean and a build and it worked just fine.

I did however copy the project on a thumb drive and I wasn't using something like Github to transfer the project over. I'm guessing it had some remnants from VS on Windows in the bin/obj directories.

Atomic answered 4/11, 2017 at 2:43 Comment(0)
P
2

Had the same error; figured it had to be due to the path using backslashes after reading these answers.

I messed around with deleting lines that referenced a file using \ in the .csproj file, to no avail.

Took me a while to find it, but I noticed something had created a wwwroot\ImageCache directory. I deleted this directory and the build worked.

Philips answered 17/1, 2019 at 21:9 Comment(0)
M
2

There is an oddly named folder in your project subtree on the Mac. In my case, it was c\/output/.

Delete that folder and the build will be successful.

Then fix the part of your code where the developer used the Windows-specific path separator ('\') instead of Path.DirectorySeparatorChar.

Myotome answered 22/6, 2021 at 19:34 Comment(0)
P
1

I tested today on VS for Mac (last update) and just remove some source code on my solution and re-build all projects, unbelievable its worked and my problem was fixed.

enter image description here

Puglia answered 11/4, 2018 at 3:21 Comment(0)
S
1

We removed obj and bin but doesn't work we removed all of the files which are created with "\" but the project doesn't work. At finally we pull the project from git and build again and it works (Note: We don't do new commit when cloning the project from git)

I think it can be happened cache or like that

Sykes answered 21/1, 2020 at 8:53 Comment(0)
J
1

There's another posibility how it might happen. Experienced on Windows (10) and VS 2017 when moved and renamed a checkout (svn). Maybe because there were some broken symbolic links.

What helped: Copy the checkout instead of moving it, don't follow any symbolic links.

Josh answered 16/1, 2021 at 10:9 Comment(1)
That was it in my case, I had a broken symbolic link - windows 2016. Thanks for posting this!!Intitule
V
1

If you are building your project through Docker, set WORKDIR explicitly.

eg: WORKDIR /app

Vina answered 18/3, 2022 at 22:59 Comment(1)
save me a days !!!Demos
M
0

Verify that in your project file structure you do not have any new files generated, and as in my scenario you did not create any new .csproj, .vbproj or .fsproj files (which could be nested somewhere deep). Deep file paths also can cause this non-verbose issue. Make sure you do not nest stuff too deep.

Mccartney answered 5/11, 2018 at 9:51 Comment(0)
L
0

In macOS, you can create a folder containing slash or backslash.

enter image description here

Problematic code on macOS example:

var path = Path.Combine(HostingEnvironment.ContentRootPath, "UploadedAttachments\Answer");

if (!Directory.Exists(path))
{
    Directory.CreateDirectory(path);
}
Leon answered 20/10, 2020 at 12:39 Comment(1)
I made the same post some years ago below:) yeah, hard timesVerb
G
0

I had the same problem and I deleted some new directories with backward slash "" created in my project, deleted all those directories and build worked fine.

Gorga answered 24/6, 2022 at 5:34 Comment(0)
F
0

If your project is stored in a OneDrive synced folder, this is possibly the culprit. I was getting this error and realized I had a number of folders giving the error "The Tag Present in the Reparse Point Buffer Is Invalid" in my project directory. Running chkdsk /f /x (and restarting because this was on my main drive) fixed this for me, but this article details some other fixes if this does not fix it for you

Fidellia answered 31/7, 2022 at 7:3 Comment(0)
Z
0

I had the same error on Ubuntu 22.04 compiling an ASP.net Core project which gets developed on both Ubuntu and MS Windows simultaneously.

After checking the folder structure I found that there where folders created ending with a backslash.

I renamed them by removing the backslash. The error got solved this way.

This happens while build and run the same branch without any changes. So I'm really confused what went wrong.

Zita answered 21/7, 2023 at 11:12 Comment(0)
A
0

I had this problem in VS2019 on Windows 10, in September 2023, ie. after it had been in use and running for years and with numerous updates. I had a large project I hadn't touched for several months and when I loaded it in VS2019 I got this error. In the Solution Explorer there was a red "x" on "**" and "*.resx". I just "Remove"d them in Solution Explorer, and did a clean and build, and it worked again.

Files missing in Solution Explorer

Albite answered 7/9, 2023 at 10:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.