twitter.bootstrap.mvc icon indicating copy to clipboard operation
twitter.bootstrap.mvc copied to clipboard

A namespace cannot directly contain members such as fields or methods

Open bdelaney opened this issue 11 years ago • 7 comments

This error on build out of the Nuget Templates package, ControllerWithContext.tt showing a .cs output and that is source of error. Used latest Nuget packages (all 3) in an MVC4 project, Empty template. This occurred after the recommended project close and reopen.

Deleted the ControllerWithContext.cs output file and build works.

After installing the 3 NuGet packages, Package Manager GUI shows 4 packages, all are 1.0.90 version. Makes sense as I look at packages.config file and note what has been installed: <package id="Twitter.Bootstrap" version="2.3.1" targetFramework="net45" /> <package id="twitter.bootstrap.mvc4" version="1.0.90" targetFramework="net45" /> <package id="twitter.bootstrap.mvc4.htmlhelpers" version="1.0.90" targetFramework="net45" /> <package id="twitter.bootstrap.mvc4.sample" version="1.0.90" targetFramework="net45" /> <package id="twitter.bootstrap.mvc4.templates" version="1.0.90" targetFramework="net45" />

Looking forward to checking it out further.

bdelaney avatar Mar 06 '13 18:03 bdelaney

There seems to be missing some relevant information from your bug report. What has been installed?

serra avatar Mar 07 '13 07:03 serra

I'm having the exact same issue.

I am using the MVC4 Internet Application Template.

I've installed the packages in this order:

PM> install-package twitter.bootstrap.mvc4 PM> install-package twitter.bootstrap.mvc4.sample PM> install-package twitter.bootstrap.mvc4.templates PM> install-package twitter.bootstrap.mvc4.templates.htmlhelpers

By the time it installed the "templates" I could see 3 items in my errors list: Untitled

I have installed the HTML Helpers with no problems

MilkyWayJoe avatar Mar 08 '13 21:03 MilkyWayJoe

Hmm, I'll try this out. By twitter.bootstrap.mvc4.templates.htmlhelpers, I assume you mean twitter.bootstrap.mvc4.htmlhelpers? Note that the htmlhelpers package already should be installed with the sample too.

serra avatar Mar 09 '13 14:03 serra

This is because the custom template of CodeTemplates\AddController\ControllerWithContext.tt is not cleared.

Workaround for now ( @bdelaney and @MilkyWayJoe ) is to simply clear the Custom Tool in the file property window.

This is a valid bug report though - afaik the Custom Tool property was automatically cleared in earlier releases.

serra avatar Mar 09 '13 14:03 serra

Correction: I fixed this as part of #29, but that is pull request is still open. @erichexter or @MisterJames please consider merging #29.

serra avatar Mar 09 '13 14:03 serra

Im traveling and will be iffline foe the next two weeks.

James can you apply the pr? On Mar 9, 2013 8:41 AM, "Marijn van der Zee" [email protected] wrote:

Related: #29https://github.com/erichexter/twitter.bootstrap.mvc/issues/29and #57 https://github.com/erichexter/twitter.bootstrap.mvc/issues/57.

— Reply to this email directly or view it on GitHubhttps://github.com/erichexter/twitter.bootstrap.mvc/issues/79#issuecomment-14664038 .

erichexter avatar Mar 09 '13 15:03 erichexter

@serra yeah, I wrote it incorrectly here, but I've actually installed twitter.bootstrap.mvc4.htmlhelpers

MilkyWayJoe avatar Mar 09 '13 18:03 MilkyWayJoe