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

cannot generate scaffolded in visual studio 2015 #330

Open
phamthaithinh opened this issue Dec 19, 2015 · 16 comments
Open

cannot generate scaffolded in visual studio 2015 #330

phamthaithinh opened this issue Dec 19, 2015 · 16 comments

Comments

@phamthaithinh
Copy link

Without Sidewaffle all generate well. But after install T4 template to project cannot generate anymore

@sayedihashimi
Copy link
Member

What happens then? Do you get an error?

@phamthaithinh
Copy link
Author

Yes it show error as below:
Severity Code Description Project File Line Error Compiling transformation: Invalid expression term 'else' mvctemplate c:\Users\phamt\Documents\Visual Studio 2015\Projects\WebApplication3\WebApplication3\CodeTemplates\MvcView\Create.cs.t4 2

@wkrasl
Copy link

wkrasl commented Mar 19, 2016

I have the same problem while following MVA course "Build Responsive UI with Bootstrap," module 4 "Visual Studio and ASP.NET Integration," near timestamp 00:33:45. To follow along, I installed SideWaffle today, modified "CodeTemplates/MvcView/List.cs.t4" as shown in the presentation, and tried to add the AlbumsController scaffold. However I got a similar error in the unmodified Create.cs.t4 file.

I spent some time trying to debug Create.cs.t4 without success, so I started over: deleted the entire CodeTemplates folder, saved and closed the solution to get rid of the persistent MvcView error, reopened the solution, added SideWaffle back in, and tried again to add the AlbumsController scaffold without modifying List.cs.t4. No luck... same error in Create.cs.t4.

So I started over again: deleted the entire CodeTemplates folder, saved and closed the solution to get rid of the persistent MvcView error, reopened the solution, added SideWaffle back in, and deleted Create.cs.t4. This time, when trying to add AlbumsController scaffold, the error moved to Edit.cs.t4. I am attaching a screen shot of the error.

2016-03-19 5

I posted the problem in the MVA forum for "Building Responsive UI with Bootstrap" in a thread started by someone else (who could proceed by deleting both Create.cs.t4 and Edit.cs.t4). See
http://trainingsupport.microsoft.com/en-us/tcmva/forum/tcmvacoursefdbk-tcmvavisual/part-4-of-the-building-responsive-ui-with/92b2d873-8338-4f11-af53-f400a4c371da?auth=1.

But otherwise I am giving up and just editing my views manually until you guys fix this issue.

@brgrz
Copy link

brgrz commented Jun 13, 2016

Even the most simple use case doesn't work. Installing SideWaffle ASP.NET T4 templates to a project then trying to add a Create view for a view model.

Error

There was an error running the selected code generator:

'Failed to render template because of the following errors:

''Compiling transformation: } expected' at line number '168' and column number '33','Compiling transformation: } expected' at line number '537' and column number '33''.'

sidewaffle

@brgrz
Copy link

brgrz commented Jun 13, 2016

Using templates for Details view does work however.

sayedihashimi added a commit that referenced this issue Jun 13, 2016
sayedihashimi added a commit that referenced this issue Jun 14, 2016
updating t4 from prog files #330
@sayedihashimi
Copy link
Member

Here is what I tried

  1. File New Project - ASP.NET MVC
  2. Add ASP.NET T4 files
  3. Modify Empty controller t4 file
  4. Add New Scaffolded Item - Empty Controller

The controller was added with my customizations fine.

I went ahead and refreshed the t4 files and created a new vsix at https://ci.appveyor.com/project/sayedihashimi/side-waffle/build/1.21.404/artifacts.

I'm wondering what's different from what I'm doing versus you. Are you running VS Community edition by chance?

@brgrz
Copy link

brgrz commented Jun 14, 2016

@sayedihashimi as you can see from the screenshot @wkrasl attached and my posting we were both having issues wtih the View templates. Please also give it a try with MvcView templates.

Other than that, I am in fact using VS Community. I am also VS Enterprise user but I'll be only able to try it out with VS Enterprise tomorrow. Will let you know how it goes.

@brgrz
Copy link

brgrz commented Jun 14, 2016

I just tried the latest vsix build with VS Community and it results in the following error when I try to add the ASP.NET T4 Scaffolding files

image

@sayedihashimi
Copy link
Member

Thanks for the notes.

This sounds like a bug in Visual Studio community edition and not SideWaffle. I would expect that you get the same result if you copied .t4 template files from C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\ into CodeTemplates in your project.

When you use SideWaffle in that scenario all it is doing is dropping the files in the right folder. When you invoke the Add New Scaffolded item dialog from there it's responsible for what happens after that.

I'll open a bug on in https://github.com/aspnet/Tooling for this.

@sayedihashimi
Copy link
Member

OK I've opened aspnet/Tooling#585. Let's us that for follow up going forward.

I'd be interested in hearing over there if any .t4 file works with VS Community edition, maybe that's the issue?

@brgrz
Copy link

brgrz commented Jun 14, 2016

@sayedihashimi Do you think this should be reported to VS's Connect rather than on ASP.NET Core tooling site?

@sayedihashimi
Copy link
Member

No this is better in the repo put it in. My team should do initial investigation since we own ASP.NET scaffolding. If T4 doesn't work at all in Community that's good for Connect.

@AudeR
Copy link

AudeR commented Jul 7, 2016

The following error occurs after the ASP.net scaffolding T4 files are in the project while attempting to add a new scaffolding item in Visual studio 2015 community MVC project.

image

This error does not occur if the THE T4 files have not been added

@sayedihashimi
Copy link
Member

Reopening based on #384 (comment) for discoverability here.

@sayedihashimi sayedihashimi reopened this Jul 8, 2016
@habyphael
Copy link

had a similar problem with the model that I was trying to use. I commented out the OnModelCreating override, then I could add the scaffolded item, and uncommented the OnModelCreating ovveride and ran the program it worked.

@rdskill-dev
Copy link

so... here we are in Q1 of 2017 and this is still and issue. Fricken amazing.

VS 2015 Community and Sidewaffle v1.21.400

Compiling transformation: } expected (Lines 169 and 538)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants