/// <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(WebSiteProjectSystem projectSystem, string assemblyPath, INuGetProjectContext nuGetProjectContext) { if (projectSystem == null) { throw new ArgumentNullException("projectSystem"); } if (assemblyPath == null) { throw new ArgumentNullException("assemblyPath"); } string refreshFilePath = CreateRefreshFilePath(projectSystem.ProjectFullPath, 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.WriteToActivityLog(exception); } } }