error MSB3552: Resource file "**/*.resx" cannot be found. [/ConsoleApp1.csproj]

问题场景:

练习在docker下操作netcore,镜像为centos7,安装完netcore sdk 2.2后,执行操作:

dotnet new console
dotnet run

出现报错:

/usr/share/dotnet/sdk/2.2.104/Microsoft.Common.CurrentVersion.targets(3049,5): error MSB3552: Resource file "**/*.resx" cannot be found. [/ConsoleApp1.csproj]

The build failed. Please fix the build errors and run again.

当时的目录为:

total 24
-rw-r--r--.   1 root root   178 Feb 27 06:35 ConsoleApp1.csproj
-rw-r--r--.   1 root root   193 Feb 27 06:35 Program.cs
-rw-r--r--.   1 root root 12076 Dec  5 01:37 anaconda-post.log
lrwxrwxrwx.   1 root root     7 Dec  5 01:36 bin -> usr/bin
drwxr-xr-x.   5 root root   360 Feb 27 06:30 dev
drwxr-xr-x.   1 root root  4096 Feb 26 14:46 etc
drwxr-xr-x.   2 root root     6 Apr 11  2018 home
lrwxrwxrwx.   1 root root     7 Dec  5 01:36 lib -> usr/lib
lrwxrwxrwx.   1 root root     9 Dec  5 01:36 lib64 -> usr/lib64
drwxr-xr-x.   2 root root     6 Apr 11  2018 media
drwxr-xr-x.   2 root root     6 Apr 11  2018 mnt
drwxr-xr-x.   3 root root   166 Feb 27 06:36 obj
drwxr-xr-x.   2 root root     6 Apr 11  2018 opt
dr-xr-xr-x. 109 root root     0 Feb 27 06:30 proc
dr-xr-x---.   1 root root    91 Feb 27 06:36 root
drwxr-xr-x.   1 root root     6 Feb 26 14:47 run
lrwxrwxrwx.   1 root root     8 Dec  5 01:36 sbin -> usr/sbin
drwxr-xr-x.   2 root root     6 Apr 11  2018 srv
dr-xr-xr-x.  13 root root     0 Feb 27 06:25 sys
drwxrwxrwt.   1 root root    65 Feb 27 06:36 tmp
drwxr-xr-x.   1 root root    81 Dec  5 01:36 usr
drwxr-xr-x.   1 root root    78 Dec  5 01:36 var

然后新建了一个文件夹:

mkdir testASPNETCORE
chmod 777 testASPNETCORE
cd testASPNETCORE/
dotnet new console
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /testASPNETCORE/testASPNETCORE.csproj...
  Restoring packages for /testASPNETCORE/testASPNETCORE.csproj...
  Generating MSBuild file /testASPNETCORE/obj/testASPNETCORE.csproj.nuget.g.props.
  Generating MSBuild file /testASPNETCORE/obj/testASPNETCORE.csproj.nuget.g.targets.
  Restore completed in 155.46 ms for /testASPNETCORE/testASPNETCORE.csproj.

Restore succeeded.
[root@359ed069320e testASPNETCORE]# ll
total 8
-rw-r--r--. 1 root root 196 Feb 27 06:55 Program.cs
drwxr-xr-x. 2 root root 162 Feb 27 06:55 obj
-rw-r--r--. 1 root root 178 Feb 27 06:55 testASPNETCORE.csproj
[root@359ed069320e testASPNETCORE]# dotnet run
Hello World!

看来好像是路径和权限问题

继续测试

mkdir testAspNetCore2
cd testAspNetCore2/
dotnet new console
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /testAspNetCore2/testAspNetCore2.csproj...
  Restoring packages for /testAspNetCore2/testAspNetCore2.csproj...
  Generating MSBuild file /testAspNetCore2/obj/testAspNetCore2.csproj.nuget.g.props.
  Generating MSBuild file /testAspNetCore2/obj/testAspNetCore2.csproj.nuget.g.targets.
  Restore completed in 158.03 ms for /testAspNetCore2/testAspNetCore2.csproj.

Restore succeeded.

[root@359ed069320e testAspNetCore2]# dotnet run 
Hello World!

看来确定是路径问题,权限不设置777也可以.

posted @ 2019-02-27 15:04  幸福安康  阅读(1729)  评论(0编辑  收藏  举报