can not push function code to azure from visual studio code - visual-studio-code

I am following the azure digital twin tutorial. I am using visual studio code 1.59.0 on Mac. https://learn.microsoft.com/en-us/azure/digital-twins/tutorial-end-to-end
I like to do all from the VS code menu, skipping the azure cli.
I was able to create a function app using the deploy menu, but I can not find out how to push the .cs code to azure. All the instructions I googled have mismatching UI which does not match my own VS Code screen.
When I click on the deploy button, it only asks for the function app to push to, instead of allowing me to pick out the .cs file. When I do go thru with the push, I get a
Failed to deploy path that does not exist: /Users/xxx/workspace/digital-twins-samples/AdtSampleApp/SampleFunctionsApp/bin/Release/netcoreapp3.1/publish
I noticed some other instructions seems to indicate I must have a .zip file prepare, but that was supposed to be automatic during the deploy. So I am stuck. Can anyone help?

You can use the Kudu console to drag and drop the *.cs file to the function app as explained the article

Related

Maui Blazor Hybrid - Cannot double click on the exe in the bin folder

I recently installed the preview version of visual studio and created a new .net maui blazor hybrid app.
When debugging the app, a window shows up and everything works just as expected.
However when i go to the bin folder and run the exe that is located there the window does not come up.
In the windows event logs i can see the following:
Exception Info: System.DllNotFoundException: Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies
And indeed that dll is missing from the bin folder.
What does visual studio do to make this work? How can i just run the exe?
Right now we only support so-called “packaged” apps. Those you need to publish to an MSIX and install in order to run.
We’re working on adding the unpackaged scenario as well, you can track that here: https://github.com/dotnet/maui/issues/3166
While searching for the above issue I noticed a couple of others ones though. According to this and this it might already be possible right now, you might want to try!

Deploy Salesforce Package Using Visual Studio Code

I am new to developing for Salesforce. I have installed the Salesforce Extension Pack for Visual Studio Code. So far I have been able to create a project, authorize an org and deploy a single Apex class to a Salesforce Trailhead org.
Where I'm stuck is being able to deploy the entire package to my Salesforce org instead of just a single class. I followed the Trailhead Visual Studio Code training but it ends at deploying just a single Apex class. I've search but can't find anything that answers my question.
First you have to create Project with Manifest in Vs Code . After the update add all the class and other things to Vs code . Now update the package.xml file . You got in force-app in vs code. After then you can deploy it to org by clicking on right button .
You can right click your package file in the Explorer and select 'SFDX Deploy Source in Manifest to Org':
Alternatively, deploy from the command line with
> sfdx force:source:deploy -x path/to/package.xml
You can check docs for the CLI commands here:
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_deploy

Why my Azure functions are not visible in the function list after my deployment from GitHub/Kudu?

I'm trying to deploy my first HTTP trigger Function App to Azure.
It was created with the Azure Function extension in VS Code with TypeScript template.
I use my GitRepo as a source and the Kudu build App Service.
My functions are working well locally. I can see them in VS Code > Azure tab, Local Project > Functions.
I have no error on the deployment itself but I cannot see my two functions in the Azure Functions list.
In the kudu UI, I see that all my files are correctly deployed :
Kudu screenshoot
My settings are :
settings
Where can I find some logs on what went wrong? Any idea of other things to check?
Any help will be appreciated.
I could use Zip deploy (https://learn.microsoft.com/en-us/azure/azure-functions/deployment-zip-push) as an alternative way to deploy this (I haven't tried it yet). I would like to know what's wrong with my current setup.
Not sure if the problem is that you configure the wrong runtime.
Here is the steps I did:
Create a Function app project with an http-trigger function based on TypeScript in VS Code:
Upload the project to GitHub.
Using deployment center to configure deploy from Git on portal.
After deploy, check in Functions page:
By the way, you could deploy from VS Code directly:

Debug NuGet package using Azure Devops Symbole Server resulting to class not found

I've been playing around with Azure Devops lately to host a NuGet package as an artifact, which I would then use in another project of mine.
So far so good, I managed to get the package and to use it as intended, but I'd like to be able to debug it as well so I had to add symbols (as far as I've understood?). So I added a publish step in my pipeline for the symbols which succeeds and the .pdb file gets published. I refer to my symbols feed in Visual Studio by connecting to DevOps in the settings Debug > Symbols.
When debugging the code it correctly downloads the .pdb file to the temp location and all the whilst the code is running it's staying there.
Under the debugger > windows > modules it actually tells me that the symbols are correctly loaded whilst debugging, but as soon as I try to step into the code I get the error: ".cs not found".
I've tried multiple things such as clearing the symbols cache, changing settings in debug for "own code only" and "allow source server support" etc. But to no avail.
Did I miss a step or am I doing something horribly wrong?
Debug NuGet package using Azure Devops Symbole Server resulting to class not found
That because you do not enable Source Link, which supports Visual Studio knows where it should look to download the source code while debugging.
To debug the source code, we need to have source code, pdb (or /Z7) contains debug information which is like mapping between executable code and your source code. With pdb VS debugger knows where in source files each instruction is located, but it still needs to have source files to show you the code.
So, we have to enable the Source Link. Edit the .csproj file and include the following code in the first PropertyGroup element:
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
You could check the similar thread for some more details.
On the other hand, you could also add the source code in the nuget package as a lightweight solution:
Check my previous thread for details.
Hope this helps.

Visual Studio Online / Azure stopping and starting web applications using Powershell

I'm using Visual Studio Online's build tools to deploy web applications from a single solution. I've occasionally been running into file locking issues.
Error: Web Deploy cannot modify the file 'Microsoft.CodeAnalysis.CSharp.dll' on the destination because it is locked by an external process.
After some Googling, I believe the "fix" is to stop the web applications before deployment on Azure and start it back up after. Sounds legit.
However, there does not seem to be a straight forward way to do this directly on VSO's build definitions. I've created an "Azure Powershell" build task, but it wants a PS1 file from the repository. It doesn't seem to let me just run Azure Powershell commands (e.g. Stop-AzureWebsite) from here. My team has created a work-around where we have a "run.ps1" that just executes the command you pass as a parameter, but none of us are satisfied by that.
What are we missing? There has got to be an easier way to do this without having a PS1 script checked into source control.
I solved this by installing Azure App Services - Start and Stop extension from Visual Studio Marketplace.
When installed, it will allow you to wrap the Deploy Website to Azure task in your Release definition with Azure AppServices Stop and Azure AppServices Start tasks, effectively eliminating the lock issues.
Check if you are using "/" on the "Web Deploy Package" path for folder separators instead of "\".
i.e. change
$(System.DefaultWorkingDirectory)/My Project/drop/MyFolder/MyFile.zip
for
$(System.DefaultWorkingDirectory)\My Project\drop\MyFolder\MyFile.zip
I noticed that was the only difference between the one I was getting the error and the others (the Restart step I added was not helping). Once I modified the path, I got it working.
Sounds crappy, but fixed my issue.
Did you use the Build Deployment Template that sets the correct msbuild parameters for you for your package? You can see how here. I would create a build using that template and see if you have the same issues. If so ping me on Twitter #DonovanBrown and I will see if I can figure what is going on.
As a rule it is good practice to have any scripts or commands required to deploy your software to be checked into source control as part of your build. They can then be easily run repeatedly with little configuration at the build level. This provides consistency and transparency.
Even better is to have deployment scripts output as part of the build and use a Release Management tool to control the actual deployment.
Regardless having configuration as code is a mantra that all Dev and Ops teams should live by.