5

I would like to do some client side-only web development using VS 2015. I don't need any server-side code, and I don't need any .net code compilation going on. However, I would like javascript intellisense, specifically in this case for angularjs (presumably using the _references.js file) and bower support.

How could I achieve this in Visual Studio 2015? I have been looking at the ASP.net 5 templates:

enter image description here The closest-looking thing I can see is the 'Empty' option, which has no controllers. This also has the little 'dependencies' arrow visible in the tree, and it seems trivial to add bower.json and _references.js (which according to my limited understanding, is what gets the intellisense working properly.)

enter image description here

However, it also has 'Startup.cs' that sets up various services that I don't need for my use case. Removing this file 'naïvely' gives Error CS5001 Program does not contain a static 'Main' method suitable for an entry point when I build the xproj. Unlike with a .csproj, there's no ability to change the output type of the project, and in any case, I don't want to be creating a .dll. I guess the next step might be to use a custom version of Microsoft.DNX.targets, but at this point I seem to be wandering off the beaten track a bit.

So, a 'Web Site'...

enter image description here ...doesn't have the 'Startup.cs', but it doesn't seem to be able to do anything with bower either.

enter image description here

I'd be interested to know how to do this in projects/templates for earlier versions of ASP.net too, if they could offer the same capabilities.

Нет войне
  • 1,139
  • 1
  • 11
  • 21
  • 3
    IMHO -- this question is NOT "too broad" -- the existing vote-to-close does not make sense to me – David Tansey Dec 22 '15 at 19:59
  • @DavidTansey There's many ways of doing this, from using sidewaffle templates to starting from scratch. OP can't find a template that does this for him. Okay. But what do you do when you don't have a template for the application you want to write? You start from scratch, or you find a template. Asking for links to templates is off topic, so he needs to start from scratch--start with an empty website, start adding stuff, and come back when he has issues with that. –  Dec 22 '15 at 20:50
  • 1
    @Will That's (part of) what I've done - I've started with the 'Empty' template and confirmed that adding *bower.json* and *_references.js works* - but there's still c# code in there, presumably being compiled on build? that I can't take out. I'd hope I don't need any .net code being compiled, as all I want from the web server is static files being served. Of course it's possible that I'm daft to think I want the server.cs taken out, or it's possible that there's another project that's a better starting point... – Нет войне Dec 22 '15 at 21:03
  • Aaah, I didn't get that from your question. Yeah, you can probably remove all references and all code and it should work. Have you tried? Do it and see what happens... I think that won't affect the UI work the new project system is doing. –  Dec 22 '15 at 21:33
  • @Will yep, I tried that, but it won't then build (added detail in the question). – Нет войне Dec 22 '15 at 23:09
  • Hmm... Do the new features (i.e., bower dependencies that are handled like proper dependencies) work in web applications? As in, instead of going to file->new->website, go to file->new->project and select a web application project that most closely matches your needs, and remove the global.asax file, references, and code you don't. If you can't get that working, you might be out of luck. I think Visual Studio Code might handle this better. Good luck. –  Dec 23 '15 at 14:59
  • @Will It seems to be only the new ASP 5 projects that give you the bower stuff, and that's what I was looking at in the first part of my question. For now I can follow Bart C's advice below and play with the empty project - I'm sure all sorts of things are possible if I get more deeply into MSBuild. Thanks for the pointer to sidewaffle, I'm sure that'll give me some more ideas as to the possibilities. – Нет войне Dec 23 '15 at 17:49

1 Answers1

1

Startup class is useful for static file service. It what actually boots up your 'server'. ASPNET5 empty template is perfect for the job.

Bart Calixto
  • 19,210
  • 11
  • 78
  • 114
  • 3
    Good to know that's not a crazy option. I really just want the server to serve static files though, like with a "web site" - I was hoping I could do that with a completely default server configuration that didn't require any .net code to be built when I built my project. – Нет войне Dec 22 '15 at 23:27