3 ms·
I miss makefiles. I had a side-project that included a program that converted a text file into a C# file and I wanted that integrated into the build process so
by billpg 3y ago
I miss makefiles. I had a side-project that included a program that converted a text file into a C# file and I wanted that integrated into the build process so when I hit F5, the system would - if needed - invoke the code-gen program and then recompile the .cs file that got generated. Alas, I couldn't find a good way to do it so I ended up adding pre-build and post-build actions. They sorta work but I have to manually invoke builds occasionally.
I asked on stack-overflow if there was a way to do this. https://stackoverflow.com/q/73816110/3568 https://stackoverflow.com/q/73816110/3568
(Short version of answers: No.)
- deleted 3y ago[deleted]
- pjc50 3y agoYou certainly can have tool-generated C# files, because the GRPC protobuf compiler does that and integrates it nicely into VS projects. It's not exactly what I'd call simple, though: https://github.com/grpc/grpc/blob/master/src/csharp/Grpc.Tools/build/_protobuf/Google.Protobuf.Tools.targets https://github.com/grpc/grpc/blob/master/src/csharp/Grpc.Too... so I'm not surprised that people don't try to spend days learning it and making it work. One could probably write a "how to speak MSBuild for people who understand Make" page based on https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-concepts?view=vs-2022 https://learn.microsoft.com/en-us/visualstudio/msbuild/msbui... ; basically Make -> MSBuild Item : File (e.g. foo.c) Target : Target (e.g. %.o:%.c) (environment) variable : Property tab-indented shell : Task (usually a C# assembly, although there's a generic "run command" one as well) Free tip for anyone trying to debug MSBuild: https://msbuildlog.com/ https://msbuildlog.com/ . AFAIK there isn't anything quite as good for Make.