rsaz / csharp-snippet-productivity

The complete snippet toolbox for C#"
MIT License
19 stars 6 forks source link

No Framework to select when creating New Project. #21

Closed ayman1988 closed 5 months ago

ayman1988 commented 12 months ago

When Creating new Solution Project... There is no Framework to select. image I have tried to uninstall and install again...

ayman1988 commented 12 months ago

I fixed it by deleting the extension folder from .vscode\extensions now it working... but I can't see .net 7.0.306 as it installed in my windows

ayman1988 commented 12 months ago

As Trying to create new project... The problem reappeared, There are no frameworks at all...

ayman1988 commented 12 months ago

Hi... I found the bug The bug is in CreateProject.js: In Write-Output --noEnumeration | dotnet --list-sdks As the default terminal must be PowerShell There must be an if to ask for the default Terminal in Vs code. So, if its cmd... We must use echo -n. Mine was cmd... So, when changing it to PowerShell the problem disappears There still an issue as it must be closed and opened to refresh the dotnet sdks...

rsaz commented 5 months ago

Hi @ayman1988 thank you for your input in the issues.

Both issues you have mentioned above were resolved and it will be released in the next coming version 2.0.

To validate that the sdks were captured on any default prompt we tested with all default windows prompts:

if (os === "win32") {
        if (terminalPath && (terminalPath as string).includes("cmd.exe")) {
            terminal.sendText(`dotnet --list-sdks > "${sdkFile}"`);
        } else if (
            terminalPath &&
            ((terminalPath as string).includes("bash.exe") ||
                (terminalPath as string).includes("git-bash.exe"))
        ) {
            terminal.sendText(`dotnet --list-sdks > "${sdkFile}"`);
        } else {
            // Default to PowerShell command
            terminal.sendText(`Write-Output --noEnumeration | dotnet --list-sdks > "${sdkFile}"`);
        }
    } else {
        terminal.sendText(`echo -n | dotnet --list-sdks > "${sdkFile}"`);
    }

image

Also, the list of SDK's are getting updated as soon as you selected the command Create Project from the menu. You will not need to delete the extension folder in order to get your .net sdk installed.

image

Thanks for your report, please download the latest version. Any new issues, please don't hesitate to contact.

https://marketplace.visualstudio.com/items?itemName=RichardZampieriprog.csharp-snippet-productivity