ProtobufGenerator icon indicating copy to clipboard operation
ProtobufGenerator copied to clipboard

linked proto files fail to generate cs files

Open warniaha opened this issue 6 years ago • 2 comments

I attempted to add the proto files to my c# project as linked files (add to project, select files, click dropdown on open button, select as linked file) but it doesn't generate the cs file. Since I have multiple projects that utilize the same proto files, it doesn't make sense to copy the source to multiple locations and create a maintenance nightmare Anyone have any ideas on how to get this to work?

warniaha avatar Jan 23 '19 12:01 warniaha

It is not possible to run a custom tool at all on a linked file. See [dotnet/project-system/issues/3156] and [dotnet/project-system/pull/4349].

johanvik avatar Jan 23 '19 22:01 johanvik

I have to revise my comment. I was testing in a .Net Core project and then it is true that it is not possible to run a custom tool on a linked file, see references in my previous comment. However in a .Net Fx project it is possible to run a custom tool on a linked file. Verified with VS 15.9.5 and .Net Fx 4.6.1.

If you have a .Net Fx project check if you have spaces in your linked file path? Then the issue is related to #13.

A work around would be to create a separate project where you have your proto files and reference that project in your other projects.

johanvik avatar Jan 23 '19 23:01 johanvik