Build succeeds, but publish fails

♀尐吖头ヾ 提交于 2019-11-28 09:35:54

In my experience this can happen when files are added/removed from different branches of your source control and an imperfect merge causes the project file structure and the actual file structure to diverge.

This could be one of several options:

  • A file was deleted but the project still references it. Will fail to compile, will fail to publish.
  • A file was added but is not referenced by the project. May compile, depends whether the class/methods are referenced elsewhere in the project/solution. If compiles, will publish.
  • A file was added, but the project merge caused it to appear more than once in the project listing. Will compile, will fail to publish.

The solution is to look at the source control logs and trying to identify the bad merge to the project file for the above issues, then fixing the project file accordingly.

Me also faced same issue, I just removed yellow marked file from visual studio project solution & it worked fine for me.

Exclude the bin (and/or) obj folder from project and publish. This worked for me

I had this issue recently publishing to Azure. I ended up deleting all the files in the bin folder( deleted all files WITHIN visual studio solution explorer under bin folder, but leave the bin folder itself empty) , and rebuilding the project. This seemed to make visual studio happy and azure publish worked. hope this helps

This worked for me: Manually delete the obj folder, rebuild, then publish. Somehow some permission in the obj folder got stuck, and deleting/recreating the folder cleared the error.

I removed bin & obj folder and also the content of the inetpub/wwwroot/myapp and problem solve

nothings work for me. deleting obj and bin file-clean-changing webservice name-shorten webservice name.

But at all,

+Expand your Reference.svcmap from visual studio.

+Update reference.

+And delete yellow warning datasources.

works for me

open projectname.csproj file in notepad and remove obj\debug\project name.csprojResolveAsseblyReference.cache line

I recently faced the same issue. And I actually traced it by searching the file which was missing.

Reason for the error : In visual studio I had included the file and later on deleted it from file system.(but not from visual studio). VS had still had the reference to that file. So once I deleted the reference from VS I was able to publish successfully !

I ran into a similar problem when I manually copied a folder into a project (in my case ckeditor). It built fine and ran locally with no issues. However, when publishing the folder was ignored. It turns out I had to create the empty folder 1st and then copy in the folder contents. Visual Studio needs to know the item was created it appears, because after that it was recognized upon publishing.

This issue may come because of move project from one solution to another solution or moving to another source control.

Simple way to resolve this issue:

  1. Take the current project backup and remove you current project from solution.

  2. Add new project to your solution and include your files from backup and rebuild your project and done.

The cause of it is the transfer your project from different environment. To solve it, delete "obj" folder from your project directory as well as from solution explorer by right click on "obj" folder.

After that build your project and publish it. It will work normally.

I resolved this by removing the file "packages.config" from my Project, which was flagged as missing. After that, Publish worked just fine.

I had to manually copy and paste the missing files VS was asking for into the BIN folder. .pbd, .xml Sometimes they don't copy over.

Just rename Packages folder of Nugets. Visual Studio would automatically get required packages and build would get successful and Publish would work too.

In case this helps anyone, for my MVC project in VS 2015 it was this file: File System.pubxml.user In the publish profile directory, including it caused compilation errors but deleting it enabled it to publish!

I had to delete the publish profile, commit, and then recreate the publish profile from scratch.

I deleted all the existing publish profiles in visual studio -> solution explorer -> My Project Node -> Properties -> Publish Profiles The same can be done by right clicking Project in solution explorer -> Publish -> Profile tab -> Manage Profiles -> Remove all profiles Now download the relevant profile from Azure or choose from your directory if it's already save on your machine and choose it. Then clean and rebuild the project. Make sure you've chosen the project is built in Release mode and you've also chosen "Release" Publish -> Settings -> Configuration Now Publish, it worked for me.

i have also faced this issue while i was publishing my site, in my case reference was added but in bin folder it was not there so please install again which reference is missing on output.i hope it helps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!