tfsnugetvisual-studio-2022nlog

Visual Studio / Nuget puts files in the wrong place


New-ish to ASP.NET Core and VS 2022. Clearly it is doing things differently than previous versions.

I added NLog to my project and everything works great. However, to get the intellisense for the config file I added NLog.xsd via Nuget (NLog.Schema 5.2.4). When I load the solution or add another item to the project I get an error message pop up telling me I can't add the file to my project because it's not in source control.

The error message is about NLog.xsd or this vspscc file and not the new file I am adding. VS must be doing some housekeeping whenever you add a new item - in this case a razor page.

So I look at NLog.xsd in its visual studio properties and it is located in my personal one drive folder on c: instead of my project folder on f: which is tracked by TFS/Devops. Why does it do this? Do I need to remove the file and manually drag it over from the NuGet dump location? Same with ProjectName.csproj.vspscc, which honestly I'm not sure should be part of the actual project anyway but I don't remember adding it so must be automatic.


Solution

  • This appears to be a situation where the newer version of the nuget package puts files in a different place when they don't have to exist in source control. It's frustrating but the solution is to exclude them from source control and then when you restore packages they will be restored to the solution appropriately.