How to clean up and simplifying csproj for DotVVM project
When you create new DotVVM project with Visual Studio, it will be like this:
First we could simplify <Content Include=… group from this:
to this 🤗:
Group Content is copied to project publish directory (folder or AppService, IIS, etc..). Attribute Include says: please add these files to group Content. So all files specified by wildcard Include=”**/.dot…“ is copied to the output/publish folder.
Ok, this was just simplification of some lines of csproj. But here are some messy None Remove=… statements 😣.
Group None is not copied to publish folder. Problem is, that this group (None) is included by wildcard which includes all files except .cs, .resx… and files in wwwroot. But our dot… files are not in wwwroot and they are by default included in None group. To solve this problem, Visual Studio adds these lines for remove dot… files from group None:
And if you add some dot… file like View (dothtml), master page (dotmaster) or user control (dotcontrol) Visual studio still will be add new None Remove=…dot… statement. If you work in team on project you still need resolve merge conflict in .csproj files.
So, what should we do? It is easy just remove all dot… files from Remove group by wildcard:
For more info what is and what is not included in Sdk=”Microsoft.NET.Sdk.Web” check Microsoft docs
And if you don`t know what is DotVMM 😱 check this website https://www.dotvvm.com/. But a nutshell I can tell you it is perfect framework for RAD (Rapid Application Development). It frees you from duplicate validation on client and server, write JavaScript boilerplate and the best at the end - is open source https://github.com/riganti/dotvvm/
🤞 Happy codding 🤞