Reputation: 6768
I am trying to publish the website using Publish option provided in the properties of the solution Explorer in Visual Studio 2010 but I am getting errors , below is the error:
Error 1 Copying file obj\Release\Package\PackageTmp\Content\css\Site.css to obj\Release\Package\PackageTmp\obj\Release\Package\PackageTmp\Content\css\Site.css failed. Could not find file 'obj\Release\Package\PackageTmp\Content\css\Site.css'
Any ideas or suggestion , why this error is popping up causing publishing to fail. Also I check my obj\Release folder , almost all the files have got an exclaimation mark next to it.
Upvotes: 4
Views: 3950
Reputation: 2313
Realise this has been answered but thought I would contribute.
Received the same error. The file was showing as there in Visual Studio.
Eventually I tried to open it and couldn't.
Turns out one of the other devs had excluded the file and then committed to source control (TFS). I then got the latest.
My subsequent publish failed, although build succeeded (it was a cshtml file so this was to be expected).
I excluded the file from my project also and all worked.
Hope this helps someone else out, I'm ashamed to say I lost an hour of my life to this...
Upvotes: 0
Reputation: 39
I guess you delete some project file directly(not from project) Project still have reference to them and looking for them while publishing
Close Solution and Open it Again then delete file from Project
Upvotes: 0
Reputation: 9143
It is looking for file that does not exists, if your wile is missing in solution it will not allow to build.
this is problem in solution thinking that file is exists and if you look via windows explorer to location where the file is supossed to be, it is not there anymore. So it is trying to copy nonexisting file ..
Hope this helps
--misread
right button on the file. select option build action and select content copy to output directory select copy always (this will ensure coping the file into the directory)
publish and the file should be there
and you should be ready to go:)
Upvotes: -1
Reputation: 2830
Go into windows explorer, navigate to the root of your website, locate the bin
and obj
folders and send them to the recycle bin. Build the app and try to publish again.
EDIT
It's because you have a file reference in your project that doesn't exist or is a different version to what your project file expects. Try clicking the Show All Files
in the solution explorer and finding the file with the yellow triangle next to it. Then right click -> Exclude from project. That should solve your problem.
Upvotes: 14