EF Core and Visual Studio 2017: Add-Migration doesn't include new files into TFS source control - tfs

Add-Migration generates new files but doesn't include them into TFS source control - they are invisible for Check-in operation and are shown without lock sign on Solution Explorer.
Is there the way to solve it?
P.S. This all happens in project Sdk="Microsoft.NET.Sdk" style. The question can be asked in more wide form: is there a way to "pick up" new files (created without Visual Studio) and include them to TFS automatically?

Have you added the project/solution to source control? You need to add the solution to source control first, after that the new generated files will be detected automatically within the workspace.
Tested on my side and cannot reproduce this issue. Could you provide a sample project for further troubleshooting if that still not work?

Related

TFS not tracking changes if items added manually and not included into vs2015 solution

I've added a folder with asp.net core project which isn't supported by Visual Studio 2015 (which is used for everything else) and thus not included to the general solution.
To have those files in source control I had to manually add them using "add items to folder" command in source explorer. So they are checked-in but tfs not tracking changes for them anymore although there are differences that are shown if compare to the latest folder on the server:
How do I make TFS track them and show pending changes for edited files?
According to your description, looks like these files are all out side of Visual Studio.
Not sure if you are using server workspace or local workspace.
When adding or editing the workspace you click Advanced >> . There is a setting of Location: Local/Server.
For local workspace, 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.
For server workspace, you could choose to use Reconcile command. See https://stackoverflow.com/a/22860674/932282 for a complete answer.
Besides, you could also take a look at other solutions in below similar question:
How to have TFS 2010 detect changes done to files outside of Visual Studio?
Force TFS to detect changes
I think you just added them to source explorer and not to the solution, as you said. In this case, there is no editor application (even your VS) that is responsible for doing the check-out operation because they are not aware of TFS. On the other side, TFS can detect that changes have happened to the files but can not track them.
If you do not activate the "Get the latest version before check-out" option in your team project, then you can go to the source control and check-out those files manually and then check-in them manually again when your work with them is done.
Please before doing this, take a backup of your source code for caution.

Excluded files from tfs still being checked in

I'm currently working on a WiX project and I need to include some files in my project but exclude them from tfs. I need to do this because these files are auto-generated at compile time but they have to be part of the project to be compiled. I thought that I could exclude them from source control by going to File->Source Control->Advanced->Exclude <file> From Source Control but it still seems to be including it in TFS.
Below is a picture of my project and it appears that visual studio is trying to exclude them from tfs judging by the little red icon next to the files I'm excluding. However when I compile it errors out because the excluded files are read only and I can clearly see them checked in by looking at the source control explorer window.
Is this an issue in visual studio or am I doing something wrong here?
I resolved this by closing out my solution and deleting the files in source control explorer. Before when I was deleting them from source control explorer I had my solution open and it was actually removing them from the project file. Seems like when you exclude them from source control via the method described above it should remove them from source control but it doesn't.

TFS 2010 cannot add solution

We are trying to add a VB.NET 2010 solution to a Team Foundation Server 2010. When we right-click the solution and select "Add Solution to Source Controll..." it pops-up a message "The file 'sample.vb' cannot be added to the source countrol because the item has no source control mapping. If you choose one of the Ignore options the operation will continue without addint the file."
We wonder what the reason for this is.
We found that the file in question was a linked one and not part of the project itself. The rest of the files went in the TFS without any issues. So, you were right that the file was outside of the main project folder.
You need to make sure that the file is created in a directory that is mapped to the current TFS workspace.

Can't manually add files to TFS

We use Codesmith to generate some code, and when we open up the projects, the files are there, in the solution, but there is no way to check them in. The DLL compiles just fine. The only difference to the .csproj is the addition of any new files we generated.
But unlike VSS, TFS, does not detect these files. I validated this behavior by editing the .csproj manually. For some reason, the only way to add a file to TFS is through Visual Studio.
However, when I remove them from the project, and then include them, I get the usual yellow plus sign.
You can manually add files to Visual Studio, however changing your project file isn't the best way to do this. If your project is already under source control and the files you want to add are visible in the Solution Explorer window, you can simply right-click a file and select Include in project. The next time you check your code in, the items will be added.
Since you're using TFS 2010, check out the Team Foundation Server Power Tools extensions. This includes the Windows Shell Extensions which give you integration into Windows Explorer which let's you right click on files or folders and add the to TFS outside of Visual Studio. Very nifty!
Looks like it is not possible and the workaround is to batch-add all the files through PowerTools. Though this article/forum-thread is dated it appears to be helpful:
Adding CodeSmith generated source file in Team Foundation System

Why do empty folders disappear when adding Visual Studio solution to TFS?

I have this Visual Studio solution that includes a project that has a template folder tree consisting of several empty folders. When I add this solution to Team Foundation Server (TFS) using the "Source Control -> Add Solution to Source Control" menu item it doesn't add the empty folders to the TFS repository! I really need those folder to be present when the code is downloaded from TFS.
Now, I know I can create the folder structure using Source Control Explorer, but since the whole project is managed from within Visual Studio it feels kinda wrong to create these folders in a separate way.
Is there some setting I need to adjust so Visual Studio will also create TFS folders for empty project folders?
Apparently it's a feature, not a bug:
"in the Add files to source control we
do not support the addition of empty
folders, but in our research our users
preferred the SCE toolbar button for
actually creating their empty tree
structure rather than going to the
file system, doing it there and then
adding to source control."
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=119974
In TFS2008 you can drag and drop folders from Windows Explorer into source control explorer, and empty subfolders will be created when checking in. Not sure if this works in TFS2005, I don't have an instance handy to test it - anyone?
Drag and Drop folders worked for me on TFS 2008, although it didn't on TFS 2005.

Resources