public Microsoft.Practices.RecipeFramework.GuidancePackage InitGuidancePackage(string packageXmlFilename) { string basePath = Directory.GetParent(packageXmlFilename).FullName + "\\"; XmlReader configReader = XmlReader.Create(packageXmlFilename); //Microsoft.Practices.RecipeFramework.Configuration.GuidancePackage curentConfig = Microsoft.Practices.RecipeFramework.GuidancePackage.ReadConfiguration(configReader); //Microsoft.Practices.RecipeFramework.GuidancePackage curentGPckg = new Microsoft.Practices.RecipeFramework.GuidancePackage(curentConfig, basePath); Microsoft.Practices.RecipeFramework.GuidancePackage curentGPckg = new Microsoft.Practices.RecipeFramework.GuidancePackage(configReader); System.IServiceProvider sp = VsIdeTestHostContext.ServiceProvider; TypeResolutionService _trs = new TypeResolutionService(basePath); TestValueGatheringService _tvs = new TestValueGatheringService(); TestPersistenceService _tps = new TestPersistenceService(); DTE test = GetDTE(); testContextInstance.WriteLine("Mode: " + test.Mode); //curentGPckg.SetupTemporaryService(typeof(EnvDTE.DTE), GetDTE()); //curentGPckg.AddService(typeof(ITypeResolutionService), _trs); curentGPckg.AddService(typeof(EnvDTE.DTE), GetDTE()); curentGPckg.AddService(typeof(IValueGatheringService), _tvs); curentGPckg.AddService(typeof(IPersistenceService), _tps); //curentGPckg.AddService(typeof(Microsoft.VisualStudio.OLE.Interop.IOleComponentManager), sp.GetService(typeof(Microsoft.VisualStudio.OLE.Interop.IOleComponentManager))); curentGPckg.Site = new Microsoft.Practices.ComponentModel.Site(sp, new Microsoft.Practices.RecipeFramework.RecipeManager(), "SharePointSoftwareFactory"); //curentGPckg.Site = (en)sp.GetService(typeof(ISite)); configReader.Close(); testContextInstance.WriteLine("Site: " + curentGPckg.Site.GetType().ToString()); //testContextInstance.WriteLine("Container: " + curentGPckg.Site.Container.GetType().ToString()); //testContextInstance.WriteLine("Component: " + curentGPckg.Site.Component.GetType().ToString()); return(curentGPckg); }
public Microsoft.Practices.RecipeFramework.GuidancePackage InitGuidancePackage(string packageXmlFilename) { string basePath = Directory.GetParent(packageXmlFilename).FullName + "\\"; XmlReader configReader = XmlReader.Create(packageXmlFilename); //Microsoft.Practices.RecipeFramework.Configuration.GuidancePackage curentConfig = Microsoft.Practices.RecipeFramework.GuidancePackage.ReadConfiguration(configReader); //Microsoft.Practices.RecipeFramework.GuidancePackage curentGPckg = new Microsoft.Practices.RecipeFramework.GuidancePackage(curentConfig, basePath); Microsoft.Practices.RecipeFramework.GuidancePackage curentGPckg = new Microsoft.Practices.RecipeFramework.GuidancePackage(configReader); System.IServiceProvider sp = VsIdeTestHostContext.ServiceProvider; TypeResolutionService _trs = new TypeResolutionService(basePath); TestValueGatheringService _tvs = new TestValueGatheringService(); TestPersistenceService _tps = new TestPersistenceService(); DTE test = GetDTE(); testContextInstance.WriteLine("Mode: " + test.Mode); //curentGPckg.SetupTemporaryService(typeof(EnvDTE.DTE), GetDTE()); //curentGPckg.AddService(typeof(ITypeResolutionService), _trs); curentGPckg.AddService(typeof(EnvDTE.DTE), GetDTE()); curentGPckg.AddService(typeof(IValueGatheringService), _tvs); curentGPckg.AddService(typeof(IPersistenceService), _tps); //curentGPckg.AddService(typeof(Microsoft.VisualStudio.OLE.Interop.IOleComponentManager), sp.GetService(typeof(Microsoft.VisualStudio.OLE.Interop.IOleComponentManager))); curentGPckg.Site = new Microsoft.Practices.ComponentModel.Site(sp, new Microsoft.Practices.RecipeFramework.RecipeManager(), "SharePointSoftwareFactory"); //curentGPckg.Site = (en)sp.GetService(typeof(ISite)); configReader.Close(); testContextInstance.WriteLine("Site: " + curentGPckg.Site.GetType().ToString()); //testContextInstance.WriteLine("Container: " + curentGPckg.Site.Container.GetType().ToString()); //testContextInstance.WriteLine("Component: " + curentGPckg.Site.Component.GetType().ToString()); return curentGPckg; }