sirruggie
sirruggie
CC#
Created by sirruggie on 2/7/2023 in #help
❔ WinUI exe launch issue
I'm still having issues here.. Does anyone know what this is?
4 replies
CC#
Created by sirruggie on 2/13/2023 in #help
✅ C# Bold Text
got it ok, will update with a textblock
3 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
even though my execution policy was set to unrestricted it still complained, idk y
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
That worked!
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
Alright, I will have to try this on a non work laptop as I don't have permissions to change policy. I'll let you know, thank you!
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
found the error
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
Is that what you were looking for?
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
using Newtonsoft.Json;
using System.Collections.ObjectModel;
using System.Management.Automation;

var script = @"C:\Temp\Test.ps1";
PowerShell powerShellInstance = PowerShell.Create();
powerShellInstance.AddScript(script);
Collection<PSObject> results = powerShellInstance.Invoke();

var errorStream = powerShellInstance.Streams.Error;
if (errorStream.Count > 0)
{
foreach (var error in errorStream)
{
Console.WriteLine(error.ToString());
}
}

foreach (var PSObject in results)
{
var serialized = JsonConvert.SerializeObject(PSObject.Properties.ToDictionary(k => k.Name, v => v.Value));
Console.WriteLine(serialized);
}
using Newtonsoft.Json;
using System.Collections.ObjectModel;
using System.Management.Automation;

var script = @"C:\Temp\Test.ps1";
PowerShell powerShellInstance = PowerShell.Create();
powerShellInstance.AddScript(script);
Collection<PSObject> results = powerShellInstance.Invoke();

var errorStream = powerShellInstance.Streams.Error;
if (errorStream.Count > 0)
{
foreach (var error in errorStream)
{
Console.WriteLine(error.ToString());
}
}

foreach (var PSObject in results)
{
var serialized = JsonConvert.SerializeObject(PSObject.Properties.ToDictionary(k => k.Name, v => v.Value));
Console.WriteLine(serialized);
}
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
{System.Management.Automation.PSDataCollection<System.Management.Automation.ErrorRecord>}
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
That matches now
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.3.2" />
<PackageReference Include="System.Management.Automation" Version="7.3.2" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.3.2" />
<PackageReference Include="System.Management.Automation" Version="7.3.2" />
</ItemGroup>

</Project>
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
ok
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
Execution policy is Bypass
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
The project 'TableTest' ran into a problem during the last operation: A numeric comparison was attempted on "$(TargetPlatformVersion)" that evaluates to "" instead of a number, in condition "'$(TargetPlatformVersion)' < '10.0.18362.0'". C:\Users\gposab7.nuget\packages\microsoft.windowsappsdk\1.2.221109.1\buildTransitive\Microsoft.InteractiveExperiences.Common.targets You may need to reload the solution after fixing the problem.
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
I always see this error when changing
52 replies
CC#
Created by sirruggie on 1/29/2023 in #help
✅ PowerShell Method in WinUI C#
ok, changing now...
52 replies