7

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

Brendan Green
  • 11,676
  • 5
  • 44
  • 76
roney
  • 964
  • 3
  • 15
  • 37
  • Possible solution here: http://stackoverflow.com/questions/11953741/appharbor-fails-to-publish-asp-net-mvc-4-application Suspect he removed the `` tag from the project, as it seems that this file doesn't always exist so you probably don't want it. – Brendan Green Jan 04 '16 at 23:21
  • Which file do I need to include the above tag.? I saw the answer on the link you mentioned .But I am not clear where to add that tag .Microsoft.WindowsAzure.targets ? or application .proj file ? or Cloud.proj file ? – roney Jan 05 '16 at 04:37
  • If it is to be added within the cloud proj file then which setting or tag should I include ? – roney Jan 05 '16 at 04:44
  • Either your `application.proj` or the `Cloud.proj` - should be pretty each to open each of them and search for `build.force`. – Brendan Green Jan 06 '16 at 21:38
  • I tried adding to the .proj ,but no luck – roney Jan 21 '16 at 00:20
  • I think you need to **remove** that tag, if it exists, for the `build.force` file. – Brendan Green Jan 21 '16 at 00:21

1 Answers1

7

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.

Albert Einstein
  • 7,472
  • 8
  • 36
  • 71
Siddarth Kanted
  • 5,738
  • 1
  • 29
  • 20