When I update a cshtml file in my MVC project in Visual Studio 2015, the html changes are not getting updated when I refresh the browser. I am using chrome and have dev tools open. Dev tools is set to disable cache when open. If I clean the solution and rebuild then the my change makes it successfully. But If I just refresh the browser the update does not happen. If I delete all my temporary internet files and start debugging again, I can sometimes make a few changes to the cshtml files and they will work when I refresh but after a little while it stops working.
I have noticed that when it works correctly visual studio is creating 2 files named app_web_(some junk letters).dll.delete and another other titled the same called .pdb.delete. When I refresh the browser it creates a bunch of new files and my html change makes it to the browser.
When it stops working visual studio no longer creates the delete files in the temporary internet files folder.
For the record they are in the root directory of temporary internet files.
Also, this solution was originally created in VS 2013 but I am now using 2015. It always worked when i used 2013
The problem is most probably caused from caching problems on the related Windows directories that Visual Studio or web browser use. For fixing the problem you might try to clean the contents in the following cache folders (do not delete these folders, instead delete their contents only) and restart Visual Studio:
Clean the content in WebSiteCache folder (can be found in C:\Users%USERNAME%\AppData\Local\Microsoft\WebSiteCache)
Clean the content in Temporary ASP.NET Files folder (can be found in C:\Users%USERNAME%\AppData\Local\Temp\Temporary ASP.NET Files)
Clean Asp.NET Cache in root folders (can be found in
C:\Windows\Microsoft.NET\ Framework\ ... \Temporary ASP.NET Files\root or
C:\Windows\Microsoft.NET\Framework64\ ... \Temporary ASP.NET Files\root)
Delete the browser history by selecting the period from the beginning.
And then restart Visual Studio. If the problem continues you might try to rename the project folder and reopen it again.
Try with hard reload:
Push F12 on Windows (On Mac: Cmd+Opt+I) then you can right click on refresh and select 'Empty Cache and Hard Reload'
from https://superuser.com/a/512833
Related
I have a project where I have a folder name JS. Each time I open the solution I see the folder is not included in the solution explorer. I have to use the Show all files and include the JS folder and add the existing items. It works again. If I close the solution I get the same problem. I have not changed any setting in VS, what is wrong here?
I'm working on an ASP.NET MVC project in Visual Studio 2015 Community, using git as the VCS via Visual Studio's built-in git support in Team Explorer.
Whenever I edit a file, the edited file shows up in Team Explorer's Changes list as expected, but the website project's .csproj file is also added to the Changes list. Note, this happens when I just edit a file (e.g. a JavaScript file) in the project, without making any changes to the project itself (like adding/removing a file).
Clicking the Stage All button will stage the file I've changed, but not the .csproj file. Diffing the .csproj file in Beyond Compare reveales that (as expected) it's identical to the previous version. Nothing has changed (not even the line ending type).
The only way to clear the .csproj file from the Changes list is to right-click and Undo Changes.
It's not a critical problem, it's just annoying. Any idea why this is happening and how I stop it?
(Environment details: Visual Studio 2015 Community Update 3, ReSharper Ultimate 2016.1.2, both Windows 7 and Windows 10)
This issue is fixed in Visual Studio 2019 version 16.8.2. As per this link from Visual Studio developer community.
I have an MVC project that I built in Visual Studio 2013 and when I publish the project up to Windows Server 2012, any changes I made in the bootstrap.css file don't migrate. I know it is just that file specifically because any changes I made to the Site.css file appear on the server. Everything else works except the one bootstrap.css file.
I really don't want to have to pull out the changes in bootstrap.css, it would take a lot of searching. Is this problem common? Has anyone even heard about this issue?
I had an idea to take the code from my bootstrap.css file and minify it manually, then copy it into the boostrap.min.css file. After doing that, I published the project back up to my server and everything is now working as expected.
In Visual Studio's Properties pane (for the file in question) check that the Copy To Output Directory property is set to Copy Always.
Also, in the Publish settings dialog, on the Settings tab,
expand the File Publish Options collapsible region and make sure Remove additional files at destination is checked (turned on).
I have my grunt file building the TS files and placing them in to the wwwroot folder. TFS/VS Keeps thinking that they are new files and adding them to the pending changes.
How do I make is so this is not happen. I only want the TS file in source control.
Update:
I have tried using .tfignore file
# Ignore all files in the wwwroot sub-folder
\wwwroot\
TL;DR
If you want to do front-end dev in Visual Studio 2015, don't use the ASP.NET 5 project template. Use the ASP.NET 4.5.2 Empty Web Project template. NPM, Bower, Gulp, Task Runner all work there too. Just add the appropriate config files through the New Item dialog (NPM Configuration File, Bower Configuration File, etc.).
Though ASP.NET 5 was released with Visual Studio, it is still very much beta. That doesn't only apply to the server-side features. The VS project type is also not ready for prime-time. The project properties are very limited in the UI. You can't choose to exclude items from the project. package.config exclusions don't appear to affect anything. VS doesn't behave with TFS on these projects and performs a TFS ADD on any generated file. This means that if I don't manually fiddle with TFS changes, eventually gulp builds will fail because it will want to make changes which TFS will block (e.g. delete when there is already a pending change).
All in all, the ASP.NET 5 project type is not full baked just yet. Fortunately, the only thing it really provides over the 4.5.2 project (that I've noticed) for the front-end developer is the Dependencies node in the project tree. That has some utility, but is not worth the cost currently. Instead, I installed the Visual Studio Command Line extension, which makes it convenient to run bower and npm commands as needed. I had to do this anyway for tsd (TypeScript definitions) since it doesn't have a GUI, intellisense, or bindings for its config file.
Add a .tfignore file. Details here: https://msdn.microsoft.com/en-us/library/ms245454.aspx#tfignore
You are using a Web Site project type and not Web Application.
Web site is only provided for legacy support and does not support features added to visual studio after... Well.. For a very long time > 5 years. Web site projects are inherently greedy with files and this is by design and can't be changed.
You should upgrade your project to a web application by creating a blank web application and doing the core files into your website and then opening it in vs. You will see that it has no files and you need to manually tell it which files to load.
This was a bug in the asp.net core tooling/TFS souce control interaction and has been fixed in VS 2015 Update 3, where the .tfignore file instructions should now be honoured:
https://github.com/aspnet/Tooling/issues/18
We're using Visual Studio 2008/TFS 2008.
We have a small team of developers and for some reason, periodically, when any of us "Get Latest," one of our paths remaps to a different path on it's own. This causes the "Get Latest" to start deleting files, because the path has changed. It's the same path every time that gets remapped to the wrong path.
Where are workspace definitions stored?
Is there something we may have checked into TFS that's causing this?
I have had this happen when I get while opening a solution. If the solution contains relative paths to other projects not under it's folder, that are mapped differently in your workspace, the GET will tell me it's remapping to account for it. Problem is the decisions that it makes are completely wrong.
The only way around it was to ensure that all developers use the same structure that sourcec control uses and havev that represented in each workspace.
Getting there was a pain though. basicly everyone had to delete all local copies of all files, redo workspace, CHOOSE NO TO 'GET' WHEN WORKSPACE CHANGED, close VS, open, GET LATEST.
The reason for that was if copies of projects exsisted local, even if those projects were NOT open, the GET would still be wrong. This was frustrating, because when checking for differences in those projects with latest there was no change, but when opening the solution that contained that project, dll references in that project would auto change. At that moment, no changes are pending on ANY file. But after building the changes would persist and cause the next get to be off again...
I'm sure this is all wrong, but that's what happened to us this week.
This is not normal behavior - sounds like something is going funny. Just wanted to check - all you are doing is simple get's from Source Control explorer correct? Also - all of you are on different machines? (I.e. you are not sharing a virtual PC image or anything where multiple machines have the same name)
One think I would check is to go to File, Source Control, Manage Workspaces and look at your working folder mappings both before and after the get and see if anything is changing. It shouldn't - if it does this might give us a clue as to what is happening.
You can also try clearing your workspace cache and remap it:
SET AppDataTF=%USERPROFILE%\Local Settings\Application Data\Microsoft\Team Foundation
SET AppDataVS=%APPDATA%\Microsoft\VisualStudio
IF EXIST "%AppDataTF%\1.0\Cache" rd /s /q "%AppDataTF%\1.0\Cache" > NUL
IF EXIST "%AppDataTF%\2.0\Cache" rd /s /q "%AppDataTF%\2.0\Cache" > NUL
IF EXIST "%AppDataVS%\8.0\Team Explorer" rd /s /q "%AppDataVS%\8.0\Team Explorer" > NUL
IF EXIST "%AppDataVS%\9.0\Team Explorer" rd /s /q "%AppDataVS%\9.0\Team Explorer" > NUL
Ok i got it. Here is the solution.
First of all install Visual Studio 2008 SP1.(i suppose you have VS 2008 and Team Explorer already installed).
Now launch Visual Studio 2008, Goto Source Control and delete workspace.
Create a new workspace and make a source control folder to local folder mapping.
Click Ok. When it asks "Workspace has been modified, you you want to get latest", Select NO.
Now Close Visual Studio 2008.
Reopen Visual Studio 2008 and go to source control and Get Specific (with both check boxes checked for overwriting files).
If you have a asp.net web based solution, now is the time to create application pool, configure website in IIS, set proper authentication and authorization. Otherwise its optional!
Now goto the appropriate folder in source control and double click the solution file. You may also open the solution by double clicking the solution file in your local folder but i find it easier to open the solution from source control.
Doing the above step, if your website is configured, Visual Studio 2008 will automatically detect your website that you had setup and prompt you to confirm it. Click ok.
It will contact the source control server to see if synchronization is necessary or not. If you have a number of projects in your solution, you will observe the file-get progress bar quickly blink across your screen and your solution will be setup in minutes.
The real problem is of Visual Studio 2008 Service Pack 1. Without which TFS mapping gets corrupted. IF SP1 is installed and the above guide is followed there will be no problem.
The Workspace definitions are stored on the server.
If you go to the command line and type "tf workspace", you will see the definition of your workspace.