我是.NET核心工具的新手,在运行以下命令时遇到了一个问题;我可以看到它只是一个警告,但即使使用“ sudo dotnet publish -o /publish
”
dotnet publish -o / publish
如您所见,没有发布文件夹
/home/joel/workspace/asp (copy)/api/api.csproj :
warning NU1701: Package 'Faker.Net 1.0.3' was restored using '.NETFramework,
Version=v4.6.1'
instead of the project target framework '.NETCoreApp,Version=v2.0'.
This package may not be fully compatible with your project.
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
/home/joel/workspace/asp (copy)/api/api.csproj :
warning NU1701: Package 'Faker.Net 1.0.3' was restored using '.NETFramework,
Version=v4.6.1'
instead of the project target framework '.NETCoreApp,Version=v2.0'.
This package may not be fully compatible with your project.
api -> /home/joel/workspace/asp (copy)/api/bin/Debug/netcoreapp2.0/api.dll
/usr/share/dotnet/sdk/2.0.2/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET
.Publish.targets(67,5):
error MSB3191: Unable to create directory "/publish2/".
Access to the path '/publish2/' is denied. [/home/joel/workspace/asp (copy)/api/api.csproj]
答案 0 :(得分:0)
显示的警告与发布问题无关。它只是指出Faker.Net 1.0.3
目标是.NET Framework,并且已针对该目标运行时解析,尽管应用程序将在.NET Core上运行。这可能是由于.NET Standard shim,但是该库可能与.NET Core不完全兼容,因此您要检查它与.NET Portable Analizer的兼容性
现在实际问题是您正在编写输出的目录是否受限制以进行访问。因此,为了使它工作,你应该首先获得特权。
尝试dotnet publish -o ./publish2
(注意路径前的点)