- Visual Studio 2017 (Community, Professional, Enterprise) with the latest update must be installed. The Community version is completely free.
- .NET Core SDK >= v2.1.401 must be installed which will add the
dotnet
to your path. - CMake must be installed from the CMake download page and added to your path.
The following are the minimum requirements:
- .NET desktop development
- All Required Components
- .NET Framework 4-4.6 Development Tools
- Desktop development with C++
- All Required Components
- VC++ 2017 v141 Toolset (x86, x64)
- Windows 8.1 SDK and UCRT SDK
- VC++ 2015.3 v140 Toolset (x86, x64)
- .NET Core cross-platform development
- All Required Components
Note: If you have both VS 2017 and 2015 installed, you need to copy DIA SDK directory from VS 2015 installation into VS 2017 (VS installer bug).
The following are the minimum requirements:
- C# and Visual Basic Roslyn Compilers
- Static Analysis Tools
- .NET Portable Library Targeting Pack
- Windows 10 SDK or Windows 8.1 SDK
- Visual Studio C++ Core Features
- VC++ 2017 v141 Toolset (x86, x64)
- MSBuild
- .NET Framework 4.6 Targeting Pack
- Windows Universal CRT SDK
- VC++ 2015.3 v140 Toolset (x86, x64)
If you've installed Visual Studio 2017 already, go to C:\Program Files (x86)\Microsoft Visual Studio\Installer
and run
vs_installer.exe modify --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community" --add Microsoft.VisualStudio.Component.NuGet --add Microsoft.Net.Component.4.6.TargetingPack --add Microsoft.VisualStudio.Component.PortableLibrary --add Microsoft.VisualStudio.Component.Static.Analysis.Tools --add Microsoft.VisualStudio.Component.Roslyn.Compiler --add Microsoft.Component.MSBuild --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.VC.140
This will install all the components needed.
Note that you will need to adjust the install path to reflect your version, "Community", "Professional", "Enterprise" or "Preview"
For the best possible experience make sure to have the latest version of Visual Studio 2017 installed.
From a (non-admin) Command Prompt window:
build.cmd
- Will cause basic tool initialization and build the default configuration for refs, libs, and packages.build-tests.cmd
- Will build and run tests for the default configuration.
For information on different configurations see project-guidelines.
Note: Before working on individual projects or test projects you must run build.cmd
from the root once before beginning that work. It is also a good idea to run build.cmd
whenever you pull a large set of unknown changes into your branch.
Visual Studio Solution (.sln) files exist for related groups of libraries. These can be loaded to build, debug and test inside the Visual Studio IDE.
Note that when calling the script build.cmd
attempts to build both the native and managed code.
Only use it when the parameters that you are passing to the script apply for both components. Otherwise, use the scripts build-native.cmd
and build-managed.cmd
respectively.
For more information about the different options when building, run build.cmd -?
and look at examples in the developer-guide.
From the root, use build-tests.cmd
.
For more details, or to test an individual project, see the developer guide topic.
- Open solution of interest
- Right click test project and select 'Set as startup project'
- Ctrl+F5 (Run)
- Open solution of interest
- Right click test project and select 'Set as startup project'
- Set breakpoint appropriately
- F5 (Debug)
Once you've built the source code for netfx from the root (build.cmd -framework:netfx
) follow these steps:
- Build test project with the following parameters
dotnet msbuild /t:buildandtest /p:targetgroup=netfx /p:testdebugger=devenv.exe
. This will open Visual Studio with the runner as startup project and its corresponding arguments. - Open project properties and fill in the next information:
- Debugger Type -> Managed (v4.6, v4.5, v4.0)
- Environment -> you need to add an environment variable as follows:
- DEVPATH ->
<corefxpath>\bin\testhost\netfx-Windows_NT-Debug-x64\
- DEVPATH ->
- Set breakpoint appropriately
- F5 (Debug)
For advanced debugging using WinDBG see Debugging CoreFX on Windows
-
At any given time, the corefx repo might be configured to use a more recent compiler than the one used by the installed .NET Core SDK. This means the corefx codebase might be using language features that are not understood by the IDE, which might result in errors that show up as red squiggles while writing code. Such errors should, however, not affect the actual compilation.
-
Running tests from using the VS test explorer does not currently work after we switched to running on CoreCLR. We will be working on enabling full VS test integration but we don't have an ETA yet. In the meantime, use the steps above to launch/debug the tests using the console runner.
-
If your build fails with "[...].dll - Access is denied" errors, it might be because Visual Studio/MSBuild is locking these files. Try shutting down
VBCSCompiler.exe
anddotnet.exe
from the task manager before building again.