Cannot re-add view in a MVC4 razor project - asp.net-mvc

I am unable to re-add a partial view after removing it. VS says the file already exists. I checked the .csproj and the .sln file for a reference but could not find any. I also did a clean get of all the source from TFS and still cannot add. Anyone know where to remove the old references or whatever blocks the addition?

VS is complaining that the file exists on disk, not in the project.
Delete it in Windows Explorer (or after clicking Show All Files) and try again.

Related

App_Data folder is not checked in with Team Foundation Server [duplicate]

I am working with ASP.NET C# MVC 5.
.mdf/.ldf files in App_Data do not appear on Pending Changes in team explorer. Therefore I can't check them into TFS(visual studio online). I've tried recreating the project a few times and none worked. What might be the cause for this?
Go to Team Explorer and locate Excluded Changes and you should find it excluded. Right click the App_Data folder and include it.
But you might want to reconsider including the database files. As you're developing and testing, every little database interaction will trigger a change and most of those are trivial. Also, if someone else is working on this project, they may not want your database file to overwrite theirs when they Get Latest Version.
If you're using Entity Framework Code-First, the database is automatically generated when you build the project I believe, otherwise you just run the Update-Database command to do it. This lets everyone collaborating have their own local database file to work with. You can also utilize migrations to make updates to the database structure. If you want the database to be generated with pre-populated data, you should utilize the Seed method.
This is a general question. As already answered by 'Ty Morrow' in above comment there is an initial Seed Method in Entity Framework which ensures that all values are inserted. However there are many scenarios that you also need to work with the latest added / removed DB entries not present in the seed method.
Please perform the following steps to ensure that your data directory file is included in the source control.
Click App_Data folder and on encircled toolbar click on Show All Files as shown below in the snapshot
Right Click on your MDF (Data Source) File and click on Include in Project
Right Click again on your MDF File and click on Include in Source Control
Simply Check in the file by Right Clicking on root project folder link and file show be now part of Source Control

Why isn't source control working when I use a workspace in Xcode 5?

Normally I just create a new project, select the option to keep it under source control, and everything works.
Today I tried using a workspace, and it doesn't work. Here is what I did:
File->Xcode->New WorkSpace. (Create the workspace in a new folder). hit Save.
File->New Project->iOS->Single View Application->Next
Enter product name etc, Next
Make sure "Create git repository on My Mac" is checked. Select the folder where the workspace is saved. Choose "Add to"->The workspace you created. Hit Create.
Type some stuff into app delegate. Build. Save file.
Try to commit in source control --> Can't! All the options are greyed out. Even though changes are made to app delegate, the "m" symbol does not appear near it.
How do I correctly set up my workspace so I can use source control ? What is wrong with my set up ?
EDIT: Trying to add new files doesn't make the "A" symbol show up near the new files either. Clearly source control isn't on.
If I create a project that isn't part of the workspace, source control works fine.
EDIT: Navigating to the folder directory and running git status , gives the following message:
fatal: Not a git repository (or any of the parent directories): .git
Why wasn't a git repository created ? and how do I get it to work?
EDIT: I deleted my project from the workspace. Closed the workspace. Created the project again outside the workspace. Closed the project. Dragged the project into the workspace, and now the project is both part of he workspace, and it is under source control. Can't tell why it didn't work when I created the project within the workspace.
EDIT: As I don't know the reason why source control didn't work when I created the project within the workspace, I'm leaving this open in case someone has an answer, or knows if it is a known bug.
Looks like your .git directory is not inside the main workspace directory. Enable hidden file view in Finder and see where your .git directory is.
Xcode makes it rather confusing working with workspaces, since it does enforce any logical directory structure.
You can try using IDEs such as AppCode to give you better idea, you can get a free 30 day version of it from JetBrain's website.

TFS checkin error - could not find file

When checking in my project I get the error:
Could not find file 'C\blah blah blah'.
I have a feeling this might be a file from an old project I deleted.
I have tried deleting my TFS connection and workspaces.
This will happen when TFS has some changes staged that no longer exist on the file system. For instance, if you add some files in Visual Studio (which adds them to the changes list), delete them directly from the file system, then attempt to check in the changes, it will complain that it could not find the file(s).
To remove these changes from the list, you can open Source Control Explorer (View > Other Windows > Source Control Explorer) and either Delete the nonexistent files or right-click on the offending files and Undo Pending Changes.
You can also undo these specific changes from the Pending Changes panel in Team Explorer.
Create an empty file to replace the missing file and complete your check-in. After you have checked in the file correctly delete the file that is not needed.
Go to the project that has file 'blah blah blah', you should see the file has an error mark indicating it does not exist. Right click the file > Delete. That should take care of the problem.
I had a similar problem. I had forgotten I was tinkering with adding publish profiles for publish. TFS felt it needed to check that in, even though the output wasn't there. I simply right clicked on the App.Publish folder in Team Explorer inside of visual studio and chose to exclude. Checked everything back in with no problem.
I encountered the same error:
but my issue was a bit different. I was changing a couple of folder names and when committing I didn't add the new folders to the repo:
git add folderName
solved the issue for me.

Force TFS to detect changes

Seems like this should be something very simple, but I can't find how to do this...
I made a changes to several files spread within a repo by using a script that I wrote. Problem is TFS in its infinite wisdom does not think the files have changed. Aside from manually finding each file and clicking "checkout for editing" is there any way to tell TFS to just rescan everything and detect changes?
A Folder Compare (File->Source Control->Compare...) should do the trick. Select the top folder from where to start comparison, and select to compare with Latest Version. The result hould show files that are changed, and whether they are checked out or not.
TFS has a "Reconcile" command for this. See https://stackoverflow.com/a/22860674/932282 for a complete answer.
Local Workspace
You need to work with a local Workspace. Here's how to manage workspaces:
visualstudio.com: "Create and work with workspaces".
When adding or editing the workspace you click Advanced >> . Then you set Location: to Local.
Now when your script or anything else changes files outside Visual Studio, your workspace detects the changes automatically.
It also detects adds or deletes but you have to include them to your Pending Changes manually with the link under Excluded Changes
BUT BE CAREFUL. When adds or deletes get detected and you add them to your Pending Changes, the files aren't automatically included to your project. So you maybe check them in to TFS, but they aren't listed under the Solution Explorer.
Matt Burke has a fix for that problem:
mattburkdev.com: "Automatically Include All Files in Folder in Visual Studio"
To edit the Project file you rightclick your project, chosse Unload Project, then rightclick on it again and choose Edit. After you edited the project files save and close it. Then rightclick and chose Load Project.
But with that you also need to be careful, because the Project only searches for new files in these folders to include, when you load the project and not while you have the project open. So when some files get added outside Visual Studio, you just reload the project.
Server Workspace
But if you have to stick to a Server Workspace for some reason i got another trick for you:
FIRST:
Check out all Files that maybe have pending changes (better check out many files). Then go to Team Explorer -> Pending Changes and choose all files you just checked out. Then choose "undo changes". After this you get a message "Confirm Undo Checkout". This message ONLY pops up for the files, which actually HAVE changed! Press "NO" for each files or "No to All".
FINALLY: Under pending changes all files get removed from the list except the ones which have pending changes.
I hope I could help someone and you didn't have to search for this solution as long as I had to ^^
If any of your changes occured when you were offline, you can go to File > Source Control > Go Online, and all files will be checked for modification.
If none of the above work, you can also try to rebind your projects by going to File -> Source Control -> Advanced -> Change Source Control.
In Visual Studio 2015:
Source Control -> Advances -> Refresh Status
I had this problem a while age when i moved project from one pc to another.
the solution was to remove temporary files that TFS had created in solution folder.
Delete .vs and hidden $tf folder.
If no luck,on your local PC copy your solution folder to another, remove all files inside solution, get latest version from TFS server ,then from the copied folder just grab neccessary and edited files and put them back to solution folder (this will overwrite some files).
After all don't forget to check project mappings and if everything seems correct try right clicking on solution and 'Add to source control' option.
Dtsx file dropped in TFS folder was not being recognized.
On your Visual Studio (2015) home screen, click on the Team Foundation Server link. Make navigate to the correct branch.
On the window on the left side of the screen, navigate to the folder that contains your file. Expand the folder.
To the right of the folder you will see three dots. Click on those and then click on “ + Add File(s)”.
Choose “Upload Existing Files”. Then you can drag and drop your .dtsx files into the window and then click Okay.
Finally, you’ll have to do a ‘Fetch’ to add the files there. Then you need to do a ‘Pull’. Lastly, you can commit the change to remote branch.

Project wants to check out .dtproj in SSIS project every time TFS Get Latest is performed

Using Team Foundation server and BIDS 2008, I receive a screen to check out the dtproj file every time the Get Latest operation is performed.
Steps to Produce:
I have no files checked out after performing a "Get Latest" from solution explorer.
I click to open the solution file .sln from Solution Explorer and the SSIS project opens.
I then receive a "Check Out" screen asking me to Check Out the .dtproj file.
Any ideas how to keep this from happening?
Imperfect answer: How can I prevent BIDS from automatically checking out SSIS packages?
Also related: http://social.msdn.microsoft.com/Forums/en-GB/sqlintegrationservices/thread/654d556f-3826-4fd3-a36a-e7f20a059569
I have been using BIDS 2008 with TFS 2010 for quite sometime but never had the issue that you are facing. Here are the Source Control settings on my BIDS environment.
Some of the other links that might help you:
A project is automatic check outs everytime when i opens the solution in TFS 2008
How to stop Visual Studio from "always" checking out solution files?
This behavior appears to stop if you manually add the .database file to TFS through Source Control Explorer, making sure that the .database filename inside the .dtproj is the same name as the file you add to TFS.
Turns out the .database file is a local 'runtime' type file that Visual Studio creates each time. It is not an actual source file and should not be checked into source safe. What I think happens is that:
This file gets created by VS
At some point someone checks it into source safe, making the file read only in their working folder
Next time VS tries to create the file again. It can't (unless it's checked out) so it creates another one with a slightly different name
Because the filename is now different is changes the .dtproj file that references it. It therefore tries to check the .dtproj file out because a change has automatically been made to it
Chaos and confusion ensues
This is roughly what we did to fix this:
Delete any .database files from source control, ensure that it never gets added back again
Close VS
Backup and delete any .database files from local dev folder
Open VS and get latest
You might get 'this project couldn't be loaded' type errors in VS because the referenced .database file is missing
To get the project loaded, you need to get a valid .database file (these can get corrupted - check the file contents) into your local folder, and edit the .dtproj file in a text editor to point at the valid file
Once you have your .dtproj file working, check it in and have everyone get latest
Make sure no one ever checks in the .database file
Why oh why is it called a .database file when it has nothing to do with a database. When you search online for .database you get...... information about databases, not this annoying VS file.

Resources