// create a new project content instance var projectContent = new CSharpProjectContent(); // add a reference to the System.IO assembly projectContent.AddAssemblyReferences( new [] { typeof(System.IO.File).Assembly.Location }); // compile the project content var compilation = projectContent.CreateCompilation();
// create a new project content instance var projectContent = new CSharpProjectContent(); // add a reference to the Newtonsoft.Json NuGet package projectContent.AddAssemblyReferences( new [] { "Newtonsoft.Json" }); // compile the project content var compilation = projectContent.CreateCompilation();This example adds a reference to the Newtonsoft.Json NuGet package to the project content. The AddAssemblyReferences method automatically determines the location of the package library and adds it as a reference.