SlowCheetah failing quietly.
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- ドキュメント
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- powershell
調査の方向性
まず、TransformConfig エントリーポイントで PowerShell の例を再現し、TransformerFactory と logging stub がどのように使用されているかを確認します。issue ではリポジトリのファイルやテストが指定されていないため、最初に、想定されている範囲が不足しているガイダンスなのか、変換がサイレントに失敗することなのかを判断してください。完了条件には、文書化されサポートされた 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
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/json-document-transforms のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 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 件 ·
microsoft/json-document-transforms の issue をすべて見る
似ている issue
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
enhancement priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
briandconnelly/amicus#351 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nginxinc/nginx-hugo-theme#498 ·
-
track: content
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
0xAndersen/witness-log#10 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
w3c/csswg-drafts#14589 ·
メンテナーはふだん 1 日以内に返信