Adding an AngularJS project to a Visual Studio 2012 solution - angularjs

I would like to create a Visual Studio 2012 (Premium) solution, initially containing a project for an AngularJS client. Later on, at least one ASP.NET MVC 4 project will be added defining the server the AngularJS client talks to. We would like to keep these things in one solution.
The problem is that I cannot find a fitting project template (installed or online) or a way to manually define such a project. No matter which project template I choose there is always too much cruft being added, as all project templates are based on some programming language / environment irrelevant to the AngularJS project. I would be happy with a blank project template to which only the relevant html, js, css,... files would be added.
One could of course define the ASP.NET MVC 4 project and then add the client parts to some folders in that project, we had already done such things in the past, but things get very cluttered.
Do you know how to naturally define such a web client project in VS 2012 or if VS 2013 does handle this better?

We came up with the following solution: In Visual Studio, select "Add New Web Site" -> "ASP.NET Empty Web Site". This approach fits the bill since it does not add much to our AngularJS project and hosting the application is also taken care of.

I would suggest create a new ASP.NET Web API project. File - > New Project-> ASP.NET MVC4 Web Application . In the next screen, select "Web API". Since you are doing the client only using HTML,CSS and JS , your server side becomes a bunch of APIs for which you need to create a Web API project only and not a full MVC 4 app. Even Web API project also comes with some MVC4 files and folders, which you can remove easily.

Related

Visual studio 2019 and IdentityServer project template

Trying to follow the tutorials for IdentityServer using Visual studio 2019.
As per the instructions created a .Net Core Web Application and then an MVC project type and as per tutorials a welcome screen for IdentityServer should come at run time
But i am getting an MVC page template only like this
Is there any difference in project templates based on new visual studio updates? Or what is the correct selection of project types to get the window similar to the first image ?
It seems you are running the mvc application insteed of the identity provider service.
Go to the solution properties, Common Properties, and select Multiple startup projects. Then change the Action to Start for debug all your projects.
If you prefer start only your identity provider service set it as the Single startup project.

How to add reference to DotNetNuke Library/Framework in a C# Project

I am developing a mobile app that uses DNN on the backend. I want to create a Web API that receives a DNN UserID and returns the user's Profile Picture.
Most of the documentation and posts speak to developing Modules and focus on DNN Templates that are available.
All I want to do is add a reference to DNN Library in my Visual Studio Project so that I can access the DNN API. I right click on references yet can't find DNN.
How is this accomplished?
Thanks.
EDIT... I'm developing on the same server that DNN is running on.
It turned out it was a simple matter of pointing to the dll's I wanted to use in the bin subfolder of DotNetNuke.

Is it possible to build a SPA without using .net framework in visual studio?

The title should be self-explanitory, but just in case. I am trying to build an angular application which will be hosted on azure. Currently I am having some issues with using kestrel, so I would like to build the application in visual studio but without using any .net code (so no startup.cs or program.cs).
If the answer is plainly no, then I guess I will need to find another IDE that will do what I require.
Yep. Just create a website project instead of a web application project.
https://msdn.microsoft.com/en-us/library/dd547590.aspx
Scenarios in which Web site projects are the preferred choice include the following:
You do not want to have to explicitly compile the project in order to deploy it.
Yes it is very much possible with visual studio to develop a SPA in angular without using .net framework. Below are the steps you can follow to getting started with a SPA in angular using visual studio.
Goto: File > New > Project
From the below screen selecet ASP.NET Web Application
Provide Name, Location, Solution click OK will get the below popup
From the above Popup select Empty and Press OK to create your project.
Now add an html file say index.html to the project. Write the below code in index.html
<head>
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js"></script>
</head>
<body>
<div ng-app>
Message:<input type="text" ng-model="message" />
<hr>
<div>Entered Message:{{message}}</div>
</div>
</body>
</html>
And you are good to go. Right click on index.html and select View In Browser you will see the output in your browser something like this.
Now You can can create a directory structure accordingly. Below are few link that can help you with the directory structure.
Directory Structure Angular
Angular Folder Structure
Angular App Structure Guideliines
Or you can follow the steps as stated on official Angular website for getting started with an angular project in Visual Studio
VISUAL STUDIO 2015 QUICKSTART ANGULAR
Hope this Helps :)
Yes you can develop a SPA application without .net code in visual studio. Visual studio code is another IDE for cross platform development.
Check out the example at pluralsight
My Assumption here: You are ok to work on your website offline without actually firing it off thru the Azure hosted location.
I will try to address how to have a website opened up in Visual Studio which has nothing to do with project based on .NET Framework.
Steps to follow:
a. Create a physical folder on your drive and keep your SPA related files in it or let's say keep a simple "HelloWorld.html" file which just display some plain text.
b. Go to VS > File > Open > Website (Four or more options will be present)
- choose the simplest "File System" and point to the folder created in step a.
VS will open the folder as website and add a solution file to it but no other .NET Code is associated to it. This way you can use the IDE as I think you intend to use.
If you using node toolings to build you project you may want to try Node.js Tools for Visual Studio
It does have support for gulp/grunt tasks as well as it has integration with azure. The support is provided via custom project types.

CustomerManager angularjs by DanWahlin

I m trying to learn Angular.js framework, getting examples on internet "CustomerManager angularjs by DanWahlin" demo seemed comprehensive and downloaded the code from Github "https://github.com/DanWahlin/CustomerManager" .
But when I try to open the index.html, it doesn't show anything. am I doing some mistake??
other examples that I downloaded like TODO using angular work fine.
Also if anyone can share some real time examples as to how the code is generally organized in PROD then it will be very helpful.
Thanks.
It is because the files are not supposed to be opened in a browser directly from the file-system.
(Many src, href etc attributes break.)
You have to follow the instructions on the Readme.md file. E.g. on Windows:
The following is required to support the backend services:
Visual Studio 2012 Web Express (free version) or higher - http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products#product-express-summary
ASP.NET MVC and Web API are used for the back-end services along with Entity Framework for database access (included if you have VS 2012 express installed)
To get started, double-click the CustomerManager.sln file located at the root of the CustomerManager repository. Once the solution loads press F5 to run the project.

Convert Composite C1 - insert MVC partial requires Visual Studio solution?

It appears that you either start a Composite C1 site by using the Visual Studio solution - or just install the exe, which contains no solution file and can just be used through the web CMS.
I need to include an MVC 4 Partial in a page on a site that was only installed with the .exe & edited only through the web CMS. Can I add a partial in the CMS (not in VS), or do I have to use VS & manually compile the site before deployment?
I have tried adding the sample MVC files from the below to my C1 site & navigating to /Home:
http://docs.composite.net/Functions/MVC/HelloWorldMVC
The URL for Composite is localhost/mysite
I try going to localhost/mysite/home - but it doesn't work.
Thanks.
do I have to use VS & manually compile the site before deployment?
Normally, you don't need Visual Studio in order to use the MVC Player - unless you have to use VS (or any other tool) to create and add views and controllers to the website. In any case, everything should work on-the-fly without having to compile the website

Resources