0

I was instructed to delete an cshtml file from a View folder and then include my csproj file with my checked-in changes in VS TFS.

However, the csproj file does not show up under included changes in my Team Explorer Pending changes because nothing was done to it. From what my instructor said, apparently deleting a file requires the csproj file to be pushed, too.

I followed directions for how to locate my csproj file, but I can't figure out how to include it within my check-in.

Can anyone explain how to do this? Also, what connection does the csproj have to a deleted file change?

3
  • 1
    Press Ctrl+Shift+S (save all), or rebuild your project. Check again. For .NET Framework projects, the .csproj contains all of the files that the project has. It doesn't save automatically when you remove/add one. I'm just guessing that this is the problem. If it is, let me know and I'll add it as an answer. Dec 7, 2018 at 1:53
  • 1
    in TFS explorer click ADD buttin and add your file
    – T.S.
    Dec 7, 2018 at 2:00
  • Thank you, John and T.S.! John, I tried your suggestion first, which worked perfectly. After saving it and re-connecting to TFS, it showed up under pending changes. Thanks:) Dec 7, 2018 at 2:13

1 Answer 1

2

For .NET Framework* projects, the list of files in the project is stored within your .csproj file (you can open it with Notepad or similar and take a look at it, but don't edit it unless you know what you're doing).

The problem you have described is because when you add or remove a file from the project, it doesn't automatically save the project file. You can force it to save the project file in a couple of ways:

  1. Press Ctrl+Shift+S (Save All) to force everything to be saved.
  2. Rebuild the project, which will cause it to be saved.

Now if you go into TFS, you should see the file has changed and be able to save those changes.


*.NET Core and .NET Standard projects include all files in the project folder unless excluded, vs .NET Framework projects where they are excluded until included in the project file.

1
  • This makes sense! Thank you so much, John! I will remember to force save before connecting to TFS and checking my pending changes. Dec 7, 2018 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.