示例#1
0
        public virtual Task AddReferenceAsync(string referencePath)
        {
            string fullPath     = PathUtility.GetAbsolutePath(ProjectFullPath, referencePath);
            string relativePath = PathUtility.GetRelativePath(ProjectFileFullPath, fullPath);

            string assemblyFileName = Path.GetFileNameWithoutExtension(fullPath);

            try
            {
                var assemblyName = AssemblyName.GetAssemblyName(fullPath);
                assemblyFileName = assemblyName.FullName;
            }
            catch
            {
                // no-op
            }

            MsBuildProject.AddItem(
                "Reference",
                assemblyFileName,
                new KeyValuePair <string, string>[] {
                new KeyValuePair <string, string>("HintPath", relativePath),
                new KeyValuePair <string, string>("Private", "True")
            });

            return(Task.CompletedTask);
        }
示例#2
0
        protected virtual void AddFileToProject(string path)
        {
            if (!ExcludeFile(path))
            {
                MsBuildProject.AddItem("Content", path);

                NuGetProjectContext.Log(MessageLevel.Debug, "AddedFileToProject", path, ProjectName);
            }
        }