Visual Studio undoes change to View on publish

I am programming in VS 2012 Pro, using MVC 4 EF 5.  I changed a table in the database to remove a field.  The entity was updated in the model.  However one view was still using that field.  I deleted all references to that field in the view.  I did a rebuild. 
All successful.  Then I did a publish.  Suddenly Visual Studio reports that the file was changed outside of reader do you want to reload.  When I clicked yest suddenly the two lines are back in the view and the publish throws an error saying it can’t find
those fields.  It did this five times.  I tried explicitly clicking save and save all before doing the build.  I tried doing the rebuild as release. I tried doing the save then closing and re-opening VS 2012 Pro.

No avail.  It still kept putting those two lines back in and then failing because of the existence of those two lines.  This was only happening on publish, not on build or rebuild.

Then suddenly on the sixth attempt everything worked fine just like it was supposed. 

But just because it is working now doesn’t mean it won’t happen again.  So does anyone know what was happening and how I can make it stop if (or when), it happens again?

Well this never happened to me. It seems a glitch. Unless you reproduce it again, it is hard to find what the problem is.

Hi,

The publish method being? I’m not using FTP but to me it would look like some kind of sync issue. Something such as a file on the FTP site found to be more recent than the one you changed ???

You could also try the procmon tool at sysinternals to trace some details about how the file is overwritten… A VS forum might be better…

PatriceSc

The publish method being?

On the menu bar select BuidlPublish [ProjectName] which opens the publish wizard.  Surely you are not putting files with source code on your servers? 

PatriceSc

I’m not using FTP but to me it would look like some kind of sync issue.

 I don’t use FTP either.  Never have.  Our sites are hosted by the department’s servers. 

The Publish event takes place all on the developing machines.  The servers have nothing to do with it.  The publish wizard is set to replace all files in the deployment package.

The thing is that the file seems to be overwritten with a previous version. So I’m trying to understand from which location this old version could come from (or a local "cache" or "recovery" folder, if you can test for this, see perhaps if it does this everywhere
or just on a particular machine)?

At this point I would try the procmon tool at sysinternals (at
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
) to see how this file is overwritten…

PatriceSc

The thing is that the file seems to be overwritten with a previous version.

So I figured.

PatriceSc

So I’m trying to understand from which location this old version could come from

Which is why I started this thread.

PatriceSc

if you can test for this, see perhaps if it does this everywhere or just on a particular machine

Two problems with this are 1. It’s not doing it any more.  2.  There are no hardware resources for me to copy my project to another machine with Visual Studio on it.  Other machines available for that kind of testing do not exist.

Leave a Reply