当前位置: 首页>>代码示例>>C#>>正文


C# IProjectService.AddReference方法代码示例

本文整理汇总了C#中IProjectService.AddReference方法的典型用法代码示例。如果您正苦于以下问题:C# IProjectService.AddReference方法的具体用法?C# IProjectService.AddReference怎么用?C# IProjectService.AddReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProjectService的用法示例。


在下文中一共展示了IProjectService.AddReference方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddCorePlugin

        /// <summary>
        /// Adds the core.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="plugin">The plugin.</param>
        /// <param name="codeConfig">The code config.</param>
        /// <param name="addPluginFromLocalDisk">if set to <c>true</c> [add plugin from local disk].</param>
        /// <param name="destination">The destination.</param>
        /// <param name="source">The source.</param>
        /// <returns>True or false.</returns>
        internal bool AddCorePlugin(
            IProjectService projectService,
            Plugin plugin,
            CodeConfig codeConfig,
            bool addPluginFromLocalDisk,
            string destination,
            string source)
        {
            TraceService.WriteLine("PluginService::AddCorePlugin plugin=" + plugin.FriendlyName);

            //// inform the user that we cant install from nuget.
            if (this.codeConfigService.NugetRequestedAndNotSupported(codeConfig))
            {
                this.Messages.Add(
                    plugin.FriendlyName
                    + " plugin does not support being installed via Nuget and has been installed from the local machine.");
            }

            //// don't need to add reference if we are going to use nuget.
            if (addPluginFromLocalDisk)
            {
                //// only do if destination file doesn't exist
                if (this.fileSystem.File.Exists(destination) == false)
                {
                    projectService.AddReference(
                        "Lib",
                        destination,
                        source,
                        this.settingsService.IncludeLibFolderInProjects,
                        this.settingsService.CopyAssembliesToLibFolder);
                }
            }

            return true;
        }
开发者ID:rahulpnath,项目名称:NinjaCoderForMvvmCross,代码行数:45,代码来源:PluginService.cs

示例2: ProcessConfig

        /// <summary>
        /// Processes the config.
        /// </summary>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="projectService">The project service.</param>
        /// <param name="codeConfig">The code config.</param>
        internal void ProcessConfig(
            IVisualStudioService visualStudioService,
            IProjectService projectService, 
            CodeConfig codeConfig)
        {
            TraceService.WriteLine("ServicesService::ProcessConfig");

            if (codeConfig != null)
            {
                //// do we have any dependent plugins?
                codeConfig.DependentPlugins.ForEach(x => this.AddDependantPlugin(visualStudioService, x));

                string sourceDirectory = this.settingsService.MvvmCrossAssembliesPath;

                //// don't need to add reference if we are going to use nuget.
                if (this.settingsService.UseNugetForServices == false)
                {
                    foreach (string reference in codeConfig.References)
                    {
                        projectService.AddReference(
                            "Lib",
                            projectService.GetProjectPath() + @"\Lib\" + reference,
                            sourceDirectory + @"\" + reference,
                            this.settingsService.IncludeLibFolderInProjects,
                            this.settingsService.CopyAssembliesToLibFolder);
                    }
                }

                //// if we want to add via nuget then generate the command.
                if (this.settingsService.UseNugetForServices ||
                    codeConfig.NugetInstallationMandatory == "Y")
                {
                    ////this.nugetService.UpdateViaNuget(projectService, codeConfig);
                }

                //// apply any code dependencies
                IEnumerable<string> messages = this.codeConfigService.ApplyCodeDependencies(
                    visualStudioService,
                    codeConfig);

                this.Messages.AddRange(messages);
            }
        }
开发者ID:rmarinho,项目名称:NinjaCoderForMvvmCross,代码行数:49,代码来源:ServicesService.cs

示例3: ProcessCodeConfig

        /// <summary>
        /// Processes the code config.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="friendlyName">Name of the friendly.</param>
        /// <param name="extensionSource">The extension source.</param>
        /// <param name="extensionDestination">The extension destination.</param>
        /// <returns>The code config.</returns>
        public CodeConfig ProcessCodeConfig(
            IProjectService projectService,
            string friendlyName,
            string extensionSource,
            string extensionDestination)
        {
            TraceService.WriteLine("CodeConfigService::ProcessCodeConfig " + friendlyName);

            //// grab the code config if it exists and process it.
            CodeConfig codeConfig = this.GetUICodeConfig(projectService, friendlyName);

            if (codeConfig != null)
            {
                //// process it if we are using local disk copy.
                if (this.UseLocalDiskCopy(codeConfig))
                {
                    string sourceDirectory = this.fileSystem.Path.GetDirectoryName(extensionSource);
                    string destinationDirectory = this.fileSystem.Path.GetDirectoryName(extensionDestination);

                    if (codeConfig.References != null)
                    {
                        codeConfig.References.ForEach(
                            x => projectService.AddReference(
                                "Lib",
                                destinationDirectory + @"\" + x,
                                sourceDirectory + @"\" + x,
                                this.settingsService.IncludeLibFolderInProjects,
                                this.settingsService.CopyAssembliesToLibFolder));
                    }
                }
            }

            return codeConfig;
        }
开发者ID:CliffCawley,项目名称:NinjaCoderForMvvmCross,代码行数:42,代码来源:CodeConfigService.cs

示例4: AddUIPlugin

        /// <summary>
        /// Adds the non core plugin.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="plugin">The plugin.</param>
        /// <param name="source">The source.</param>
        /// <param name="destination">The destination.</param>
        /// <param name="extensionSource">The extension source.</param>
        /// <param name="extensionDestination">The extension destination.</param>
        /// <param name="addPluginFromLocalDisk">if set to <c>true</c> [add plugin from local disk].</param>
        /// <returns>
        /// True or false.
        /// </returns>
        public bool AddUIPlugin(
            IProjectService projectService,
            Plugin plugin,
            string source,
            string destination,
            string extensionSource,
            string extensionDestination,
            bool addPluginFromLocalDisk)
        {
            TraceService.WriteLine("PluginService::AddUIPlugin plugin=" + plugin.FriendlyName);

            bool added = false;

            string[] projectNameParts = projectService.Name.Split('.');

            //// we need to look for the ui specific config file,
            Plugin uiPlugin = new Plugin
                              {
                                  FriendlyName = plugin.FriendlyName + "." + projectNameParts[1]
                              };

            CodeConfig codeConfig = this.codeConfigFactory.GetPluginConfig(uiPlugin);

            this.codeConfigService.ProcessCodeConfig(
                projectService,
                codeConfig,
                extensionSource,
                extensionDestination);

            //// only do if destination file doesn't exist
            if (this.fileSystem.File.Exists(destination) == false)
            {
                if (addPluginFromLocalDisk)
                {
                    projectService.AddReference(
                        "Lib",
                        destination,
                        source,
                        this.settingsService.IncludeLibFolderInProjects,
                        this.settingsService.CopyAssembliesToLibFolder);
                }
            }

            //// only do if extensionDestination file doesn't exist
            if (this.fileSystem.File.Exists(extensionDestination) == false)
            {
                if (addPluginFromLocalDisk)
                {
                    projectService.AddReference(
                        "Lib",
                        extensionDestination,
                        extensionSource,
                        this.settingsService.IncludeLibFolderInProjects,
                        this.settingsService.CopyAssembliesToLibFolder);
                }

                added = true;

                this.RequestBootstrapFile(
                    projectService,
                    plugin);
            }

            return added;
        }
开发者ID:rahulpnath,项目名称:NinjaCoderForMvvmCross,代码行数:78,代码来源:PluginService.cs

示例5: ProcessConfig

        /// <summary>
        /// Processes the config.
        /// </summary>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="projectService">The project service.</param>
        /// <param name="configFile">The config file.</param>
        internal void ProcessConfig(
            IVisualStudioService visualStudioService,
            IProjectService projectService, 
            string configFile)
        {
            TraceService.WriteLine("ServicesService::ProcessConfig");

            CodeConfig codeConfig = this.codeConfigService.GetCodeConfigFromPath(configFile);

            if (codeConfig != null)
            {
                //// do we have any dependent plugins?
                if (codeConfig.DependentPlugins != null)
                {
                    foreach (string dependentPlugin in codeConfig.DependentPlugins)
                    {
                        List<Plugin> plugins = new List<Plugin>();

                        string source = this.settingsService.InstalledDirectory + @"\Plugins\" + dependentPlugin;

                        //// append dll if its missing.
                        if (source.ToLower().EndsWith(".dll") == false)
                        {
                            source += ".dll";
                        }

                        FileInfo fileInfo = new FileInfo(source);

                        Plugin plugin = this.pluginTranslator.Translate(fileInfo);

                        plugins.Add(plugin);

                        this.pluginsService.AddPlugins(
                            visualStudioService,
                            plugins,
                            string.Empty,
                            false);
                    }
                }

                string sourceDirectory = this.settingsService.InstalledDirectory + @"\Plugins\Core";

                //// don't need to add reference if we are going to use nuget.
                if (this.settingsService.UseNugetForServices == false)
                {
                    foreach (string reference in codeConfig.References)
                    {
                        projectService.AddReference(
                            "Lib",
                            projectService.GetProjectPath() + @"\Lib\" + reference,
                            sourceDirectory + @"\" + reference,
                            this.settingsService.IncludeLibFolderInProjects,
                            this.settingsService.CopyAssembliesToLibFolder);
                    }
                }

                //// if we want to add via nuget then generate the command.
                if (this.settingsService.UseNugetForServices ||
                    codeConfig.NugetInstallationMandatory == "Y")
                {
                    ////this.nugetService.UpdateViaNuget(projectService, codeConfig);
                }

                //// apply any code dependencies
                IEnumerable<string> messages = this.codeConfigService.ApplyCodeDependencies(
                    visualStudioService,
                    codeConfig);

                this.Messages.AddRange(messages);
            }
        }
开发者ID:CliffCawley,项目名称:NinjaCoderForMvvmCross,代码行数:77,代码来源:ServicesService.cs

示例6: AddUIPlugin

        /// <summary>
        /// Adds the non core plugin.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="friendlyName">Name of the friendly.</param>
        /// <param name="source">The source.</param>
        /// <param name="destination">The destination.</param>
        /// <param name="extensionSource">The extension source.</param>
        /// <param name="extensionDestination">The extension destination.</param>
        /// <param name="addPluginFromLocalDisk">if set to <c>true</c> [add plugin from local disk].</param>
        /// <returns>True or false.</returns>
        public bool AddUIPlugin(
            IProjectService projectService,
            string friendlyName,
            string source,
            string destination,
            string extensionSource,
            string extensionDestination,
            bool addPluginFromLocalDisk)
        {
            TraceService.WriteLine("PluginService::AddUIPlugin " + friendlyName);

            bool added = false;

            this.codeConfigService.ProcessCodeConfig(
                projectService,
                friendlyName,
                extensionSource,
                extensionDestination);

            //// only do if destination file doesn't exist
            if (this.fileSystem.File.Exists(destination) == false)
            {
                if (addPluginFromLocalDisk)
                {
                    projectService.AddReference(
                        "Lib",
                        destination,
                        source,
                        this.settingsService.IncludeLibFolderInProjects,
                        this.settingsService.CopyAssembliesToLibFolder);
                }
            }

            //// only do if extensionDestination file doesn't exist
            if (this.fileSystem.File.Exists(extensionDestination) == false)
            {
                if (addPluginFromLocalDisk)
                {
                    projectService.AddReference(
                        "Lib",
                        extensionDestination,
                        extensionSource,
                        this.settingsService.IncludeLibFolderInProjects,
                        this.settingsService.CopyAssembliesToLibFolder);
                }

                added = true;

                this.RequestBootstrapFile(
                    projectService,
                    friendlyName);
            }

            return added;
        }
开发者ID:CliffCawley,项目名称:NinjaCoderForMvvmCross,代码行数:66,代码来源:PluginService.cs

示例7: ProcessCodeConfig

        /// <summary>
        /// Processes the code config.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="codeConfig">The code config.</param>
        /// <param name="extensionSource">The extension source.</param>
        /// <param name="extensionDestination">The extension destination.</param>
        public void ProcessCodeConfig(
            IProjectService projectService,
            CodeConfig codeConfig,
            string extensionSource,
            string extensionDestination)
        {
            TraceService.WriteLine("CodeConfigService::ProcessCodeConfig");

            if (codeConfig != null)
            {
                //// process it if we are using local disk copy.
                if (this.UseLocalDiskCopy(codeConfig))
                {
                    string sourceDirectory = this.fileSystem.Path.GetDirectoryName(extensionSource);
                    string destinationDirectory = this.fileSystem.Path.GetDirectoryName(extensionDestination);

                    codeConfig.References.ForEach(
                        x => projectService.AddReference(
                            "Lib",
                            destinationDirectory + @"\" + x,
                            sourceDirectory + @"\" + x,
                            this.settingsService.IncludeLibFolderInProjects,
                            this.settingsService.CopyAssembliesToLibFolder));
                }
            }
        }
开发者ID:rahulpnath,项目名称:NinjaCoderForMvvmCross,代码行数:33,代码来源:CodeConfigService.cs

示例8: AddPlugin

        /// <summary>
        /// Adds the plugin.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="plugin">The plugin.</param>
        /// <param name="folderName">Name of the folder.</param>
        /// <param name="extensionName">Name of the extension.</param>
        /// <returns>True or false.</returns>
        internal bool AddPlugin(
            IProjectService projectService,
            Plugin plugin,
            string folderName,
            string extensionName)
        {
            TraceService.WriteLine("PluginsService::AddPlugin " + plugin.FriendlyName);

            bool added = false;

            string projectPath = projectService.GetProjectPath();
            string source = plugin.Source;
            string destination = string.Format(@"{0}\Lib\{1}", projectPath, plugin.FileName);

            //// at this moment we only want ot do the core as this plugin might not be
            //// supported in the ui project.
            if (extensionName == Settings.Core ||
                extensionName == Settings.CoreTests)
            {
                //// dont need to add reference if we are going to use nuget.
                if (this.SettingsService.UseNugetForPlugins == false)
                {
                    projectService.AddReference(
                        "Lib",
                        destination,
                        source,
                        this.SettingsService.IncludeLibFolderInProjects);
                }

                added = true;
            }
            else
            {
                //// now if we are not the core project we need to add the platform specific assemblies
                //// and the bootstrap item templates!

                string extensionSource = this.GetExtensionSource(folderName, extensionName, source);

                string extensionDestination = this.GetExtensionDestination(folderName, extensionName, destination);

                if (this.FileSystem.File.Exists(extensionSource))
                {
                    //// if the plugin is supported add in the core library.

                    added = this.AddNonCorePlugin(
                        projectService,
                        plugin.FriendlyName,
                        source,
                        destination,
                        extensionSource,
                        extensionDestination);
                }
            }

            return added;
        }
开发者ID:nanohex,项目名称:NinjaCoderForMvvmCross,代码行数:64,代码来源:PluginsService.cs

示例9: AddNonCorePlugin

        /// <summary>
        /// Adds the non core plugin.
        /// </summary>
        /// <param name="projectService">The project service.</param>
        /// <param name="friendlyName">Name of the friendly.</param>
        /// <param name="source">The source.</param>
        /// <param name="destination">The destination.</param>
        /// <param name="extensionSource">The extension source.</param>
        /// <param name="extensionDestination">The extension destination.</param>
        /// <returns>True or false.</returns>
        internal bool AddNonCorePlugin(
            IProjectService projectService,
            string friendlyName,
            string source,
            string destination,
            string extensionSource,
            string extensionDestination)
        {
            TraceService.WriteLine("PluginsService::AddNonCorePlugin " + friendlyName);

            bool added = false;

            //// only do if destination file doesn't exist
            if (this.FileSystem.File.Exists(destination) == false)
            {
                if (this.SettingsService.UseNugetForPlugins == false)
                {
                    projectService.AddReference(
                        "Lib",
                        destination,
                        source,
                        this.SettingsService.IncludeLibFolderInProjects);
                }
            }

            //// only do if extensionDestination file doesn't exist
            if (this.FileSystem.File.Exists(extensionDestination) == false)
            {
                if (this.SettingsService.UseNugetForPlugins == false)
                {
                    projectService.AddReference(
                        "Lib",
                        extensionDestination,
                        extensionSource,
                        this.SettingsService.IncludeLibFolderInProjects);
                }

                added = true;
                this.BuildSourceFile(projectService, extensionSource, extensionDestination, friendlyName);
            }

            return added;
        }
开发者ID:nanohex,项目名称:NinjaCoderForMvvmCross,代码行数:53,代码来源:PluginsService.cs


注:本文中的IProjectService.AddReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。