/// <summary> /// When a reference is removed/changed, let the provider know /// </summary> /// <param name="reference">Reference being removed</param> void ReferencesEvents_ReferenceRemoved(VSLangProj.Reference reference) { // Because our provider only has an AddReference method and no way to // remove them, we end up having to recreate it. provider = new IronPythonCodeDom.PythonProvider(); if (vsproject.References != null) { foreach (VSLangProj.Reference currentReference in vsproject.References) { provider.AddReference(currentReference.Path); } } }
public void Compile() { PythonProvider provider = new PythonProvider(); CompilerParameters options = new CompilerParameters(referencedAssemblies.ToArray(), OutputAssembly, IncludeDebugInformation); options.MainClass = MainFile; foreach(CoreIronPython.Hosting.ResourceFile resourceInfo in resourceFiles) { // NOTE: with this approach we lack a way to control the name of the generated resource or if it is public string resource = resourceInfo.File; options.EmbeddedResources.Add(resource); } CompilerResults results = provider.CompileAssemblyFromFile(options, sourceFiles.ToArray()); foreach (CompilerError error in results.Errors) { int errorNumber = 0; int.TryParse(error.ErrorNumber, out errorNumber); this.errorSink.AddError(error.FileName, error.ErrorText, String.Empty, new CoreIronPython.Hosting.CodeSpan(error.Line, error.Column, error.Line, error.Column+1), errorNumber, error.IsWarning ? CoreIronPython.Hosting.Severity.Warning : CoreIronPython.Hosting.Severity.Error); } }