Skip to content

[Linux] Failed to publish MVC F# project with error MSB3021 "Unable to copy file ..." #65247

@EmilyFeng97

Description

@EmilyFeng97

REGRESSION INFO: Works well on 10.0.102 and 10.0.103(Feb Servicing) SDK

INSTALL STEPS

  1. Clean Linux OS ,e.g Ubuntu 24.04.3 LTS
  2. Install the .NET 10.0.200-preview SDK from coherent build
  3. Add feed

Platform

  • Windows
  • macOS
  • Linux

Repro Steps

  1. Run open up a normal Terminal Emulator
  2. Create a folder and create an MVC F# project in it:
mkdir MVCFS
cd MVCFS
dotnet new mvc -lang F#
  1. Publish to a local folder:
    dotnet publish
  2. Observe the results

Note:

  1. This issue does not repro on Windows and MacOS.
  2. This issue does not repro when publishing mvc and blazor project.
  3. This issue also repro on Blazor WebAssembly Standalone App.
  4. There is a similar issue file on .NET 11.0: [NETSDKE2E] [Mac][Linux] Publishing Blazor WebAssembly Standalone App failed with error MSB3021with .NET 11 SDK binary installer on Mac or Linux sdk#52635
  5. Here is the binlog file: msbuild.zip

Actual Result
Publishing failed with error MSB3021
Image

Error Log


parallels@ubuntu-linux-22-04-02-desktop:~/MVCFS$ dotnet publish
Restore complete (1.2s)
    info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  MVCFS net10.0 failed with 7 error(s) (27.7s) → bin/Release/net10.0/MVCFS.dll
    /home/parallels/dotnet/sdk/10.0.200-preview.0.26073.117/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(372,5): error MSB3021: Unable to copy file "/home/parallels/MVCFS/Views/Shared/_Layout.cshtml" to "bin/Release/net10.0/publish/../../../../../../MVCFS/Views/Shared/_Layout.cshtml". Access to the path '/home/MVCFS' is denied.
    /home/parallels/dotnet/sdk/10.0.200-preview.0.26073.117/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(372,5): error MSB3021: Unable to copy file "/home/parallels/MVCFS/Views/Shared/_ValidationScriptsPartial.cshtml" to "bin/Release/net10.0/publish/../../../../../../MVCFS/Views/Shared/_ValidationScriptsPartial.cshtml". Access to the path '/home/MVCFS' is denied.
    /home/parallels/dotnet/sdk/10.0.200-preview.0.26073.117/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(372,5): error MSB3021: Unable to copy file "/home/parallels/MVCFS/Views/_ViewImports.cshtml" to "bin/Release/net10.0/publish/../../../../../../MVCFS/Views/_ViewImports.cshtml". Access to the path '/home/MVCFS' is denied.
    /home/parallels/dotnet/sdk/10.0.200-preview.0.26073.117/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(372,5): error MSB3021: Unable to copy file "/home/parallels/MVCFS/Views/_ViewStart.cshtml" to "bin/Release/net10.0/publish/../../../../../../MVCFS/Views/_ViewStart.cshtml". Access to the path '/home/MVCFS' is denied.
    /home/parallels/dotnet/sdk/10.0.200-preview.0.26073.117/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(372,5): error MSB3021: Unable to copy file "/home/parallels/MVCFS/Views/Shared/Error.cshtml" to "bin/Release/net10.0/publish/../../../../../../MVCFS/Views/Shared/Error.cshtml". Access to the path '/home/MVCFS' is denied.
    /home/parallels/dotnet/sdk/10.0.200-preview.0.26073.117/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(372,5): error MSB3021: Unable to copy file "/home/parallels/MVCFS/Views/Home/Privacy.cshtml" to "bin/Release/net10.0/publish/../../../../../../MVCFS/Views/Home/Privacy.cshtml". Access to the path '/home/MVCFS' is denied.
    /home/parallels/dotnet/sdk/10.0.200-preview.0.26073.117/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(372,5): error MSB3021: Unable to copy file "/home/parallels/MVCFS/Views/Home/Index.cshtml" to "bin/Release/net10.0/publish/../../../../../../MVCFS/Views/Home/Index.cshtml". Access to the path '/home/MVCFS' is denied.

Build failed with 7 error(s) in 29.4s
dotnet --info

``
parallels@ubuntu-linux-22-04-02-desktop:~$ dotnet --info
.NET SDK:
Version: 10.0.200-preview.0.26073.117
Commit: 181f879891
Workload version: 10.0.200-manifests.355811b7
MSBuild version: 18.3.0-release-26073-117+181f87989

Runtime Environment:
OS Name: ubuntu
OS Version: 24.04
OS Platform: Linux
RID: linux-x64
Base Path: /home/parallels/dotnet/sdk/10.0.200-preview.0.26073.117/

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
Version: 10.0.2
Architecture: x64
Commit: 4452502459

.NET SDKs installed:
10.0.200-preview.0.26073.117 [/home/parallels/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.2 [/home/parallels/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.2 [/home/parallels/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download


Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions