App_Data folder is not checked in with Team Foundation Server [duplicate] - asp.net-mvc

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

Related

SSIS Project will not show a new folder added

I created a folder called BatchFiles in TFS for an SSIS project, but the folder will not show in the solution explorer. I've also noticed that .dtproj file will not show, even if I click the "Show All Files" button on top. Is there any way to show the new folder I created in solution explorer? Also will the .dtproj file always be hidden?
Add new item directly to the project does this:
Adding an existing item option automatically dumped it in Miscellaneous Folder, that looks like this:
Seems like those existing items are not being considered as project files but as misc files when being opened from solution explorer.
This seems to be an expected behavior
Any files in the dialogue box which does not have extension such as
dtsx or config .Selecting these files will automatically place them in
Miscellaneous folder
How to Add a File to the SSIS Project Miscellaneous Folder
If the file exists on disk (physically in the folder) but does not show in the solution then it is likely that the file was checked in, but the modification to the solution was not. And for BatchFiles folder, you just add them in the source control explorer. That's why there are not the in the solution explorer.
Also will the .dtproj file always be hidden?
Seems to be so. I have also reproduced and got the same behavior like this. Sorry, not very familiar with SSIS project. But according to some tutorials in google such as this
Blog : Building your SSIS project in Azure DevOps It not appears, but we also able to build it through Azure DevOps.

Sync references with TFs in VS database projects

In db projects, when you add a database dac-pac for example as a reference use in a view to reference a third party database, that seems to be valid only for your local copy.
In VS 2015 I can;t seem to find how you add that as a build so that it syncs and compares with the version you store in source control.
If I check out a team project, create a view referencing a third party DB, create a dac-pac for that DB, add it as a database reference, save, build, check in, by default that reference isn't checked in to the server for another developer to check out in the latest version and therefor they will get reference errors.
Does anyone know how to sync these? I can't find an option to do so!
Also, it would be nice to be able to edit the dam things, For example if they are on a different server you must define that. But say the server changes, you can only edit it in your publish profile, however if you do that but someone else doesn't it will flag as a change for them.
You'd better add the .dacpac file to TFS version control. When others check out from other machines, get down the .dacpac file together with that db project.
Make sure that when other check out that file and the db project to their local machine, the relative path between them are same with that in your environment. Actually, in the .sqlproj file of your db project, it has defined the relationship.
For example, I put the .dacpac file under a folder named "DACPAC" and this folder is at the same level of my solution folder.
In the .sqlproj file:
<ArtifactReference Include="..\..\DACPAC\TestDB.dacpac">
<HintPath>..\..\DACPAC\TestDB.dacpac</HintPath>
......
</ArtifactReference>
Note: The "..\" mean go to the uplevel path from where the .sqlproj at. It has 2 "..\", so go 2 uplevels.

.csproj files not getting checked in to TFS

My problem is that in my scenario, I have a project with two parallel project files for different build targets. I have a ProjectName.WP8.csproj and ProjectName.WinRT.csproj, which essentially include the same files.
I am trying to check-in this solution (SolutionName.WinRT.sln) to TFS and I get no errors. All the code changes to the code in the project goes through, but when I check the actual state of TFS, the (newer) PorjectName.WinRT.csproj files are not checked in.
This is quite peculiar since it worked perfectly for the WP8 version. How can I support this kind of scenario?
(If it's not possible, how do I easily migrate my parallel project to another TFS project?)
Just had this come up myself. I had been working on a project for a few days before checking the solution in. During the initial check in for the project, only the most recent file edits were seen by source control. I was able to highlight all the files in the Solution Explorer and select Add to Source Control from the right click menu, but the csproj files themselves did not check in. To do this, I had to go into the Source Control Explorer and open the project directory. From within the directory, right click and select Add Items to Folder. Then you can select the csproj files and you're good to go.

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.

Exclude from project, source control issue

I'm using team foundation server 2010 # work and home.
I want to exclude some element from the project build but still have them exist in Team Foundation Server 2010 source control. How do I achieve this?
Exclude From Project will delete the item.
Same problem here, only way to do this is manually edit project file :(
Please vote that this bug is important to fix
https://connect.microsoft.com/VisualStudio/feedback/details/573582/vs-2010-exclude-from-project-deleting-files-from-source-control
Workaround posted on Connect:
Open the csproj file in notepad and find the files that need to be
excluded and remove or comment the compile element for that file, and
any related designer and resx files.
Editing a project file and removing the references to the files you want to exclude would be the easiest solution.
Another solution would be to remove files from the project via UI, but only checkin changes in the project file and undo the delete operations.
In the future you can add files directly to the TFS folder in Team Explorer.
May I ask: why would you want to do that? As I commonly have a problem of files which are not bound to any project and have to be getted manually.
I work in a TFS environment, and if it were me? I'd just change the name of the file (instead of excluding it from the project), and check that in instead. Since your project is expecting that particular filename...it won't find it. We use this when we're developing prototypes or holding on to antiquated code for documentation purposes. Sorry VS is eating your stuff!
Kind Regards,
-sf
I think these steps should help you do what you are looking for.
To exclude an item from a deployment project:
In Solution Explorer, select the file you want to exclude.
On the Solution Explorer toolbar, select Properties.
In the Properties window, set the Exclude property to True.
And this page explains the actions for project files supported by VS 2010:
http://msdn.microsoft.com/en-us/library/0ebzhwsk.aspx
--- Edit ---
At work I tried 'Exclude From Project' in one of the files of a project we have in VS 2010, which is bound to a TFS 2010 server, and this action did not delete the item from TFS; the Source Control Explorer window shows the red delete mark next to the item, and the 'Pending Change' column says delete, but item is there. Right click the item in the Source Control Explorer window, one of the commands in the context menu that pops-up is 'Check In Pending changes' and another one is 'Shelve Pending changes'. Shelving enables you to set aside the pending changes.
The file is still in the local hard drive. If I do 'Include In Project' the item comes back to normal.

Resources