I used to debug and publish my Azure Function Project using Visual Studio 2017.
However suddenly everything stopped working.
When i tried to debug the project i got the error "A project with an Output Type of Class Library cannot be started directly.".
When i tried to publish the project, the option to publish to Azure disappeared and i'm only offered to publish to a folder.
When trying to create a profile i can also only choose the Folder Profile type.
I saw a similar behavior once in a Web Project when the "Project Sdk" Attribute in the .csproj file was wrong but i doublechecked it with a newly created Azure Function Project and it was the same.
When i create a new function project, i can publish to Azure as i could before.
I'm using the following packages:
along with .NET Framework 4.7.1.
Also i'm referencing some other projects from my solution containing Business Logic.
I ended up creating a new function project, copying everything there and now it's working again as expected.
Does anybody know how this could happen and how to fix it without creating everything from scratch?
In my case I was able to fix it by ensuring the NuGet package for Azure Functions was referenced:
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.14" />
I just had this same thing happen to me. I added a new Azure Function project to an existing solution, and it wouldn't let me debug it. I added an additional Azure Function project just to test it, and it worked fine. Compared the .csproj files, they were both correct.
I restarted Visual Studio and I was able to debug both Function projects, though I don't know if that will always fix the problem.
I had the same problem. I went in to the Visual Studio Installer and (re?) installed the "Azure development" workload. That fixed it for me.
Azure Functions tooling for Visual Studio is not always as stable as one would wish - but it's getting better for every release.
I had a similar problem after updating to Visual Studio 2017 v15.3 and then again when updating to v15.5. Both problems disappeared after updating or reinstalling the Azure Functions plugin.
But if you already have opened (and saved) to solution with a non-working VS setup then VS seems to 'destroy' the project sometimes.
You could look in your non-working project to see if your .csproj-file(s) contain:
<ProjectGuid>{0EC16A67-C60A-4950-A533-07D8783C88B0}</ProjectGuid>
...which is the guid for Azure Functions projects.
If your ProjectGuid is different then you could try changing it to the above and it should(might?) work.
It could be because the wrong project is set as startup project. In the solution explorer, you'll notice that the startup project is in bold. If it is not the right project, try right clicking on the correct one and click Set as startup project.
Solved it for me.
Related
I've a solution with 2 projects, .net7 api and a vue esproj
When I set the startup project as the .net 7 api, Visual Studio changes to the .esproj and launches it instead of the api.
Any ideas why is this happening?
There may be a project in the solution that depends on another project, and you set the startup project of the dependent project. This means that when you start a dependent project, Visual Studio automatically starts the dependent project as well.
Apparently you have some wrong settings in your user settings.
So the fix for this issue is to remove the user settings from the solution and run again.
I've installed Visual Studio 2019, created a Console Project and I want to consume a Web Service via an existing WSDL.
I've already followed all the guides that I've found on internet about the previous versione but none of them apply to my situation.
Can you provide me a solution to accomplish this action?
There is some additional installation component that i need to add?
Kindly,
Roberto
I've found the solution. The issue has been generated by the integration of the git repository via Visual Studio IDE which has altered the solution.
I've deleted the project, recreated it, added the service and then, via command line, I've integrated it in git.
Now it all works fine.
I have created a new Azure Function app with an Http Trigger in Visual Studio 2017 (which I have just updated to v15.8.4).
Using the generated function, when I try to run it I just get a message box with the error
The debug executable "C:\Users\Paul\AppData\Local\AzureFunctionTools\Releases\2.5.2\cli\func.exe" specified in the 'FunctionApp1' debug profile does not exist.
Sure enough there is no func.exe at that location, just a func.dll.
The file C:\Users\Paul\AppData\Local\AzureFunctionTools\Releases\1.3.0\cli\func.exe does exist.
I have successfully run an Azure function locally before but I assume updating Visual Studio a few times has broken something.
How can I get this working?
I Deleted AzureFunctionsTools and azure-functions-core-tools from C:\Users\ {YourUser} \AppData\Local. And ran the solution again it downloaded the same tools and then executed without errors.
I eventually got this to work by changing the settings in the Debug screen.
I changed Launch from Project to Executable
I set Executable to C:\Users\xxxx\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\func.exe
I changed Application arguments to start
I changed Working Directory to Sourcedirectory\FunctionApp1\FunctionApp1\bin\Debug\netstandard2.0
I would still love to know where the Project settings were getting their values from though...
In my similar case after installing Visual studio 2019 16.11.2 in a new Win 10 S.
I had already AzureFunctionsTools version 3.23.5 installed with func.exe inside the cli folder (without_x64 suffix)
But my newly installed VS 2019 was looking for func.exe in a similar path with only one difference that was (_x64 suffix after cli).
C:\Users\[username]\AppData\Local\AzureFunctionsTools\Releases\3.23.5\cli_x64
After getting no result trying a other solutions mentioned here I finally renamed the existing cli folder to cli_X64 and it worked
How can I get this working?
In your case, it seems that there is no azure function tools v2 , please have a try to install it.
npm i -g azure-functions-core-tools#core --unsafe-perm true
Please also try to update the [Azure functions and Web Jobs tools] to latest version
tool->Extensions and updates
And then try to run the azure function, if there is no corrosponding version it will download it automatically.
Test Result
Update
Check the function tools from the path
C:\Users\{userName}\AppData\Local\AzureFunctionsTools\Releases
I am able to get this working just by targeting .Net Standard 2.0.
Just change to netstandard2.0 in the project file.
Application Settings
Debug Settings
There is no need of providing a path to the func.dll.
I was just having on a fresh install of Visual Studio 2019 (had to uninstall 2017), and it was irritating me to no end.
I have found a solution to the problem, but no reason as to why this problem happened nor why Visual Studio deemed it necessary to make it so hard to fix things (they have no option of installing or reinstalling Azure Functions Tools in VS 2019 or even outside of it).
Solution:
Find a way to download the release. I used npm: npm install -g azure-functions-core-tools#3
(-g is global but you can install it locally, #3 will install the latest 3.x.x)
Replace the entire contents of C:\Users\<username>\AppData\Local\AzureFunctionsTools\Releases\3.4.1\cli_x64 with the version you installed.
For me, it was all the files in \node_modules\azure-functions-core-tools\bin.
What worked for me is combination of above two answers .
Same error I also faced due to anti-virus but can't modify anti-virus since it can be changed by IT Security/networking team and process is time-taking & long process. Another workaround is :
Install azure-functions-core-tools via npm
npm install -g azure-functions-core-tools#3
Change Executable & Working Directory in Debug settings for azure Project settings
Working Directory : C:\<Project path>\bin\Debug\netcoreapp3.1
Executable : C:\Users\<username>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\func.exe
Having a bit of an issue with automated builds in Visual Studio Team Services (previously VSO, TFS Online).
I have a class that is referencing a namespace that is this format:
Project.Name.Name.Folder
The issue is there is class named:
Project.Name.
There is no issue in Visual Studio when building or even packaging the project for Azure and it deploys manually fine, but when I run automated builds it comes back with and error that basically states that Name does not exist in namespace Project.Name, so it's obviously looking in the wrong project when it runs the automated build.
Is there some syntax I can use to basically notate what is specifically the class name and then the folder path inside the class?
ex: [Project.Name.Name].Folder
Any help is appreciated.
Turns out VS was just confused :/
If I removed the reference, re-added it, and then removed the using statement and re-added it, the issue was resolved. To be fair, the solution built, ran, and even manually deployed to Azure just fine. It was Continuous Integration that was being problematic with it.
After copying the project to another laptop/ PC, when I want to open the solution, VS2010 shows the error "One or more project was not loaded properly". I have tried running visual studio in admin mode but that did not solve the problem.
This is usually a result of an inconsistency in your solution or projects. Open the solution file in an external editor (such as notepad) and check that the path it has to the projects is available and did not change. There shouldn't be any absolute paths in the solution file.
Maybe because the project from where you copied was configured with IIS configurations and you are trying to run the project in visual studio's default environment.
you have to right click on your project and set as a start up project after that you have run your project,
I seem to have found unloaded project, after noticing there's one missing by manually counting and comparing it to the number of projects the solution explorer reported. It was deep inside another folder in the solution explorer that I never used and assumed that had nothing worthwhile.
It's a familiar issue. Looks like the project you are trying to open was created in higher version than what you have. If the project is in MVC, make sure you have installed MVC OR Make sure you have appropriate version of .NET installed in your system.
I work with NopCommerce and a couple of times I downloaded new version and got same error message. It goes away once I install the dependencies.
Because you tagged it ASP.NET make sure you have all the ASP.NET components installed. Those are not part of .net framework but might be necessary in your project.