Skip to content

Building the Runtime

lajones edited this page Jan 20, 2017 · 11 revisions

The first order of business is to make sure you can build the code on your machine.

  1. The easiest way to work with the code base is to install Visual Studio. You can also work with any other IDE provided you have .NET Framework 4.5 and MSBuild on your machine.
  2. You will need SQL Server Compact 3.5 installed.
  3. To run the unit tests, you will need SQL Server 2012 Express installed (you want the SQLEXPR_x64_ENU.exe download) with SQL Server and Windows Authentication mode enabled.

The Windows username that you use for development must have the sysadmin role. The easiest way to ensure this is to install SQL Express while logged in as this user as opposed to having someone else install SQL Express on the machine.

  1. To run the unit tests, you need to install SQL Server CLR Types. On a 64-bit machine, you need to run both the ENU\x64\SQLSysClrTypes.msi and ENU\x86\SQLSysClrTypes.msi installers.

  2. Using your preferred git client clone our git repo located at https://github.com/aspnet/EntityFramework6.git.

    git clone https://github.com/aspnet/EntityFramework6.git

    Note: The EF Runtime and EF Tooling share the same repo. If you've already cloned the repo to work with the tooling you can use your existing clone to work with the runtime also.

  3. In order to run unit tests against the delay-signed binaries, you need to run SkipStrongNames**. Obtain this and other NuGet packages from the OuterCurve Foundation NuGet public feed* by running the following command from a command prompt. This requires administrative privileges.

    build /t:RestorePackages
    build /t:EnableSkipStrongNames
    

    These commands only need to be run one time for each machine and do not need to be re-run every time you build.

  4. If you installed Visual Studio, you can now open the EntityFramework.sln file in the root of the source code and build using Visual Studio.

    Alternatively, there is a Build.cmd file that will build the code base and run the tests from the command line.

    Note: Build must be run from the Developer Command Prompt for VS2015 (or VS2012 or VS2013):

    build
    

    If you receive an error stating error MSB3091: Task failed because "AxImp.exe" was not found, or the correct Microsoft Windows SDK is not installed.

    • Install the Windows 8 SDK. (Note: it is the Windows 8 SDK even if you are running Windows 10, but on Windows 10 you need to deselect the "Application Verifier for Windows" and "Windows App Certification Kit" features of the SDK to get this to install successfully.)
    • Add a HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86 registry key
    • Under the new key, add an InstallationFolder string value set to C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools
  5. Building the code will produce a .nupkg file for the EntityFramework NuGet package in bin\Release. You can create a local NuGet feed to use this NuGet package in your projects.

* By running build /t:RestorePackages, you will be initiating the download of other software from a NuGet-based feed that is owned by the Outercurve Foundation. You are responsible for locating, reading and complying with the license terms that accompany each such software. Each software that you obtain through this feed is licensed to you by its respective owner. We grant you no rights for third-party software from this feed.

** SkipStrongNames is required because the assemblies that are produced by building the open source code base are delay signed. Because the assemblies aren’t signed with the actual certificate we need to disable strong name verification for them. Delay signing ensures that the assemblies have the same strong name that they will have when signed with the Microsoft certificate and released on NuGet. Having the same strong name ensures products that build on top of Entity Framework (such as MVC Scaffolding) will work with open source builds.

Running Tests

The Entity Framework solution contains several test projects which are written using xUnit.net. The most straightforward way to run all tests is executing the following command.

build.cmd /t:Test

The tests can also be run from Visual Studio using an xUnit.net runner extension

Clone this wiki locally