Problems with creating an azure function in visual studio 2022 - visual-studio-2022

So I right click on the solution > add > new project > find azure function > choose template > create that
And then nothing happens. If I swap to folder view, I see a new folder made for the function, but its an empty folder.
Weirdest thing is, this was working perfectly fine and a moment later, it became how it is right now. I've not updated vs in between, I've not restarted in between. It was literally closed vs, opened again, and then vs broke.
Older solutions that has functions in them, tried creating a new one, doesn't work same story. Made new solutions and start it off with creating a function, didn't work as well. Reinstalled vs, also did not help, still the same issue. Any ideas how I broke vs?
Also, this works from powershell, I can create functions from there and then go back to vs to add an existing project. However the functions I've build using this method had runtime errors (I think) when I publish them into azure. Regardless, I really would like to be able to create functions normally in vs.

As we can see from the comment section of the question, the solution was:
Go into Tools -> Get Tools and Features
download the .Net desktop development
As Maybemonday described in his/her comment, functions can be created afterwards.

You can solve the issues by installing the right tools.
When setting up the VS 2022 -OR- by navigating to Tools -> Get Tools and Features, install the following workloads:
.Net Desktop Development
Azure development
You can also observe the icon changes from a "Project" type to "Azure Function App" type.

I'm not sure why, but once I renamed C:\Program Files (x86)\dotnet to C:\Program Files (x86)\dotnet.delete, it started working. I think the x86 dotnet binary was earlier in the path and was causing issues.

Related

Visual Studio builds solution automatically on launching

I faced the problem: whenever I open my working solution Visual Studio automatically starts build. I cannot find configurations to turn off this.
It looks like that problem is in solution, because I opened another solution and build did not start automatically.
This strange behavior is not expected one for VS2019. Please try:
1.Tools=>Import and Export Settings=>Reset all settings=>No, just reset settings to reset current VS settings to default.
2.Use vs installer to repair your VS if there's something broken with IDE.
3.Extensions=>Manage Extensions=>Installed=>Tools you can disable(don't need to uninstall) some third-party extensions and restart VS to check if this issue persists. To check if this issue is about VS itself or extensions.
4.Exit VS and delete the .vs, bin, obj folders of the projects in the solution, and then clear the cache, for VS2019, the corresponding folder is 16.0 instead of 14.0. After that, restart VS.
For me, this was a Resharper setting. When I turned this off it stopped happening. I think there is also a setting for Visual Studio to do this as well, but it is off by default.

VB.Net build error targetting .Net 2 in VS2013 [duplicate]

My app keeps getting this error (I'm using VS 2013, VB.NET, and Windows 8.1, by the way):
Could not run the "GenerateResource" task because MSBuild could not create or connect to a task host with runtime "CLR2" and architecture "x86". Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Program Files (x86)\MSBuild\12.0\bin\MSBuildTaskHost.exe" exists and can be run.
The app is for .NET 3.5 (3.5 and lower versions get me this error).
I try to run the app again. Sometimes, it works; sometimes, the error comes back.
I already tried looking up for answers at Google and the answer they gave me turned out to be: "Your build's username is too long" (they said that 20 characters or more cause the error), but it's not true. My user name is 5 characters only. Anyway, I don't think my build's username's length has anything to do with it; it makes no sense.
Does anyone know what is wrong with 3.5 and lower versions? Thank you.
This fixed the issue on my machine:
To resolve it, go to your csproj file and add the following line under the default property group:
<PropertyGroup>
...
<DisableOutOfProcTaskHost>true</DisableOutOfProcTaskHost>
</PropertyGroup>
Found here.
Clean and rebuild solution worked for me.
Adding this in each project is a cumbersome task. So you can set it in the environment variables.
Click Start>> Right-click Computer >> Properties >> Advanced system settings >> Click Environment Variables button to open the dialog, then under the System variables section, click New… button, type the Variable name = DISABLEOUTOFPROCTASKHOST, and type the Variable value = 1, then click Ok.
More here
I'm using VS 2013, VB.NET, and Windows 10, 64 bits, by the way
Just change in XML properites , Services : .NET Framework 4.6 instead .Net Framework 2.0 (Default)
and working fine for me.
I try adding the follow but didn't works
<PropertyGroup>
...
<DisableOutOfProcTaskHost>true</DisableOutOfProcTaskHost>
</PropertyGroup>
this solve this issue for me, adding the same as enviroment Variable
DisableOutOfProcTaskHost=true
I encountered this error when trying to build a sample solution that was included in some software that was installed under C:\Program Files\. Visual Studio prompted me to restart with elevated privileges (as it does when opening a solution in a "secure" location), however the build failed with the OP's error message.
Copying the solution to a "normal" folder (e.g. C:\Temp) solved it for me.
I tried opening an old VS2010 vb project inside VS2013 recently and just ran into this problem. I got around it this way:
I went to the vb project's properties page
I clicked the "Debug" tab
In the "Enable Debugers" section, I saw that the "(x) Enable the Visual Studio hosting process" checkbox was already checked.
I tried un-checking the "( ) Enable the Visual Studio hosting process" option
I saved these changes (Ctrl+S)
I then checked the "(x) Enable the Visual Studio hosting process" checkbox once more
I saved these changes (Ctrl+S)
My next re-build of the project was then successful.
Luckily, I was able to observe how the .vbproj file changed in my version control, and saw that it added the following line into it (which was not there before, despite the checkbox already being set initially):
<UseVSHostingProcess>true</UseVSHostingProcess>
None of the answers in this worked for me. I had to run Visual Studio as admin. Hope this helps someone in the future!
If you don't know how to run a program as admin on Windows, click this link.

Visual Studio 2012 fails to compile exe with no code errors

When running a project in Test or Debug configuration in VB.NET using Visual Studio 2012, sometimes it gives the following error as the reason for "Build Failed"
Error 1 Could not copy the file "obj\Debug\MyProgram.exe" because it was not found. MyProgram
There are no issues with the code as it was just compiled seconds before this (sometimes I start the program again just to see how everything gets laid out visually and then go back to the code to make Location adjustments)
What I found is this. If I wait , when I go to test compile again -- it just magically starts working again -- Only to fail again later.
Sometimes, I can get 10-15 good compiles before it wigs out.
About my system configuration:
I do not have any other version of Visual Studio or standalone .NET language installed
The paths are set correctly (else it would never compile in the first place.. not just occassionaly fail)
The program can be a simple program with absolutely no code added (aka... New > WinForms Project > Compile)
The project, language (and all requirements), and project output path are on a local drive that is connected directly to the PC internally (using C:\code* for projects and the standard install location for Visual Studio 2012)
I checked the smart data and scanned my hard drive for any errors ... none ever encountered. The temperature of my system (CPU), and the drive is around 25-30 degrees C.
I am really baffled as to why this happens and at random. I have also tried completely clearing out the bin/ folder, and even Moving the project or repointing where the compiled output path is.
Deleting the .suo file helps sometimes, but not all the time.
I believe this is something that may be able to be tweaked in the UI somehow, however I do not know anything about manually linking and compiling programs.
Lastly -- it does not matter whether I run VS in "Administrator" mode (elevated privileges) or as a user.
Some methods that may help you
Have you tried to reinstall Visual Studio. If that does not work you may need to install some of Windows Updates, the compiler may be missing some essential libraries/references to compile your application.
Check your .Net Target Framework, setting your application to a new framework that you don't have installed can stop the application from compiling yet even stop it from being debugged, having a compiler that is to low, this may come with errors for the compiler but not for the IDE/Visual Studio to notice.
Try cleaning your project solution's output folder by right clicking your solution then try to rebuild your project/solution.
Check your compilation references in your project's properties, check if a reference added is not on your computer
Reinstall/Update .Net Framework, same here some requirements may be missing from your installation
Try installing a newer version of Visual Studio, try Vs2013 - this contains various improvements and fixes, Visual Studio 2015 is fast approaching, a recommendation install VS2015 when the full version gets released it will contain a lot of useful features for future .net programming.
Create an new Administrator account and Run VS with Administrator rights and try compiling then, this fixes some of problems in vs and other microsoft products, it might work here.
Install all of the .Net Frameworks from the lowest to current 4.5, this may help when some of the used references/libraries are not on your local hard drive.
if none of these methods work, i would not know of the problem one last thing you could try is installing Windows to another hard drive and try using that installation of windows and see what happens... Hope this helps.
Best regards!
I faced this kind of problem because of my virus guard
blocked my application(but it is not have any harmful code :) )
exclude your project folder from virus guard
or
simply disable it(not recommended)

Intellisense stops working in VWD 2010

I'm working with VWD2010 and as stated in the topic title I have zero intellisense usability for my project.
I installed VWD2010 fresh a few months ago to start and noticed that intellisense wasn't working. For the last three months I was working with VS2010 trial and intellisense was working fine. The trial version expired, so now I am back to VWD2010.
Intellisense seems to work for NEW projects, so I created a new project and transferred all my files from the VS2010 project. Intellisense was working fine for a couple of days, but this morning I am back with it not working...
I have checked the following:
Intellisense works for new projects;
Intellisense is switched on in the editor settings;
I have reinstalled VWD2010 several times before without it making the blindest bit of difference;
I have reset settings both via the Options menu and via the command line, again without it making the slightest bit of difference.
Intellisense was definitely working for this project last Thursday evening when I last switched off my computer.
I have googled this issue several times and can't find the slightest bit of info on how intellisense is actually supposed to work. Advice generally resumes to "reinstall VWD" or "reset your settings"... Any help would be greatly appreciated.
Here is a distillation of some solutions that have worked for other users from the MSDN forum thread IntelliSense stopped working:
In Visual Studio, Go to Tools > Import and Export Settings,
and then select Reset all settings.
After closing Visual Studio, move the .suo file to a temporary
folder, and then reopen Visual Studio.
Check that Build Action property of your source files are set to
Compile rather than Content. Setting a file to Content detaches the source file from the rest of the project, disabling IntelliSense.
If you have a web project, exclude the WebConfig from the project and
rebuild the project. Then include the WebConfig.file again.
If you’re using C++, close Visual Studio, and then delete the .ncb
file. The ncb file contains IntelliSense information for C++. Deleting it resets IntelliSense, but it may take a while to rebuild in the background.
Finally, from the post Visual Studio & XAML – IntelliSense Not Working:
If you're using XAML, adding ;assembly= to the end of the custom CLR namespace fixes the issue.

Old DLL file keeps being used

I have a seemingly random problem where my project will run using an old version of a DLL file that no longer exists. Sometimes the real version of the DLL file will be used, other times an ancient version of the DLL file will be used. Who knows where Visual Studio is getting this DLL file from - it's months out of date!
I know that it is using the old DLL file, because when the application runs I start getting weird 'TypeLoadExceptions', complaining that methods don't exist or don't have implementations.
The following actions will sometimes help, sometimes not:
Restarting Visual Studio
Restarting the computer
Cleaning and rebuilding the solution
Deleting everything in \WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
Searching for and deleting instances of the DLL file in \Documents and Settings\username\Local Settings\Temp
Sometimes I perform all of the above steps, and it still uses an old copy of the DLL file. Where is it hiding it?!
The same issue exists on our TeamCity server which is using MSBuild. When TeamCity tries to run unit tests it uses an old DLL file.
Now, I know that I can use assembly redirection in the web.config file, but the version number of the DLL file hasn't changed (I don't bother to update it, so it just stays at version 1). I don't want to have to start versioning the DLL files just to solve this problem. I would just like to know which particular caches I need to clear so that I can get on with developing.
It hides it in the GAC. There it may reside indefinitely. Using a more recent version may indeed solve the problem, but there is an outstanding bug in Visual Studio that has to do with choosing the correct version of DLL files. (If DLL Hell wasn't bad enough, the Visual Studio team is making it worse!)
Finding it in the GAC is tricky, and I cannot advise you on how to do that, but once the old version is deleted from there, it will not be found again. Sometimes, even though you are pointing the compiler at a newer version (by date), it will use the older version, because it has the same version level (by version). That is its bug.
Who knows where Visual Studio is getting this dll from - it's months
out of date!
The Modules Window is your friend...
It'll tell you exactly where that file is coming from. You can even use it with arbitrary processes if you attach the debugger.
I too would guess that they're hiding in the GAC.
You can look in 'C:\Windows\assembly' to see all the dlls and unregister yours from there.
The problem may exists with the build order or your projects.
If your Test project is built before the application project, this cause the behaviour you describe. To fix this: right click on your main project in VS and select the Project Dependencies... option and check the build order. Changes to the build subsequence can be made here by correctly setting these dependencies.
I had a similiar problem (but without Visual Studio). I am loading a .NET dll using UnsafeLoadFrom.
On one computer (a terminal server) the old file still remains being used, regardless of updated version numbers, etc.
The reason is simple: As long as a program instance is running, which has already loaded the old dll, the new dll will never be used. All further UnsafeLoadFrom will become the old dll although the old version doesn't exist on the harddisk anymore, because it has already loaded some time ago.
The solution is to shut down all running instances of the application or even restart the computer. Then all new instances will get the updated dll.
In my case, this was caused switching to Release mode, which had a different configuration (that used different location of the DLL).
In my case, I use Visual Studio to Publish Website, and though I check the reference of the dll file has changed, but the published dll still is old. Finally I new a Publish Web Profile and choose the right configuration (such as Debug - x86 / Release - Any CPU), publish again then the dll is corrected.
While this question is old, maybe someone will stumble upon it again in his/her quest for finding a solution.
In my case i got a CS0433 error for an ASP.Net page. After deleting the content in the obj\ and bin\ folders of the project, it worked again. Probably has to be done with a closed Visual Studio. Maybe also clean out those folders in referenced projects in the same solution (if used in the project and not pulled via Nuget).
In my case, the old DLL was in
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\MyDLL\MyDLL.dll
It DID NOT show up in c:\Windows\assembly.
I did a search of my drive for MyDLL, and it showed up as indicated above. I was debugging my test app at the time, and tried to delete the offending folder...no go...it was locked by Visual Studio. I had to stop debugging my app, close Visual Studio, and then delete the folder. Problem solved!! I don't know how my DLL got there, but it hasn't showed up there since I deleted it.
It's possible that the DLL is being referenced from another folder. It could even be on a network drive if you have one in your PATH environment variable. Here's how Windows searches for DLLs:
http://msdn.microsoft.com/en-us/library/7d83bc18%28v=vs.80%29.aspx
In My Visual Studio 2015, I ensured that the offending Visual Studio project's Reference Path Listing is empty:
If you find such problem ,delete your Reference dll and pdb extensionfile add new references and rebuild your project .This often happens due to no rebuild of project,commit and updates.
The fix for me was making sure that the virtual directory in IIS was pointing to the correct directory. I have two projects on my system, a v4 and a v5. The virtual directory on my dev system was pointing to the v4 bin directory instead of my v5 bin directory - oops!
The file that was being cached in the dll, I couldn't trace the file, so I ended up renaming the file. This might not resolve the problem mentioned here but this was the fix that worked for me related to this question.
I tried a ton of things including re-installing VS 2107.
You can see where the DLL files are being loaded from in your Output window. After going through all mine looking for project DLL, I found it.
Clearing this worked for me.
C:\Users\YourUser\AppData\Local\assembly\dl3\222Q4G1T.8AT\JBEAR7PB.E3J\8bfcf9ab\6e61cbd5_30acd401\YourDLL.dll'
I actually deleted all the files in:
C:\Users\YourUser\AppData\Local\assembly\
Holy Crow! I had an old, old suite of applications including 2 web services and a bunch of class libraries and a click once application. Well, click once stopped publishing for VS 2005 with a bunch of 'not found' errors. So, rather than hack away at my registry as suggested on this site, I figured it was time to upgrade the projects to 2017. Well, when I did this, the projects references in my web service projects got lost. Then, rather than helpfully just telling me that with errors, VS 2017 must have went to some cached file in C:\Users\XXX\AppData\Local\Temp\WebSitePublish or C:\Users\XXX\AppData\Local\Microsoft\VisualStudio\8.0\ProjectAssemblies or C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root and 'helpfully' just used those files instead! I had to do a hardcore search with a custom program to find all the files on my C:\ drive and delete them before I finally got the errors!