Sometimes, when the nuget cache and intellisense break and neither dotnet restore
nor nuget restore
help, it's necessary to delete the obj
folder in oder to rebuild the package information and fix all the false red flags.
In some projects, I cannot figure out when, after deleting obj
(from inside VisualStudio) these elements are added to csproj
:
<ItemGroup>
<_UnmanagedRegistrationCache Remove="obj\MyProject.csproj.UnmanagedRegistration.cache" />
</ItemGroup>
<ItemGroup>
<_ResolveComReferenceCache Remove="obj\Debug\MyProject.csproj.ResolveComReference.cache" />
</ItemGroup>
<ItemGroup>
<IntermediateAssembly Remove="obj\Debug\MyProject.dll" />
</ItemGroup>
<ItemGroup>
<_DebugSymbolsIntermediatePath Remove="obj\Debug\MyProject.pdb" />
</ItemGroup>
<ItemGroup>
<_DeploymentManifestEntryPoint Remove="obj\Debug\MyProject.dll" />
</ItemGroup>
<ItemGroup>
<ApplicationManifest Remove="obj\Debug\Native.MyProject.manifest" />
</ItemGroup>
<ItemGroup>
<DeployManifest Remove="obj\Debug\MyProject.application" />
</ItemGroup>
I always remove them manually but it would be great if there was a way to prevent this from happening in the first place. Is that possible and how?