Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 3

Preparing the development environment involves the following procedures (which are described below):

Table of Contents
maxLevel2
minLevel2

Configure MSBuild

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

.Set MSBuildDisableNodeReuse

:

Option 1: Setting “MSBuildDisableNodeReuse” Globally

Panel

To set the

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 Removed

Image Removed

Image AddedImage Added

To turn off this behavior when compiling the solution using MSBuild, include the following compiler flag:

 

Code Block
languagepowershell
 
/nr:false

 

 

Set MSBuildDisableNodeReuse

Option 2: Setting “MSBuildDisableNodeReuse” per Command Prompt Session

panel

If the

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):

SET MSBUILDDISABLENODEREUSE=1
Code Block
languagepowershell
themeConfluence
 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:

  1. Start Visual Studio and open the Ed-Fi ODS solution file:1

    Code Block
     C:\Ed-Fi-ODS-Implementation\Application\Ed-Fi-ODS.sln
  2. 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.
  3. 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 Added

  4. 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 Added

  5. Close 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
languagepowershell
  Set-ExecutionPolicy Unrestricted

Initialize PowerShell Scripts for

DevelopmentThere

Development

There 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

Environment

Once 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.

Code Block
 initdev
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.

 


Anchor
Footnote-1
Footnote-1
When starting Visual Studio, it is recommended that you “Run as administrator.”
Anchor
Footnote-2
Footnote-2
To Initialize the Development Environment within Visual Studio, you must close and reopen the solution after restoring the NuGet packages.

Anchor
Footnote-3
Footnote-3
When starting a PowerShell session, it is recommended that you “Run as administrator.” In particular, installing a certificate usually requires elevated privileges.

Anchor
Footnote-4
Footnote-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. 

 

Include Page
_ODS/API v2.1 - Getting Started - Sidebar
_ODS/API v2.1 - Getting Started - Sidebar

Panel
borderColor#fec43d
bgColor#ffedc4
titleColor#000
borderWidth1
titleBGColor#fec43d
borderStylesolid
titleDownloads

The following link is a ZIP archive containing the SQL script file referenced in the step "Create SQL Logins"

SQL Script: CreateLocalLogins.zip