Converting Visual Studio Solutions to Angular CLI
Technical Info
>
Converting Visual Studio Solutions to Angular CLI
Set up a new CLI solution
- Download the latest Responsive UI Starter Template from the Current Release page.
- Unzip and open the root folder in Visual Studio Code or your editor of choice.
- Open a command prompt (Ctrl+~ in VS Code) and execute
npm install. - Once installation is complete, execute ’ng serve’ and open your new application at
http://localhost:4200to confirm it builds and runs. - Do a global search for the following terms and replace them with your application’s name:
responsive-controls-templateresponsivecontrolstemplate
- Remove any unneeded components from the solution. For instance, if you don’t have an About component in your existing solution:
- Delete the
/src/app/components/aboutfolder. - Remove
import { AboutComponent } from './components/about/about.component';from the /src/app/app.module.ts file. - Remove
AboutComponentfrom thedeclarationssection of/src/app/app.module.ts. - Remove the
associatedroute. - Do this for all unneeded components.
- Delete the
Import/generate providers, services, classes and components
- Copy in any required providers and services from the existing solution’s
app.module.tsto the newapp.module.ts. - Copy in any required providers and services from the existing solution’s
app.component.tsto the newapp.component.ts. - Generate new components in applications. This can be done one of two ways:
- Copy over component folders manually and add associated
importstatements anddeclarationsin the new app.module.ts - Alternatively, you can use CLI to generate the components using the ’ng g c newComponentName’ syntax. This will create the required files and add the needed
importanddeclarationsto the app.module.ts file.
- Copy over component folders manually and add associated
- Copy over your route information from your existing solution to the
app.module.tsfile. - Copy over existing
classesfolder to/src/app. - Copy over existing
servicesfolder to/src/app. - If you used CLI to generate the new components in step 9, open your existing components and copy in the html, ts and css in to each respective file.
Finalize any additional assets
- Copy over images and other assets to the new
/src/assetsfolder. Execute a global search to find paths in code and update the path to match new folder structure. - Copy in any additional entries from the existing
index.htmlfile (css, meta, etc). - Copy over
favicon.icoto the/srcfolder.
Support options
Last updated Fri Feb 17 2023