How to resolve error (3074,5)

vaishali tyagi 0 Reputation points
2023-04-11T11:52:29.52+00:00

I want to publish my code. But i am facing this error. C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VisualStudio\v17.0\Web\Microsoft.Web.Publishing.targets(3074,5): Error : Copying file bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml to obj\Release\Package\PackageTmp\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml failed. Could not find file 'bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml'.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,608 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
940 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
964 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 27,271 Reputation points Microsoft Vendor
    2023-04-12T09:41:19.5666667+00:00

    Hello @vaishali tyagi ,

    Welcome to Microsoft Q&A forum.

    Can you confirm that this file bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml exists?

    I suggest first try to clean project cache(remove/rename .vs/bin/obj folders) and rebuild then publish your project again.

    Please also try to install/update following NuGet package => Microsoft.CodeDom.Providers.DotNetCompilerPlatform (right-click your project/Manage NuGet Packages/Switch to Browse tab/search and install it).

    If above methods don’t work, please try to clean NuGet cache by following this document: Clearing local folders and restore NuGet packages => rebuild => publish your project.

    In case the issue is caused by Visual Studio, please try to reset VS settings(run devenv /ResetSettings in Developer Command Prompt for Visual Studio 2022 Community) and if this issue can be reproduced in newly created projects, please let us know.

    BTW, please check if there's any related reference/nuget package which need to be updated to a higher version.

    Feel free to let us know the results.

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. jhonwillsone 0 Reputation points
    2023-04-12T12:09:52.72+00:00

    The error message you're seeing indicates that Visual Studio is failing to copy a file called Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml to a particular location during the build process. Specifically, it's looking for the file in the bin directory, but it can't find it. There could be a few reasons why this error is occurring. Here are a few things you can try:

    1. Check that the file exists: Make sure that the file Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml actually exists in the bin directory. If it's missing, try rebuilding your project or adding the file manually.
    2. Check your build settings: Make sure that your build settings are configured correctly. For example, check that the output directory is set correctly and that all required files are included in the build.
    3. Clean your project: Sometimes, leftover files from previous builds can cause issues. Try cleaning your project by going to Build > Clean Solution in Visual Studio, and then rebuild your project.
    4. Check for file locks: It's possible that the file is being locked by another process and can't be copied. Try closing any other applications that might be using the file and try building again.

    it works for me in my website hybrid mattress If none of these solutions work, you could try searching for similar issues on the Microsoft community forums or submitting a support ticket to Microsoft.

    0 comments No comments

  3. Putluru Vaishnavi 0 Reputation points
    2023-10-09T16:55:33.99+00:00

    Happens when the file path is too long. You could try putting the project folder directly in any other D drive