本文整理汇总了C#中Project.GetRootFolder方法的典型用法代码示例。如果您正苦于以下问题:C# Project.GetRootFolder方法的具体用法?C# Project.GetRootFolder怎么用?C# Project.GetRootFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project.GetRootFolder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstallPackage
public override async Task<bool> InstallPackage(Project project, string packageName, string version)
{
if (!string.IsNullOrEmpty(version))
packageName += $"@{version}";
string arg = $"/c jspm install {packageName}";
string cwd = project.GetRootFolder();
string json = Path.Combine(cwd, "package.json");
if (!File.Exists(json))
{
string content = "{\"name\":\"myproject\", \"version\":\"1.0.0\"}";
File.WriteAllText(json, content, new UTF8Encoding(false));
project.ProjectItems.AddFromFile(json);
}
if (IsJspmConfigured(json))
{
return await CallCommand(arg, cwd);
}
else
{
return await ShowConsole(arg, cwd);
}
}
示例2: InstallPackage
public override async Task<bool> InstallPackage(Project project, string packageName, string version, string args = null)
{
string installArgs = GetInstallArguments(packageName, version);
string arg = $"/c {installArgs} {args}";
string cwd = project.GetRootFolder();
return await CallCommandAsync(arg, cwd);
}
示例3: InstallPackage
public override async Task<bool> InstallPackage(Project project, string packageName, string version)
{
if (!string.IsNullOrEmpty(version))
packageName += $"#{version}";
string arg = $"/c bower install {packageName} --save --no-color";
string cwd = project.GetRootFolder();
string json = Path.Combine(cwd, "bower.json");
if (!File.Exists(json))
{
string content = "{\"name\":\"myproject\"}";
File.WriteAllText(json, content, new UTF8Encoding(false));
project.ProjectItems.AddFromFile(json);
}
return await CallCommand(arg, cwd);
}
示例4: ReloadExtension
public ReloadExtension(Project project)
{
_project = project;
string folder = project.GetRootFolder();
if (string.IsNullOrEmpty(folder))
return;
_watcher = new FileSystemWatcher(folder);
_watcher.Changed += FileChanged;
_watcher.IncludeSubdirectories = true;
_watcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.CreationTime;
_watcher.EnableRaisingEvents = VSPackage.Options.EnableReload;
_timer = new Timer(TimerElapsed, null, 0, VSPackage.Options.Delay);
VSPackage.Options.Saved += OptionsSaved;
}
示例5: InstallPackage
public override void InstallPackage(Project project, string packageName, string version)
{
if (!string.IsNullOrEmpty(version))
packageName += $"@{version}";
string arg = $"/c npm install {packageName} --save";
string cwd = project.GetRootFolder();
string json = Path.Combine(cwd, "package.json");
if (!File.Exists(json))
{
string content = "{\"name\":\"myproject\", \"version\":\"1.0.0\"}";
File.WriteAllText(json, content, new UTF8Encoding(false));
project.ProjectItems.AddFromFile(json);
}
AddAdditionalFiles(project, cwd, packageName);
CallCommand(arg, cwd);
}
示例6: InstallPackage
public override async Task<bool> InstallPackage(Project project, string packageName, string version, string args = null)
{
string installArgs = GetInstallArguments(packageName, version);
string arg = $"/c {installArgs} --no-color {args}";
string cwd = project.GetRootFolder();
string json = Path.Combine(cwd, "bower.json");
if (!File.Exists(json))
{
string content = "{\"name\":\"myproject\"}";
File.WriteAllText(json, content, new UTF8Encoding(false));
project.ProjectItems.AddFromFile(json);
}
return await CallCommandAsync(arg, cwd);
}