コード例 #1
0
        private async Task RemoveImportStatementAsync(string relativeTargetPath)
        {
            await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            await ProjectHelper.DoWorkInWriterLockAsync(
                VsProjectAdapter.Project,
                VsProjectAdapter.VsHierarchy,
                buildProject => MicrosoftBuildEvaluationProjectUtility.RemoveImportStatement(buildProject, relativeTargetPath));

            // notify the project system of the change
            UpdateImportStamp(VsProjectAdapter);
        }
コード例 #2
0
        private async Task AddImportStatementAsync(ImportLocation location, string relativeTargetPath)
        {
            await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            await ProjectHelper.DoWorkInWriterLockAsync(
                EnvDTEProject,
                VsHierarchyUtility.ToVsHierarchy(EnvDTEProject),
                buildProject => MicrosoftBuildEvaluationProjectUtility.AddImportStatement(buildProject, relativeTargetPath, location));

            // notify the project system of the change
            UpdateImportStamp(EnvDTEProject);
        }