admin管理员组

文章数量:1430685

Following this post, I'm planning to migrate from Visual Studio Professional 2019 to Neovim for C# .NET Framework development. One crucial Visual Studio feature I need to replicate is the automatic updating of .csproj files when adding new source files.

In Visual Studio, when you add a new .cs file, it automatically updates the project file by adding an entry like this in the appropriate ItemGroup section:

<Project>
  <ItemGroup>
    <Compile Include="path\to\fileName.cs" />
  </ItemGroup>
</Project>

Is there a way to implement similar functionality in Neovim? I'm looking for solutions that could involve:

  1. Existing plugins (preferably compatible with lazy.nvim)
  2. Custom Lua/VimScript implementation
  3. File watchers or other automation approaches

The ideal solution would:

  • Detect when a new .cs file is created
  • Automatically locate the corresponding .csproj file
  • Update the XML structure by adding the Compile element in the correct ItemGroup
  • Maintain proper relative paths

I think if no existing plugins provide this functionality then I have to write custom solutions in Lua or VimScript.

Does anyone have experience implementing this kind of .NET project file automation in vi/vim/nvim?

本文标签: netHow to automatically update csproj files when adding new C files in NeovimStack Overflow