Centeva / TypeScripter

A tool to generate Typescript classes from c# models.
MIT License
4 stars 5 forks source link

Tinkering with .net core #18

Closed marbletravis closed 6 years ago

marbletravis commented 6 years ago

When I point it to a dll in .net core, it doesn't seem to see any of the controllers.

ApiController is now just Controller in .net core, so I have adjusted the config as such.

There is a good chance this is just because its .net core, but I started debugging and the GetTypes() in the following function throws an exception

private static IEnumerable<Type> TryGetApiControllerTypes(Assembly a) { try { var types = a.GetTypes(); return types; } catch { return Enumerable.Empty<Type>(); } }

The exception is "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information."

Am I headed in the right direction, do you think its a .net core issue or am I doing something else wrong?

darrelbrown commented 6 years ago

I don't have enough experience with .net core to be certain about the source of the problem. I'd look at the LoaderExceptions for clues. I wouldn't give up yet because, according to MSDN that reflection method should be supported.

https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assembly.gettypes?view=netcore-2.0

marbletravis commented 6 years ago

@darrelbrown It looks like a build in dotnetcore is not portable... dotnetcore only creates a portable build when you do dotnet publish

see answer to https://stackoverflow.com/questions/43837638/how-to-get-net-core-projects-to-copy-nuget-references-to-build-output

I could set the property as shown in example, or is there another way to work around this?

marbletravis commented 6 years ago

typescripter fully supports .netcore.