Property "FullName" cannot be found on the object for Get-VisualStudioTemplate - powershell

When I run the "Get-VisualStudioTemplate" command in a NuGet Powershell window in Visual Studio 2019, I'm getting an error that property "FullName" cannot be found on the object. I'm attempting to get the "EmptyWebApplicationProject40.vstemplate" in the C# format. I confirmed the template name was correct in the default template set, so I'm not sure where this error would be coming from.

Related

Tanka - VS Code - "Unexpected type string" while getting namespace from spec file

I'm trying out Tanka for k8s configs generation. Also, I'm using VS Code extension by Grafana Labs.
I've problems in VS Code with referencing Tanka configuration as described here. I'm using configuration to retrieve namespace, like so:
local k = import 'k.libsonnet';
local tk = import 'tk';
{
namespace: k.core.v1.namespace.new(tk.env.spec.namespace),
}
Initially, I was receiving an error: RUNTIME ERROR: Undefined external variable: tanka.dev/environment. I supposed that Tanka wants path to my environment, and so added it to VS Code settings:
{
"jsonnet.languageServer.extVars": {
"tanka.dev/environment": "environments/default"
}
}
Now I'm receiving another error in the k.core.v1.namespace.new(tk.env.spec.namespace) expression:
RUNTIME ERROR: Unexpected type string, expected number
<path to repo>/environments/default/main.jsonnet:7:38-49
<path to repo>/vendor/github.com/jsonnet-libs/k8s-libsonnet/1.25/_gen/core/v1/namespace.libsonnet:51:35-39 thunk from <function <anonymous>>
<path to repo>/vendor/github.com/jsonnet-libs/k8s-libsonnet/1.25/_gen/core/v1/namespace.libsonnet:33:42-46 object <anonymous>
Field "name"
Field "metadata"
Field "namespace"
During manifestation
The error is quite confusing to me. What and where expects number?
both namespace and name are strings in my spec.json
according to the same configuration docs they should be strings
on line 33 of namespace.libsonnet there is a function withName which expects name argument of type d.T.string
tk works fine from the CLI
I suppose that I've set wrong tanka.dev/environment, but I can't find docs that say what should be set there.
Also, just to check if it helps, I tried setting "jsonnet.languageServer.tankaMode": true in VS Code settings to no avail.
Please, help me to resolve the error and if possible explain what's going on here.

How to set a default text editor for PowerShell (e.g. Visual Studio Code)

I am using the new windows terminal.
I just installed powershell v7.0.2 and starship to make it better.
I want to edit the starship config, so I ran this command:
> starship.exe config
----------------------
Error: editor "vi" was not found. Did you set your $EDITOR or $VISUAL environment variables correctly?
Full error: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }
So I went ahead and edited my $PROFILE to set visual studio code as the default editor (code is in the path):
> code $PROFILE
---------------
$ENV:EDITOR = "code"
$ENV:VISUAL = "code"
Now I get the same error but with code instead of vi:
> starship.exe config
----------------------
Error: editor "code" was not found. Did you set your $EDITOR or $VISUAL environment variables correctly?
Full error: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }
The reason I ended up running starship config is because after creating the $HOME\.starship\starship.toml config file, starship ignores it, although I've set the path in my profile:
> code $PROFILE
---------------
$ENV:STARSHIP_CONFIG = "$HOME\.starship"
So I ran starhip config to see which is the path that it expects the config file to be in.
I also tried to set the full path to visual studio code in $EDITOR, but it didn't help.
I had the exact same issue, and managed to solve it by setting the $EDITOR variable to the absolute path of your editor, so for Visual Studio Code, add this to your $PROFILE:
$ENV:EDITOR = "C:\Program Files\Microsoft VS Code\Code.exe"
I'm surprised code isn't in your path:
$env:path += ";C:\Users\$username\AppData\Local\Programs\Microsoft VS Code\bin"
Do you mean, default program to open ps1?
If so it's a registry entry, HKLM and find extension...

Powershell command for Create OSDisk and DataDisk snapshot

I am writing powershell script for capture OS-disk snapshot for Azure VM but While configuring snapshot I am getting some error.
I am using below command to create snapshot.I am using managed disk.
New-AzSnapshotConfig -OsType Linux -CreateOption copy -SourceUri Microsoft.Azure.Management.Compute.Models.OSDisk -DiskSizeGB 40 -Location 'East US'
Not sure how to do that. If anyone could you please help me to solve this issue.
OUTPUT
WARNING: Breaking changes in the cmdlet 'New-AzSnapshotConfig' :
WARNING: - "The output type 'Microsoft.Azure.Commands.Compute.Automation.Models.PSSnapshot' is changing"
- The following properties in the output type are being deprecated :
'EncryptionSettings'
- The following properties are being added to the output type :
'EncryptionSettingsCollection' 'HyperVGeneration'
WARNING: NOTE : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in
Azure PowerShell.
ResourceGroupName :
ManagedBy :
Sku :
TimeCreated :
OsType : Linux
HyperVGeneration :
CreationData : Microsoft.Azure.Management.Compute.Models.CreationData
DiskSizeGB : 40
EncryptionSettingsCollection :
ProvisioningState :
Id :
Name :
Type :
Location : East US
Tags :
EncryptionSettings :
Thanks
Rohit
Did you go to the link provided in the warning note? It says very clearly:
How do I get rid of the warnings?
To suppress these warning messages, set the environment variable 'SuppressAzurePowerShellBreakingChangeWarnings' to 'true'.
Set-Item Env:\SuppressAzurePowerShellBreakingChangeWarnings "true"
The error message is trying to tell you that the property EncryptionSettings you see in the output you provided will soon be changing from a single property of some type, to a collection property that you would have to iterate over to find all of the settings. They are trying to let you know that if you are capturing the output of New-AzSnapshotConfig to a variable and then calling $variable.EncryptionSettings, your code will work for now, but in the next breaking change release, that call will stop working. Most likely, since that property will no longer exist, the result of that call will simply be a $NULL.
So suppress this warning at your own risk because Microsoft is trying to do you a service here and let you know that if you don't do something about this your code could break. But if you are certain that you never reference property then you have nothing to worry about.

Unable to find type [cultureinfo]

I have powershell v2. I am getting below error.
Unable to find type [cultureinfo]: make sure that the assembly containing this type is loaded.
Can anybody encounter this error before? My script is working fine on powershell v3 but in my server its PS v2 and i can't upgrade it.
This is the command which i am running.
$log_date = [datetime]::ParseExact('Tue Aug 4 17:05:41 2015','ddd MMM d HH:mm:ss yyyy',[cultureinfo]::InvariantCulture,'AllowInnerWhite')
Only a few namespaces are included in PowerShell's search for type names (and the list expands from version to version).
And System.Globalization (which contains CultureInfo) is not one.
But the resolution of names is relative to those namespaces that PowerShell defaults, so you can use [Globalization.CultureInfo].

Unable to install a VSTO excel 2003 AddIn

I developped a VSTO SE Excel 2003 add in.
When launching and debuging the add in from visual studio, it works well.
But when I try to deploy it from my own install it never works.
To sum up, here is my install process:
the files are copied at the right location
I register the addin:
HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\
with the appropriate values (Default, CommandLineSage, Description, FriendlyName, LoadBehavior, Manifest).
I also add entries in
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ (with CLSID key including an UUID)
And HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
with InprocServer32 (with the manifest name and path, the addinloader.dll fullpath), ProgID (with the assembly name (without extension)), Programmable and VersionIndependententProgID (with the assembly name too).
I set the fulltrust policy to the url of every assemblies using caspol -m -ag "xxx" -url "MyUrl\Assemblies.dll" FullTrust -name "name"
Do I miss something ?
In the deployment machine, check whether the following are available:
Currect version of VSTO Runtime
Office 2003 Primary Interop Assesmblies
regards,
yenkay...
A good way to debug VSTO installation/loading issues is to have VSTO show you all errors. To do that, create an environment variable called VSTO_SUPPRESSDISPLAYALERTS with the value 0, reinstall/repair your addin, then try running Excel again.
It looks like the problem is with your registry keys. Check out the following link:
http://msdn.microsoft.com/en-us/library/bb386106.aspx
Your Software\Classes and Software\Microsoft entries should be under the same key, either HKCU or HKLM. If you have one under HKCU and the other under HKLM, it messes up the addin.
So I think the registry entry HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\ should be HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Excel\Addins.
HTH...