Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equivalent for System.CodeDom configuration element? #1434

Open
hippiehunter opened this issue Jan 8, 2020 · 10 comments
Open

Equivalent for System.CodeDom configuration element? #1434

hippiehunter opened this issue Jan 8, 2020 · 10 comments
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.CodeDom backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity
Milestone

Comments

@hippiehunter
Copy link

Under .Net Framework I used to register my CodeDomProvider in machine.config. It looks like the build targets for aspnet core have a hard requirement that languages have a CodeDomProvider, but I don't see a way to register it in netcore. Poking around in https://github.com/dotnet/runtime/blob/master/src/libraries/System.CodeDom/src/System/CodeDom/Compiler/CodeDomProvider.cs makes it look like everything is hardcoded to only support C# and VB.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.CodeDom untriaged New issue has not been triaged by the area owner labels Jan 8, 2020
@danmoseley
Copy link
Member

like the build targets for aspnet core have a hard requirement that languages have a CodeDomProvider,

@anurse do you support building an ASP.NET Core app without VB/C#?

https://github.com/dotnet/corefx/issues/12180#issuecomment-366542284 tells me that ASP.NET Core does not use CodeDOM at all.

@hippiehunter what are you trying to do -- do you have a custom language?

Generally we would recommend that new code use Roslyn API's, rather than the very old CodeDOM API which (as you point out) are not as extensible in .NET Core via config files.

@hippiehunter
Copy link
Author

Yeah I have a language. Historically there hasn't been a problem building Controllers, but it seems like Razor has been injected as a non optional part of the build system in 3.0/3.1. There is a carve out in their targets file to prevent this from burning F# specifically, but that doesn't really help me.

The task that appears to have a requirement for a CodeDomProvider is WriteCodeFragment and its getting called from Microsoft.NET.Sdk.Razor.MvcApplicationPartsDiscovery.targets and that appears to be brought in by the Microsoft.NET.Sdk.Web sdk.

@danmoseley
Copy link
Member

Makes sense. The right answer here is likely for them to provide a general non codedom path rather than reinvent config files for this. @anurse can advise.

@analogrelay
Copy link
Contributor

analogrelay commented Jan 8, 2020

ASP.NET Core doesn't use CodeDOM at all AFAIK. And Razor pages always include C# syntax, but should work in a F# project, I believe. cc @rynowak @NTaylorMullen @mkArtakMSFT

@hippiehunter
Copy link
Author

To be clear, I'm not actually trying to do anything with Razor pages and I'm a custom language not F#. My mention of F# was only because it looks like someone noticed this problem for F# and put in an explicit workaround in the targets file when the language name equals 'F#'.

@danmoseley
Copy link
Member

danmoseley commented Jan 8, 2020

@anurse apparently you are indirectly, as @hippiehunter points out, this build task you are calling uses CodeDOM unfortunately. (oddly enough I believe I implemented it in a previous life...)

https://github.com/dotnet/aspnetcore-tooling/blob/master/src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.MvcApplicationPartsDiscovery.targets#L65

@analogrelay
Copy link
Contributor

I think someone on @mkArtakMSFT 's team is going to have to look deeper here. I don't really have any context on the Razor SDK.

@rynowak
Copy link
Member

rynowak commented Jan 9, 2020

@hippiehunter - can you be specific about what we can do to help? This code generates attributes that are used by the MVC part of the runtime.

@hippiehunter
Copy link
Author

@rynowak One option would be to make System.CodeDom.Compiler.CodeDomProvider.AddCompilerInfo and System.CodeDom.Compiler.CompilerInfo.CompilerInfo(CompilerParameters compilerParams, string codeDomProviderTypeName) public. because any language's build system targets will have been run first, I think a language provider (me) could just bundle their CodeDomProvider into their build system nuget package and ensure AddCompilerInfo has been invoked. That's the most complete answer I think I have, but if that's not a viable I can keep digging for alternatives.

@buyaa-n buyaa-n added api-suggestion Early API idea and discussion, it is NOT ready for implementation and removed untriaged New issue has not been triaged by the area owner labels Jun 22, 2020
@buyaa-n buyaa-n added this to the Future milestone Jun 22, 2020
Copy link
Contributor

Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

This process is part of our issue cleanup automation.

@dotnet-policy-service dotnet-policy-service bot added backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity labels Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.CodeDom backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity
Projects
No open projects
Development

No branches or pull requests

6 participants