Search code examples
c#asp.net-mvcazurevisual-studio-2015azure-sdk-.net

Azure Publish Error - Could not copy the file obj\Debug\build.force


I tried to publish my Azure Cloud project, and I am getting the following error message

Could not copy the file obj\Debug\build.force because it was not found
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure Tools\2.8\Microsoft.WindowsAzure.targets

I am getting this error when I tried to publish by right clicking on the cloud project, selecting build configuration Debug, and then clicking publish.

If I select build configuration Release it published successfully.

Looks like this is happening intermittently .

Even when I select Release mode, I am getting the above same error:

  • Right-click Cloudproject
  • Select Publish
  • Select Environment Staging
  • Select Build Configuration Release

UPDATE Whenever I got this error ,I tried with different combinations between Staging / Production/ Release during publish and sometimes it works.

Any ideas as to what could be going wrong?

I am using Windows 10, VS2015 and the Azure SDK 2.8


Solution

  • I get this error too often. I solve this error the following way.

    1. Open notepad++ in admin mode.
    2. Open the .csproj file of my project in notepad++.
    3. Remove the following line from .csproj file.

      "Content Include=obj\\Debug\\build.force"

    4. Save .csproj file.

    5. Reload the project in visual studio.
    6. Publish the project.

    This solution works for me. Hope it works for you.