Preparing the development environment involves the following procedures (which are described below):
Info |
---|
Because packages compiled from some of the projects are used during the code generation of later projects, there is a potential for earlier packages to be locked if the solution is recompiled in rapid succession. This is due to the way that MSBuild caches build processes to minimize compile time by default. Build processes are normally held for reuse for approximately 10 minutes. |
To turn off this default behavior when compiling in Visual Studio, the |
“MSBuildDisableNodeReuse” MSBuildDisableNodeReuse variable must be set. There are two options for setting this variable:- Setting the variable globally
- Setting the variable per command prompt session
Both options instruct the compiler to create a new process for each build job. As a side effect, this action also releases any resources that may be held by inactive compiler processes. |
If these settings are not applied, Visual Studio or MSBuild may lock resources during build. Restarting Visual Studio (or the command prompt session) will resolve the problem for the first build after the restart. Waiting for up to 15 minutes between builds will also achieve this. |
The options for setting this variable are described below |
:Option 1: Setting “MSBuildDisableNodeReuse” Set MSBuildDisableNodeReuse Globally
“MSBuildDisableNodeReuse” MSBuildDisableNodeReuse variable globally use the “Environment Variables” property page, which is accessed by right-clicking Computer, clicking Properties, and clicking the “Environment Variables” button under the “System Properties” dialog window Advanced tab.Image Added |
Image RemovedImage RemovedImage Added To turn off this behavior when compiling the solution using MSBuild, include the following compiler flag: |
Option 2: Setting “MSBuildDisableNodeReuse” Set MSBuildDisableNodeReuse per Command Prompt Session
"MSBuildDisableNodeReuse” MSBuildDisableNodeReuse variable is set within a command prompt session, the Visual Studio development environment must be launched using |
the devenv
command the devenv command (rather than from an icon): Code Block |
---|
language | powershell |
---|
theme | Confluence |
---|
| SET SET MSBUILDDISABLENODEREUSE= | 1 |
Restore Any Missing NuGet Packages
The Visual Studio Projects within the Ed-Fi ODS / API solution use many NuGet packages, which may need to be restored for a successful build.
To check for missing NuGet packages and restore any that are missing:
Start Visual Studio and open the Ed-Fi ODS solution file: Code Block |
---|
C:\Ed-Fi-ODS-Implementation\Application\Ed-Fi-ODS.sln |
Ensure that the Ed-Fi Alliance NuGet Feed is one of your available NuGet package sources. From the NuGet Package Manager > Package Sources settings dialog box, make sure that https://www.myget.org/F/ed-fi/ is one of the sources. The default name is “Ed-Fi Alliance NuGet Feed,” but you can rename the feed without affecting the source.Ensure that prerelease packages are available for download from NuGet. From within the Manage NuGet Packages dialog box, which is accessible from the context menu of the solution or any of the projects, as well as the Tools > Manage NuGet Packages menu, select Online from the options on the left of the dialog. At the top of the dialog box, select Include Prerelease from the untitled combo box.Image Removed
Open Tools > NuGet Package Manager > Package Manager Console and press Restore as shown below. This will download all the packages required to build the solution and configure the environment. Depending on the speed of your internet connection, this may take several minutes.Image RemovedClose Visual Studio when all of the missing packages have been downloaded.Create SQL Logins
Some SQL logins need to be created in SQL Server. These may be added by downloading and running the following script from within Microsoft SQL Server Management Studio: CreateLocalLogins.zip.
Verify PowerShell Script Permissions
You may need to change the execution policy for unsigned PowerShell scripts to run on your machine to run the scripts. This may be accomplished by opening a powershell console as administrator and typing the following command.
Code Block |
---|
|
Set-ExecutionPolicy Unrestricted |
Initialize PowerShell Scripts for
DevelopmentThere DevelopmentThere are several databases that must be successfully deployed. PowerShell scripts that initialize all necessary development databases are included in the Visual Studio solution.These scripts are enabled for use within Visual Studio when the Ed-Fi-ODS solution is opened.2 They may also be loaded for use within a PowerShell console window3 by running the initialize PowerShell for development script4 located at:
Code Block |
---|
C:\Ed-Fi-ODS-Implementation\Initialize-PowershellForDevelopment.ps1 |
Info |
---|
If you are in the C:\Ed-Fi-ODS-Implementation directory, PowerShell will auto-complete the script for you if you type "Init" and then press Tab. |
In either case, when the scripts are loaded, you should see the results shown below.
Code Block |
---|
PS C:\edfigit\Ed-Fi-ODS-Implementation> .\Initialize-PowershellForDevelopment.ps1
Importing Module: InitializeDevelopmentEnvironment.psm1
Using repositories from environment variable: Ed-Fi-Common;Ed-Fi-Ods;Ed-Fi-ODS-Implementation
PS C:\edfigit\Ed-Fi-ODS-Implementation> |
Info |
---|
The script may not finish with a command prompt when it is automatically loaded with the solution in Visual Studio in some circumstances. Simply press Enter and ignore any messages that appear in the console window. |
Initialize the Development
EnvironmentOnce EnvironmentOnce the PowerShell development scripts have been loaded and a development certificate has been installed, the development environment may be initialized by typing the initdev
command in a PowerShell console. This command creates databases, generates code templates, and compiles projects in the solution.
Info |
---|
Initializing the development environment will take several minutes to complete. Some developers report encountering an error during the initialization process the first time it is run. This is due to an intermittent timing issue. The issue generally resolves itself when the initdev process is run a second time. |
4 In order to run the scripts from a PowerShell console, the solution must be loaded at least once from Visual Studio in order to retrieve the required NuGet packages – as described in an earlier step.