/// <summary> /// Creates a .refresh file in bin directory of the IFileSystem that points to the assembly being installed. /// This works around issues in DTE's AddReference method when dealing with GACed binaries. /// </summary> /// <remarks>Adds the file to the DTE project system</remarks> /// <param name="projectSystem">the web site project system where this will be added</param> /// <param name="assemblyPath">The path to the assembly being added</param> public static void CreateRefreshFile(VsMSBuildProjectSystem projectSystem, string assemblyPath) { if (projectSystem == null) { throw new ArgumentNullException(nameof(projectSystem)); } if (assemblyPath == null) { throw new ArgumentNullException(nameof(assemblyPath)); } string refreshFilePath = CreateRefreshFilePath(assemblyPath); if (!FileSystemUtility.FileExists(projectSystem.ProjectFullPath, refreshFilePath)) { try { using (var stream = CreateRefreshFileStream(projectSystem.ProjectFullPath, assemblyPath)) { // TODO: log to nuGetProjectContext? projectSystem.AddFile(refreshFilePath, stream); } } catch (UnauthorizedAccessException exception) { // log IO permission error ExceptionHelper.WriteErrorToActivityLog(exception); } } }
public VsMSBuildProjectSystemServices( IVsProjectAdapter vsProjectAdapter, VsMSBuildProjectSystem vsProjectSystem, IVsProjectThreadingService threadingService, Lazy <IScriptExecutor> scriptExecutor) { Assumes.Present(vsProjectAdapter); Assumes.Present(vsProjectSystem); Assumes.Present(threadingService); Assumes.Present(scriptExecutor); _vsProjectAdapter = vsProjectAdapter; _vsProjectSystem = vsProjectSystem; _threadingService = threadingService; if (vsProjectSystem is NativeProjectSystem) { ReferencesReader = new NativeProjectSystemReferencesReader(vsProjectAdapter, _threadingService); } else if (vsProjectSystem is CpsProjectSystem) { ReferencesReader = new CpsProjectSystemReferenceReader(vsProjectAdapter, _threadingService); } else { ReferencesReader = new VsCoreProjectSystemReferenceReader(vsProjectAdapter, _threadingService); } ScriptService = new VsProjectScriptHostService(vsProjectAdapter, scriptExecutor); }
private async Task <INuGetProjectServices> CreateProjectServicesAsync( IVsProjectAdapter vsProjectAdapter, VsMSBuildProjectSystem projectSystem) { var componentModel = await _componentModel.GetValueAsync(); return(new VsMSBuildProjectSystemServices(vsProjectAdapter, projectSystem, componentModel)); }
public VsMSBuildProjectSystemServices( IVsProjectAdapter vsProjectAdapter, VsMSBuildProjectSystem vsProjectSystem, IComponentModel componentModel) : base(componentModel) { Assumes.Present(vsProjectAdapter); Assumes.Present(vsProjectSystem); _vsProjectAdapter = vsProjectAdapter; _vsProjectSystem = vsProjectSystem; _threadingService = GetGlobalService <IVsProjectThreadingService>(); Assumes.Present(_threadingService); ReferencesReader = new VsCoreProjectSystemReferenceReader(vsProjectAdapter, this); ScriptService = new VsProjectScriptHostService(vsProjectAdapter, this); }
private INuGetProjectServices CreateProjectServices( IVsProjectAdapter vsProjectAdapter, VsMSBuildProjectSystem projectSystem) { var componentModel = _componentModel.Value; if (vsProjectAdapter.IsDeferred) { return(new DeferredProjectServicesProxy( vsProjectAdapter, new DeferredProjectCapabilities { SupportsPackageReferences = false }, () => new VsMSBuildProjectSystemServices(vsProjectAdapter, projectSystem, componentModel), componentModel)); } else { return(new VsMSBuildProjectSystemServices(vsProjectAdapter, projectSystem, componentModel)); } }