microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
385 stars 246 forks source link

No active project was found. Make sure to select a project in the VS Code Explorer. #1727

Closed m-brv closed 3 years ago

m-brv commented 3 years ago

PLEASE DO NOT INCLUDE ANY PASSWORDS OR TOKENS IN YOUR ISSUE!!!

Describe the issue Error message while trying to run Local-DevEnv.ps1 file.

Scripts used to create container and cause the issue

Param(
    [Parameter(Mandatory=$false)]
    [string] $version = "ci"
)

$baseFolder = (Get-Item (Join-Path $PSScriptRoot "..")).FullName
. (Join-Path $PSScriptRoot "Read-Settings.ps1") -environment 'Local' -version $version
. (Join-Path $PSScriptRoot "Install-BcContainerHelper.ps1") -bcContainerHelperVersion $bcContainerHelperVersion -genericImageName $genericImageName

if (("$vaultNameForLocal" -eq "") -or !(Get-AzKeyVault -VaultName $vaultNameForLocal)) {
    throw "You need to setup a Key Vault for use with local pipelines"
}
Get-AzKeyVaultSecret -VaultName $vaultNameForLocal | ForEach-Object {
    Write-Host "Get Secret $($_.Name)Secret"
    Set-Variable -Name "$($_.Name)Secret" -Value (Get-AzKeyVaultSecret -VaultName $vaultNameForLocal -Name $_.Name -WarningAction SilentlyContinue)
}
$licenseFile = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($licenseFileSecret.SecretValue))
$insiderSasToken = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($insiderSasTokenSecret.SecretValue))
$credential = New-Object pscredential 'admin', $passwordSecret.SecretValue

$allTestResults = "testresults*.xml"
$testResultsFile = Join-Path $baseFolder "TestResults.xml"
$testResultsFiles = Join-Path $baseFolder $allTestResults
if (Test-Path $testResultsFiles) {
    Remove-Item $testResultsFiles -Force
}

Run-AlPipeline `
    -pipelineName $pipelineName `
    -containerName $containerName `
    -imageName $imageName `
    -artifact $artifact.replace('{INSIDERSASTOKEN}',$insiderSasToken) `
    -memoryLimit $memoryLimit `
    -baseFolder $baseFolder `
    -licenseFile $licenseFile `
    -installApps $installApps `
    -appFolders $appFolders `
    -testFolders $testFolders `
    -testResultsFile $testResultsFile `
    -testResultsFormat 'JUnit' `
    -installTestFramework:$installTestFramework `
    -installTestLibraries:$installTestLibraries `
    -installPerformanceToolkit:$installPerformanceToolkit `
    -credential $credential `
    -doNotRunTests `
    -useDevEndpoint `
    -updateLaunchJson "Local Sandbox" `
    -keepContainer

Full output of scripts

[Error - 20:35:36] No active project was found. Make sure to select a project in the VS Code Explorer.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context

Thanks

freddydk commented 3 years ago

Where do you get this error? I cannot recognize that? I would need the full output of the scripts and not just the error. The output contains a lot of information, which can help me identify why this fails on your setup.

m-brv commented 3 years ago

Hi, I'm getting this error from Visual Studio Code - Output section when I run the script. This started appearing since I installed the latest version of BcContainerHelper. I'm afraid I can't get any other output from the script.

image

freddydk commented 3 years ago

How do you run the script? (f5?) I don't think this is related to BcContainerHelper - I think it is something in VS Code which intercepts what you are running. If you run the script in PowerShell ISE it probably works just fine, meaning that some extension you have in VS Code is taking over. There might be a different way of running PowerShell from VS Code, than what you are doing.

fvet commented 2 years ago

For my reference.

I got the same error when doing a 'AL : Publish'.

Problem occured when in the app.json file, I had commented some dependencies.

// {
    //   "id": "1a5f070a-5f66-4259-9e8e-xxxxxxxx",
    //   "name": "Core-Test",
    //   "publisher": "Publisher",
    //   "version": "19.0.0.0"
    // },

Removing this part from the app.json fixed the issue.

mortenseifert commented 9 months ago

I had the same error compiling my project. This has nothing to do with BcContainerHelper. Running VS Code 1.86.0 and AL Language Extension (pre-release). After changing to release, the problem went away.