public virtual void AddImport(string targetFullPath, ImportLocation location) { if (String.IsNullOrEmpty(targetFullPath)) { throw new ArgumentNullException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "targetPath"); } string relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(EnvDTEProjectUtility.GetFullPath(EnvDTEProject)), targetFullPath); EnvDTEProjectUtility.AddImportStatement(EnvDTEProject, relativeTargetPath, location); EnvDTEProjectUtility.Save(EnvDTEProject); // notify the project system of the change UpdateImportStamp(EnvDTEProject); }
public virtual void AddImport(string targetFullPath, ImportLocation location) { if (String.IsNullOrEmpty(targetFullPath)) { throw new ArgumentNullException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "targetPath"); } NuGetUIThreadHelper.JoinableTaskFactory.Run(async delegate { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); string relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(ProjectFullPath), targetFullPath); EnvDTEProjectUtility.AddImportStatement(EnvDTEProject, relativeTargetPath, location); EnvDTEProjectUtility.Save(EnvDTEProject); // notify the project system of the change UpdateImportStamp(EnvDTEProject); }); }