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
T4 files not added to project on package install #128
Comments
Nothing has changed in a long time, so it shouldn't be broken. Note that T4MVC is only for .NET Classic, and not .NET Core. Maybe you are using Core? |
Apparently not. I just discovered the But it seems far behind the C# version. Is there anything critical that I'll be missing by using it? |
p.s. Yes, I'm using .NET Classic, v4.8, in a VB.NET project |
It was maintained by someone else a while back, but has not been updated since 2016. That being said, things have not changed fundamentally since, so it may still work. But I won't be able to support it if it doesn't :) |
Hm, I just installed the
|
I've just put it on my to-do list to work with you to update that VB.NET version. Trouble is, I don't know when I'll be able to get to it. I'm swamped. It'll be well into the Spring months of next year, I'm sure. But you've got someone out here who wants to help :-) |
I can't explain why nothing gets added. I'm a bit out of the .NET world, so having tried any of this in a while. Maybe some setting changed in VS, or something that affects it. Thanks for the offer to support VB! |
Sure thing, happy to do it. But can you confirm these:
|
It would be best to figure out why it's not working. I just tried creating a new VB MVC project and I was able to add T4MVCVB:
I have not updated VS in a while though, in case that makes a difference. Can you try on a clean new project to isolate? I'll update my VS... |
OK, I figured it out. The files don't get installed when the package is added to a project that uses In this case, is the workaround simply to manually add the files to the project? FYI I've been able to find an answer to my other question:
The answer is that it's automatically generated at design time. In fact, I think I remember reading that somewhere in the docs. |
I'm getting this warning when I run the
Here's the action signature: <HttpPost>
<ActionName("SignUp")>
<ValidateAntiForgeryToken>
Public Async Function SignUpAsync(Model As SignInOrSignUp) As Task(Of ActionResult)
...
End Function Is this because I'm running these as |
Yes, I think that was never supported. See #108 |
Actually, not sure that bug is related. It's been a long time, so I don't recall whether there was an issue with async methods on the C# side. It's possible that it's VB specific. |
Ah, I was wondering about that ;-) OK, I'll dig in and see what I can find. Since I've now got generated code, it seems my proposed workaround is correct:
Can you confirm? |
Found it. It's a bug. On line 819 of if (!method.Type.CodeType.get_IsDerivedFrom("System.Web.Mvc.ActionResult") && method.Type.CodeType.FullName !="System.Threading.Tasks.Task<System.Web.Mvc.ActionResult>") ...to this: if (!method.Type.CodeType.get_IsDerivedFrom("System.Web.Mvc.ActionResult") && method.Type.CodeType.FullName !="System.Threading.Tasks.Task(Of System.Web.Mvc.ActionResult)") Also: as it turns out, the generator strips out the |
As far as I can tell, the problem seems to be related to this: T4MVC/T4MVCHostMvcApp/T4MVC Files/T4MVC.tt Line 941 in 6edfc80
As |
Oops, I just noticed I'm drifting the topic. Shall I move these to a new issue? |
About manually adding the files to the project, yes, you can do that if all else fails. For the ActionResult issue you found, it's likely something that was copied from the C# version and was not tested. The doc can help to discover methods. e.g. I think this is the right doc: https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.vccodemodel.vccodefunction?view=visualstudiosdk-2019. But not sure about detecting async. |
That looks to be the right doc, but there's nothing in there about Hm. It looks like we'll have to manually restore that modifier after the |
OK, getting back on topic... The original problem of the files not being added to a If the latter, I'll go ahead and close it. |
It's fine to keep it open, but realistically, it's unlikely to get fixed. As time goes, more and more people move to Core, so T4MVC is less and less used. |
I understand. I'd love to move to Core myself, but unfortunately Microsoft is dropping the ball with VB.NET. |
Oh, I didn't realize that. I've left MS and I'm quite disconnected from this world now. |
I fantasize about becoming disconnected from this world as well ;-) |
I installed the latest package v4.2.4, but the files
T4MVC.tt
andT4MVC.tt.hooks.t4
weren't added to my VS 2019 MVC5 project.I suspect this may have something to do with the fact that a file referenced in the package's install script (
install.ps1
) doesn't exist in the package:$project.ProjectItems.Item("T4MVC.tt.settings.xml").Properties.Item("BuildAction").Value = 0
The script may be failing entirely because of its absence, but I'm not certain of this.
Questions:
T4MVC.tt.settings.xml
file?The text was updated successfully, but these errors were encountered: