After you have installed DXA on your Content Manager (cms-import.ps1) you probably tried the web installer (web-install.ps1) which deploys the sample site to IIS. The next step could be to run the site as Visual Studio solution and start developing your DXA based web application. I often get the question, how do you get started with a DXA site solution in Visual Studio?
The quickest way to get started is to take the DXA example site solution from this repository https://github.com/jhorsman/dxa-example-site-dotnet. This contains a Visual Studio solution with a Site project and a project with the DXA Core module. This solution is assembled from the original DXA source code, and the purpose of this repository is to get you started as quickly as possible.
This is how to get started in a few easy steps.
Prerequisites
- Make sure you have DXA installed on a SDL Web 8 Content Manager, and published pages and DXA configuration to the Content Delivery environment.
- Create a publication mapping for your local machine to the "400 Example Site" publication. In this example we map http://localhost:81 to this publication. We need this mapping so that you can run the website on your local machine, or any other machine where Visual Studio is running.
- You do not need to have the DXA website deployed to IIS, since we are going to make the website in Visual Studio.
Create the solution in Visual Studio
- Clone the repository; Check out https://github.com/jhorsman/dxa-example-site-dotnet.git in your GIT client, or download from the GitHub site.
- Open the solution dxa-example-site-dotnet\DxaWebApp.sln in Visual Studio.
- Set the project URL; Open the Properties of the DxaWebApp project, go to the Web tab, and set the Project Url to http://localhost:81/. Or use any other port you have set in the publication mapping.
- Set the SDL Web Discovery service details; Open the Web.config from the DxaWebApp project, set the discovery-service-uri. And if needed the oauth-enabled, oauth-client-id and oauth-client-secret properties.
- Run the site; On the first run NuGet packages will be restored, the projects are built and some files views will be copied.
Conclusion
From here you can explore the Site project, see how the Core module works and add your own modules.
This article is written for DXA 1.7 with the DXA 1.7 solution from the dxa-example-site-dotnet repository.