예제 #1
0
        public override void RemoveImport(string targetFullPath)
        {
            if (string.IsNullOrEmpty(targetFullPath))
            {
                throw new ArgumentNullException(nameof(targetFullPath), CommonResources.Argument_Cannot_Be_Null_Or_Empty);
            }

            NuGetUIThreadHelper.JoinableTaskFactory.Run(async delegate
            {
                var root = await VsProjectAdapter.GetProjectDirectoryAsync();
                // For VS 2012 or above, the operation has to be done inside the Writer lock
                var relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(root), targetFullPath);
                await RemoveImportStatementAsync(relativeTargetPath);
            });
        }
예제 #2
0
        public override void AddImport(string targetFullPath, ImportLocation location)
        {
            // For VS 2012 or above, the operation has to be done inside the Writer lock
            if (string.IsNullOrEmpty(targetFullPath))
            {
                throw new ArgumentNullException(nameof(targetFullPath));
            }

            NuGetUIThreadHelper.JoinableTaskFactory.Run(async delegate
            {
                var root = await VsProjectAdapter.GetProjectDirectoryAsync();
                var relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(root), targetFullPath);
                await AddImportStatementAsync(location, relativeTargetPath);
            });
        }