Nesting removes (copy) file properties
Installed product versions
- Visual Studio: 2015 Update 3 (Express/Community)
- This extension: 2.5.65
Description
When file properties are set, for instance copy-if-newer and the file is nested, the configured properties are reset. I think the build action is preserved.
Steps to recreate
- Set the Copy-to-output-directory of any file a (C#) project to copy-if-newer
- Manually nest the file under another file
- Check the Copy-to-output-directory property: it has reset to do-not-copy.
Current behavior
It seems that in nesting the file and therefor changing the project file, any existing child elements in the project xml for that file are removed/overwritten when the DependsOn tag is added.
Expected behavior
I would expect the file properties are preserved when moving and nesting files.
This occurs due the next code in ManualNester.cs file:
bool mayNeedAttributeSet = item.ContainingProject.IsKind(ProjectTypes.DOTNET_Core, ProjectTypes.UNIVERSAL_APP, ProjectTypes.SHARED_PROJECT);
if (mayNeedAttributeSet)
{
SetDependentUpon(item, parent.Name);
}
else
{
item.Remove();
parent.ProjectItems.AddFromFile(path);
}
It would be better to avoid removing and adding file again to a project and instead just add/remove DependenUpon node. This will allow to store any standard/custom properties unchanged. I guess that for UnNest method it should work similar - currently it MAKES A COPY OF FILE (!!!), which is not needed. Regards, Roman