GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Updated for 1.0.4 release · ServiceStack/ServiceStackVS@6a1de55

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • README.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+200-23Lines changed: 200 additions & 23 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,224 @@ ServiceStackVS
22
==============
33

44
ServiceStackVS is a Visual Studio extension that enhances the development experience when working the [ServiceStack framework](https://servicestack.net).
5+
## 1.0.4 Release
56

6-
### C# Templates
7+
New to ServiceStackVS in 1.0.4 is the Add/Update ServiceStack Reference for F# and a new AngularJS App template.
78

8-
## 1.0.3 Release ##
9-
New for ServiceStackVS in 1.0.3 update are **5 F# templates** and a *beta* version of a new **AngularJS Single Page App template** which includes the use of **NPM**, **Bower**, **Grunt**, **Gulp** and **Karma**. This template is designed to work along side Microsoft's new **[Task Runner Explorer](http://www.hanselman.com/blog/IntroducingGulpGruntBowerAndNpmSupportForVisualStudio.aspx)** extension.
9+
### F# Add/Update ServiceStack Reference
10+
ServiceStackVS now supports Add ServiceStack for F# projects to work along side ServiceStack's new [F# Native Types](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#fsharp-native-types-notes). See our [example usage](https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#example-usage) for a guide on how to use this in your project.
1011

11-
#### F# Templates ####
12+
### AngularJS Single Page App Template
1213

13-
![F# templates](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/fhsarp-templates.png)
14+
**AngularJS App** is a new template in [ServiceStackVS](https://github.com/ServiceStack/ServiceStack/wiki/Creating-your-first-project) that provides a modern opinionated web technology stack for developing rich Single Page Apps with [AngularJS](https://angularjs.org/) and ServiceStack.
1415

15-
The 5 F# templates reflect their C# counter parts in the ServiceStackVS extension. There is also a community created [F# ServiceStack](http://visualstudiogallery.msdn.microsoft.com/278caff1-917a-4ac1-a552-e5a2ce0f6e1f) extension which also shows off ServiceStack (V3 and V4) using F# in various configurations. These templates are great single project templates, where as our new F# templates follow our recommended multi-project structure showing the F# equivilent of some of the existing C# templates.
16+
### The trend towards a JavaScript-based Client Build system
1617

17-
##### Demo #####
18-
Below is an example of creating a service that serves data from Freebase, showing F# strengths of concise, readable code working with ServiceStack's data formats.
18+
The future of modern client web development has been moving towards a pure JavaScript environment for client HTML/JS/CSS development, we've noticed the benefits of this approach years ago when we developed our [node.js powered Bundler](https://github.com/ServiceStack/Bundler) taking advantage of [node.js](http://nodejs.org/) rich ecosystem for all our bundling, minification and Web DSL needs. As this is also the trend we see with web development in VS.NET going visible by the recent preview of [Grunt and Gulp.js integration in Visual Studio](http://www.hanselman.com/blog/IntroducingGulpGruntBowerAndNpmSupportForVisualStudio.aspx), we're confident in promoting this approach for the development of large, JavaScript-heavy Web Apps.
1919

20-
![](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/fsharp-template-with-demo.gif)
20+
This template marks our first iteration of this effort that we intend to continually improve and closely follow VS.NET's Grunt/Gulp.js integration so our automation tasks can be run directly from VS.NET UI Task Runners. In addition, this template also provides `.bat` files for running high-level grunt tasks so it alsa enables a good experience even without VS.NET's [Task Runner Explorer extension](http://visualstudiogallery.msdn.microsoft.com/8e1b4368-4afb-467a-bc13-9650572db708) (a preview of what will be available in VS 2014) which can be quickly run with a [keyboard shortcut for running external commands](https://github.com/ServiceStack/Bundler#create-an-external-tool-inside-vsnet) in VS.NET.
21+
22+
![Template Runner Explorer](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/trx-tasks.png)
23+
24+
### Technologies used
25+
26+
This templates leverages a number of best-in-class libraries to managing client web app development:
27+
28+
- [Karma](http://karma-runner.github.io/0.12/index.html) for UI and JavaScript Unit testing
29+
- [Bower](http://bower.io/) for managing client dependencies (angular, jquery, bootstrap, etc)
30+
- [Grunt](http://gruntjs.com/) as the primary task runner for server, client packaging and deployments
31+
- [Gulp](http://gulpjs.com/) used by Grunt to do the heavy-lifting bundling and minification
32+
- [NPM](https://www.npmjs.org/) to manage node.js dependencies (grunt, gulp, etc)
33+
34+
A lot this functionality is pre-configured and working out-of-the-box encapsulated within the high-level Grunt Tasks below:
35+
36+
- **[01-run-tests](https://github.com/ServiceStack/ServiceStackVS/blob/angular-spa-template/angular-spa.md#01-run-tests)** - Runs Karma JavaScript Unit Tests
37+
- **[02-package-server](https://github.com/ServiceStack/ServiceStackVS/blob/angular-spa-template/angular-spa.md#02-package-server)** - Uses msbuild to build the application and copies server artefacts to `/wwwroot`
38+
- **[03-package-client](https://github.com/ServiceStack/ServiceStackVS/blob/angular-spa-template/angular-spa.md#03-package-client)** - Optimizes and packages the client artefacts for deployment in `/wwwroot`
39+
- **[04-deploy-app](https://github.com/ServiceStack/ServiceStackVS/blob/angular-spa-template/angular-spa.md#04-deploy-app)** - Uses MS WebDeploy and `/wwwroot_buld/publish/config.json` to deploy app to specified server
40+
41+
### Requirements
42+
43+
This template relies on having [Node.js installed](http://nodejs.org/). If you try to use this template without node.js installed (ie, node.exe not found on the local machines PATH), you will be prompted to install it.
44+
45+
Once downloaded and installed, click `Continue` to create your project. If any of the NPM dependencies are not installed globally, the template will install the required NPM packages as well as download the Bower dependencies for the template.
46+
47+
Due to the dependency on Bower, [Git also needs to be installed](https://www.npmjs.org/package/bower) and select the second option to **Use Git from the Windows Command Prompt**. This is required due to commands run by Bower to install dependencies from Git repositories.
48+
49+
![](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/git-setup.png)
50+
51+
As soon as your project is open, all the required front-end dependencies will be ready to go. Local NPM dependencies to run Karma, Grunt and Gulp will download asynchronously and you'll be able to see the progress inside the ServiceStackVS output window in Visual Studio.
52+
53+
![](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/npm-install-on-create.png)
54+
55+
**For Visual Studio 2012 developers**, we have included shortcuts to the 4 main grunt tasks using batch files in the `wwwroot_build` folder. This is due to the [Task Runner Explorer extension](http://visualstudiogallery.msdn.microsoft.com/8e1b4368-4afb-467a-bc13-9650572db708) only supporting Visual Studio 2013 Update 3 and above.
56+
57+
### Managing front-end dependencies
58+
59+
To help add and install Bower and NPM dependencies, ServiceStackVS watches `bower.json` and `package.json` for changes and will run the appropriate install whenever these files are updated.
60+
61+
![NPM install performed on save](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/angular-spa-package-demo.gif)
62+
63+
A great extension to help find names and versions of these dependencies is the [Package Intellisense extension](http://visualstudiogallery.msdn.microsoft.com/65748cdb-4087-497e-a394-2e3449c8e61e).
64+
65+
### Debugging and Intellisense
66+
67+
Development iterations follow along with Visual Studio’s normal pattern when used with the built in IIS Express as it hosts the local development folder, so vendor provided JS/CSS are directly referenced from the `/bower_components` folder.
68+
69+
Included in the template is the `_references.js` that enables CSS/JS intellisense for all the included Bower components and NPM components. It is included in the default location of `/Scripts/_references.js` so that it should work by default when creating a new application.
70+
71+
### Building with Grunt/Gulp
72+
73+
As front-ends are getting more complicated, tools like Grunt and Gulp help to fill the gaps left out of the MSBuild cycle. Included in the template is a series of 4 tasks to test, package and deploy your application from Grunt.
74+
75+
![Building with TRX](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/angular-spa-build-app-demo_2.gif)
76+
77+
Although the template doesn't include a Gulpfile.js, it leverages Gulp via a grunt package called **grunt-gulp**. This done to take advantage of Gulp packages whilst keeping all tasks within one file.
78+
79+
#### The `wwwroot` folder
80+
81+
This folder is where your application is **packaged to ready to be deployed**. It contains the result of the 'package' Grunt tasks which take care of things like minification and updating the associated references. It also contains all the required server components like the 'bin', Global.asax and web.config.
82+
83+
![wwwroot folder output](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/angular-spa-wwwroot-output.png)
2184

22-
#### AngularJS Single Page App (Beta)####
85+
#### 01-run-tests
2386

24-
Another new addition is a more experimental template that includes some great tooling for building single page applications. This template comes packaged with:
87+
This task runs your tests configured in the `karma.conf.js` file. The template by default runs the tests once using **PhantomJS** as the browser. If you want to have Karma running and watching your files as you code, this can be changed by switching the `singleRun` flag in the Grunt configuration:
2588

26-
- Node Package Manager (NPM)
27-
- Bower
28-
- Grunt
29-
- Gulp
30-
- Karma
89+
karma: {
90+
unit: {
91+
configFile: 'tests/karma.conf.js',
92+
singleRun: false,
93+
browsers: ['PhantomJS'],
94+
logLevel: 'ERROR'
95+
}
96+
}
3197

32-
>Since this template installs all the required dependencies to make it easy for developers to try out and use, **it does take longer** than other templates to create. Also the **first build will pull down the required JS dependencies** from NPM and Bower, this will **also take time** depending on the speed of your internet connection. If you don't have Node.js, Grunt/Gulp installed locally, you also must **create the template running Visual Studio as an Administrator**
98+
![Running Karma tests via TRX](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/01-run-tests.png)
3399

34-
This template is the first iteration of a new effort that follows VS.NET's development of their new Grunt/Gulp.js support. Although it's still early, we believe this represents the future direction of more advanced Single Page web application development. We will continue to improve ServiceStackVS and follow VS.NET's progress.
100+
#### 02-package-server
35101

36-
As part of VS.NET's new efforts to support Grunt/Gulp.js, the [Task Runner Explorer preview](http://visualstudiogallery.msdn.microsoft.com/8e1b4368-4afb-467a-bc13-9650572db708) enables easy use of Grunt.js and Gulp.js tasks.
102+
To keep the packaging of your server self-contained within Grunt, this task performs the following tasks to get all the required server components staged in the `wwwroot` folder:
37103

38-
![Task Runner Explorer with ServiceStack Angular Single Page App template](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/task-runner-explorer.png)
104+
- Restore NuGet packages
105+
- Release build
106+
- Clean server files in wwwroot folder
107+
- Copy server required files
39108

40-
This template will take longer create due to installing Node related projects locally for your application to use. First build will also take some time due to NPM and Bower dependencies. If you don't have Node.js/Grunt/Gulp installed globally, it will also required creating the template whilst running **Visual Studio as Administrator**. For more information, see instructions here.
109+
One of these server files included, is the `appsettings.txt`. This can be used in deployment for overriding any development App Settings in the `Web.config` and read them in using ServiceStacks `AppSettings` property in the `AppHost`:
41110

42-
Any feedback or bug reports would be welcome, as this will be improved and updated over time.
111+
```csharp
112+
SetConfig(new HostConfig {
113+
DebugMode = AppSettings.Get("DebugMode", false)
114+
});
115+
```
43116

44-
![Angular Single Page Application Demo](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/angular-spa-demo.gif)
117+
If `appsettings.txt` exists in the root directory it will be used instead of the default Web.Config's `AppSettings`:
45118

119+
```csharp
120+
var customSettings = new FileInfo(@"~/appsettings.txt".MapHostAbsolutePath());
121+
AppSettings = customSettings.Exists
122+
? (IAppSettings)new TextFileSettings(customSettings.FullName, " ")
123+
: new AppSettings();
124+
```
125+
126+
As an example the `appsettings.txt` contains a single `DebugMode` setting:
127+
128+
# Release App Settings
129+
130+
DebugMode false
131+
132+
The `appsettings.txt` file is located in the `wwwroot_build/deploy` folder by default which is copied as a part of the `02-package-server` task.
133+
134+
#### 03-package-client
135+
136+
This task is also separated out to allow updating, and if required deployment, to just the client side resources. It cleans the client side related files in the wwwroot folder, bundles and copies the new resources. The bundling searches for assets in the index.html file and follows build comments to minify and replace references. This enables simple use of debug JS files whilst still having control how our resources minify.
137+
138+
```html
139+
<!-- build:js lib/js/angular.min.js -->
140+
<script src="bower_components/angular/angular.js"></script>
141+
<script src="bower_components/angular-route/angular-route.js"></script>
142+
<!-- endbuild -->
143+
<!-- build:js js/app.min.js -->
144+
<script src="js/hello/controllers.js"></script>
145+
<script src="js/navigation/controllers.js"></script>
146+
<script src="js/app.js"></script>
147+
<!-- endbuild -->
148+
```
149+
150+
When creating new JS files for your application, they should be added in the `build:js js/app.min.js` comments shown above.
151+
152+
Vendor resources from bower are also minified here to keep deployment simple and straight forward. If it makes more sense to use CDN resources, these build comments can easily be replaced. The above example results in the following two script includes.
153+
154+
```html
155+
<script src="lib/js/angular.min.js"></script>
156+
<script src="js/app.min.js"></script>
157+
```
158+
159+
#### 04-deploy-app
160+
161+
To give developers a starting point for deployment, we have included the use of a **grunt-msdeploy** task that can deploy to an IIS server with Web deploy. Config for the deployment, eg the IIS Server address, application name, username and password is located in the `/wwwroot_build/publish/config.js`.
162+
163+
{
164+
"iisApp": "YourAppName",
165+
"serverAddress": "deploy-server.example.com",
166+
"userName": "{WebDeployUserName}",
167+
"password" : "{WebDeployPassword}"
168+
}
169+
170+
If you are using **Github's default Visual Studio ignore, this file will not be included in source control** due to the default rule of `publish/` to be ignored. You should check your Git Repository `.gitignore` rules before committing any potentially sensitive information into public source control.
171+
172+
This task shows a quick way of updating your development server quickly after making changes to your application. For more information on use web-deploy using either Grunt or just Visual Studio publish, see '[WebDeploy with AWS](https://github.com/ServiceStack/ServiceStack/wiki/WebDeploy-with-AWS#deploy-using-grunt)'.
173+
174+
#### Main project structure
175+
176+
/css
177+
Application specific CSS files
178+
/img
179+
Image resources
180+
/js
181+
Application JS
182+
/partials
183+
AngularJS templates
184+
/Scripts
185+
Only here to enable intellisense for CSS and JS libraries by default
186+
/tests
187+
Karma config
188+
/unit
189+
Karma spec files
190+
/wwwroot
191+
Output directory
192+
/wwwroot_build
193+
Grunt shortcuts, build and deploy files
194+
AppHost.cs
195+
bower.json
196+
Global.asax
197+
gruntfile.js
198+
index.html
199+
package.json
200+
packages.config
201+
web.config
202+
203+
This project structure includes examples of a lot of the different tasks that will have to be done while building a single page application to guide developers as their application grows. The AngularJS side is largely influenced by various incarnations of the angular-seed project whilst still be contained within a VS project.
204+
205+
### Feedback Welcomed!
206+
207+
The AngularJS App template is trying to give a good starting point for developing a single page application within Visual Studio. Please raise any issues in the [Issues List](https://github.com/ServiceStack/Issues) or submit new [feature requests in our UserVoice](http://servicestack.uservoice.com/forums/176786-feature-requests).
208+
209+
210+
## 1.0.3 Release ##
211+
New for ServiceStackVS in 1.0.3 update are **5 F# templates** and a *beta* version of a new **AngularJS Single Page App template** which includes the use of **NPM**, **Bower**, **Grunt**, **Gulp** and **Karma**. This template is designed to work along side Microsoft's new **[Task Runner Explorer](http://www.hanselman.com/blog/IntroducingGulpGruntBowerAndNpmSupportForVisualStudio.aspx)** extension.
212+
213+
#### F# Templates ####
214+
215+
![F# templates](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/fhsarp-templates.png)
216+
217+
The 5 F# templates reflect their C# counter parts in the ServiceStackVS extension. There is also a community created [F# ServiceStack](http://visualstudiogallery.msdn.microsoft.com/278caff1-917a-4ac1-a552-e5a2ce0f6e1f) extension which also shows off ServiceStack (V3 and V4) using F# in various configurations. These templates are great single project templates, where as our new F# templates follow our recommended multi-project structure showing the F# equivilent of some of the existing C# templates.
218+
219+
##### Demo #####
220+
Below is an example of creating a service that serves data from Freebase, showing F# strengths of concise, readable code working with ServiceStack's data formats.
221+
222+
![](https://github.com/ServiceStack/Assets/raw/master/img/servicestackvs/fsharp-template-with-demo.gif)
46223

47224
The C# Project templates included in this extension:
48225

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.