SlowCheetah failing quietly.
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 文档
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- powershell
调研方向
首先在 TransformConfig 入口点复现 PowerShell 示例,并检查 TransformerFactory 和 logging stub 的使用方式。由于 issue 未指明任何 repository 文件或测试,首先确定预期范围是缺少的指导,还是转换失败时没有任何提示。完成内容应包括有文档说明且受支持的 PowerShell 用法,以及对失败情况的可执行解释。
由索引模型根据 Issue 内容生成。
描述
Hello all. First, my issue could very well be solved if I could find the correct and complete documentation for slow cheetah usage, specifically in PowerShell.
I'm trying to add the ability to transform json config files via powershell for use in certain cases (but not ALL environments/situations, so adding this to source/project files is not an option).
I'm able to do this exact same thing using XDT for web.config files in other builds, so I know its possible with the correct usage.
So far, I'm able to get all the way to the point where the transform should occur, but then get an error that is completely silent other than 'false'.
I was able to find someones example on stack exchange (https://stackoverflow.com/questions/62944828/can-you-run-microsoft-visualstudio-slowcheetah-from-powershell), which has been modified/simplified to eliminate issues. I'm left with this:
function GetNuget(){
process{
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
'Downloading nuget.exe' | Write-Verbose
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', "$env:LOCALAPPDATA\NuGet\BuildTools\nuget.exe")
return "$env:LOCALAPPDATA\NuGet\BuildTools\nuget.exe"
}
}
function GetNugetPackage(){
if(!(Test-Path "$env:LOCALAPPDATA\NuGet\BuildTools\")){
New-Item -Path "$env:LOCALAPPDATA\NuGet\BuildTools\" -ItemType Directory | Out-Null
}
$cmdArgs = @(
'install',
'Microsoft.VisualStudio.SlowCheetah',
'-OutputDirectory',
(Resolve-Path "$env:LOCALAPPDATA\NuGet\BuildTools\").ToString()
)
&(GetNuget `
-toolsDir "$env:LOCALAPPDATA\NuGet\BuildTools\" `
-nugetDownloadUrl 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe') `
$cmdArgs | Out-Null
$toolPath = (
Get-ChildItem `
-Path "$env:LOCALAPPDATA\NuGet\BuildTools\" `
-Include 'Microsoft.VisualStudio.SlowCheetah.dll' `
-Recurse
) | Select-Object -First 1
return $toolPath
}
function TransformConfig{
[cmdletbinding()]
param(
[Parameter(
Mandatory=$true,
Position=0)]
$sourceFile,
[Parameter(
Mandatory=$true,
Position=1)]
$transformFile,
[Parameter(
Mandatory=$true,
Position=2)]
$destFile,
$toolsDir = "$env:LOCALAPPDATA\NuGet\BuildTools\"
)
process{
$sourcePath = (Resolve-Path $sourceFile).ToString()
$transformPath = (Resolve-Path $transformFile).ToString()
$cheetahPath = GetNugetPackage `
-packageName 'Microsoft.VisualStudio.SlowCheetah' `
-toolFileName 'Microsoft.VisualStudio.SlowCheetah.dll' `
-toolsDir "$env:LOCALAPPDATA\NuGet\BuildTools\"
[Reflection.Assembly]::LoadFrom($cheetahPath.FullName) | Out-Null
Add-Type -TypeDefinition $loggingStubSource -Language CSharp -ReferencedAssemblies $cheetahPath.FullName
$logStub = New-Object Microsoft.VisualStudio.SlowCheetah.LoggingStub
$transformer = [Microsoft.VisualStudio.SlowCheetah.TransformerFactory]::GetTransformer($sourcePath, $logStub);
$transformer.Transform($sourcePath, $transformPath, $destFile);
}
}
$loggingStubSource = @"
using System;
namespace Microsoft.VisualStudio.SlowCheetah
{
public class LoggingStub : ITransformationLogger
{
public void LogError(string message, params object[] messageArgs) { }
public void LogError(string file, int lineNumber, int linePosition, string message, params object[] messageArgs) { }
public void LogErrorFromException(Exception ex) { }
public void LogErrorFromException(Exception ex, string file, int lineNumber, int linePosition) { }
public void LogMessage(LogMessageImportance importance, string message, params object[] messageArgs) { }
public void LogWarning(string message, params object[] messageArgs) { }
public void LogWarning(string file, int lineNumber, int linePosition, string message, params object[] messageArgs) { }
}
}
"@
TransformConfig -sourceFile $sourceFile -transformFile $transformFile -destFile $destFile
I would appreciate, above all else, links to docs explaining proper usage. Understanding and being able to implement this more properly is ideal, but any help is welcome.
- 主要语言
- PowerShell
- 星标
- 117
- 派生
- 38
- 平均合并
- 5 天 52 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/json-document-transforms 的其他 Issue
-
难度 5/5 一周以上 新手友好度 15/100
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 38/100
-
难度 2/5 1-3 小时 新手友好度 52/100
-
Release request未关闭
难度 3/5 1-2 天 新手友好度 25/100
microsoft/json-document-transforms#27 · 1 个 reaction ·
查看 microsoft/json-document-transforms 的全部 Issue
相似的 Issue
-
good first issue
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 76/100
chipsalliance/caliptra-sw#4311 ·
维护者通常 2 天内回复
-
[scanner] docs: add/sightings help and README claim a per-project auto-learning store, but the CLI only ever uses ~/.rationguard可能已有人在做 @hivecommons-hive 今天认领。 未关闭agent/scanner help wanted hive/claimed-by-scanner stage/010-actionable
难度 1/5 1-3 小时 新手友好度 88/100
hivecommons/rationguard#292 · 2 条评论 ·
维护者通常 1 天内回复
-
kind:bug up-for-grabs
难度 1/5 1 小时以内 新手友好度 82/100
ForNeVeR/Fabricator#115 ·
维护者通常 1 天内回复
-
[Documentation]: Link externally maintained ContextFetch reader and tool from the integrations page未关闭
难度 1/5 1-3 小时 新手友好度 72/100
run-llama/llama_index#23612 ·
维护者通常 1 天内回复