Skip to content Skip to sidebar Skip to footer

Vsts Grunt Please Try Running This Command Again as Root administrator

Building Projects with Yeoman¶

By Steve Smith, Scott Addie, Rick Anderson and Noel Rice

Yeoman generates complete projects for a given ready of customer tools. Yeoman is an open-source tool that works similar a Visual Studio project template. The Yeoman control line tool yo works alongside a Yeoman generator. Generators define the technologies that go into a project.

Sections:

  • Install Node.js, npm, and Yeoman
  • Create an ASP.NET app
  • Restore, build and run
  • Specifying the client-side task runner
  • Building and Running from Visual Studio
  • Restoring, Building, and Hosting from the Command Line
  • Adding to Your Project with Sub Generators
  • Related Resources

Install Node.js, npm, and Yeoman¶

To get started with Yeoman install Node.js. The installer includes Node.js and npm.

Follow the instructions on http://yeoman.io/learning/ to install yo, bower, grunt, and gulp.

                            npm install -g yo bower grunt-cli gulp            

Notation

If yous get the mistake npm ERR! Please try running this command once more as root/Ambassador. on Mac OS, run the post-obit command using sudo: sudo npm install -g yo bower grunt-cli gulp

From the command line, install the ASP.NET generator:

                            npm install -chiliad generator-aspnet            

Note

If you get a permission error, run the command nether sudo equally described above.

The –m flag installs the generator globally, then that it can be used from any path.

Create an ASP.NET app¶

Create a directory for your projects

Run the ASP.Cyberspace generator for yo

The generator displays a card. Pointer downwardly to the Empty Web Application project and tap Enter:

../_images/yeoman-yo-aspnet.png

Use "EmptyWeb1" for the app proper noun and and so tap Enter

Yeoman will scaffold the project and its supporting files. Suggested next steps are besides provided in the form of commands.

../_images/yeoman-yo-aspnet-created.png

The ASP.NET generator creates ASP.Internet Cadre projects that can exist loaded into Visual Studio Code, Visual Studio, or run from the command line.

Restore, build and run¶

Follow the suggested commands by changing directories to the EmptyWeb1 directory. And so run dotnet restore .

../_images/dotnet-restore.png

Build and run the app using dotnet build and dotnet run :

../_images/dotnet-build-run.png

At this bespeak you lot tin can navigate to the URL shown to test the newly created ASP.NET Core app.

Specifying the client-side task runner¶

The ASP.NET generator creates supporting files to configure customer-side build tools. A Grunt or Gulp task runner file is added to your projection to automate build tasks for Spider web projects. The default generator creates gulpfile.js to run tasks. Running the generator with the --grunt argument generates Gruntfile.js:

The generator also configures package.json to load Grunt or Gulp dependencies. It too adds bower.json and .bowerrc files to restore customer-side packages using the Bower client-side package director.

Building and Running from Visual Studio¶

You can load your generated ASP.NET Core web project directly into Visual Studio, then build and run your project from there. Follow the instructions above to scaffold a new ASP.Internet Core app using yeoman. This time, choose Web Application from the menu and proper name the app MyWebApp .

Open Visual Studio. From the File menu, select .

In the Open Project dialog, navigate to the project.json file, select it, and click the Open button. In the Solution Explorer, the project should await something like the screenshot beneath.

../_images/yeoman-solution.png

Yeoman scaffolds a MVC spider web application, complete with both server- and client-side build support. Server-side dependencies are listed under the References node, and client-side dependencies in the Dependencies node of Solution Explorer. Dependencies are restored automatically when the project is loaded.

../_images/yeoman-loading-dependencies.png

When all the dependencies are restored, press F5 to run the project. The default abode page displays in the browser.

../_images/yeoman-home-page.png

Restoring, Edifice, and Hosting from the Command Line¶

Y'all can fix and host your web application using the .NET Core control-line interface.

From the command line, alter the current directory to the folder containing the project (that is, the folder containing the project.json file):

From the command line, restore the projection's NuGet package dependencies:

Run the application:

The cross-platform Kestrel spider web server will brainstorm listening on port 5000.

Open a spider web browser, and navigate to http://localhost:5000.

../_images/yeoman-home-page_5000.png

Calculation to Your Project with Sub Generators¶

You tin can add new generated files using Yeoman even subsequently the projection is created. Employ sub generators to add any of the file types that make upwardly your project. For example, to add together a new grade to your projection, enter the yo aspnet:Class control followed by the name of the class. Execute the following control from the directory in which the file should exist created:

The result is a file named Person.cs with a form named Person :

                            using              System              ;              using              System.Collections.Generic              ;              using              System.Linq              ;              using              System.Threading.Tasks              ;              namespace              MyNamespace              {              public              form              Person              {              public              Person              ()              {              }              }              }            

shipmanagnection93.blogspot.com

Source: http://jakeydocs.readthedocs.io/en/latest/client-side/yeoman.html

Post a Comment for "Vsts Grunt Please Try Running This Command Again as Root administrator"