Visual Studio Mac Can't run ASP.NET Core Project - visual-studio-mac

This may be very obvious in hindsight. When installing the new VS Mac, and creating an ASPNET Core project, I can't run it by clicking the run button in the top left.
I can run if I right click on the Web project, click 'Run With' then 'Custom Configuration'. Works great.
However, the run item is disabled and I can't figure any way to enable it: http://prntscr.com/f7rsgh

Try loading the solution using Jetbrains Rider. https://www.jetbrains.com/rider

This sounds like it may be the same issue:
https://developercommunity.visualstudio.com/comments/79790/view.html
If you expand the comments, someone says:
OK installing 2.1.0-preview1-006776 breaks VS Mac 7.0.1. I see the same problem that you are seeing. There is a NuGetFallbackFolder in the sdk folder and VSMac incorrectly uses that as the latest sdk folder. So for now you can fix this by removing the /usr/local/share/dotnet/sdk/NuGetFallbackFolder/ folder. Although that may break the 2.1 preview version of the dotnet cli if you are using it from the command line. VSMac seems to be OK running and debugging ASP.NET Core projects after removing that folder.
It seems to have fixed the OP's question from the forum thread. This is a bug with Visual Studio for Mac that's been fixed in a pending release, but the update doesn't seem to be out just yet. I hope this helps you out in the meantime.

Download and install the latest asp.net core
Download or upgrade to
the latest openSSL
This helped me

Related

Error: System' could not be found (are you missing a using directive or an assembly reference?) in vs 2019

I tried creating a asp.net core web application with mvc in visual code 2019 and as soon as I open it it showes me a lot of errors like in the picture.
enter image description here
I triend closing and restarting vs, cleaning and rebuilding the solution and restoring nuget packages and it is still not working.
I got similar issue where it was not able to detect the namespaces from .Net library. I uninstalled the SDK and reinstalled it. then it worked !
Check whether .Net SDK is installed properly in your system and do a clean install once again.
Right-click your project name then open the properties windows after that downgrade your Target framework version, build Solution then upgrade your Target framework version which is the latest, and then again Build Solution.
Hope it will resolve your issue.

Package installation error when new blank application in nanoframework is created

When i try create new blank application in nanoframework, i get package installation error.
error message
It seems some problem in nanoframework visual studio extension, my version is NET nanoFramework VS2019 Extension v2019.5.0.8.vsix, but i also tried another versions with same problem.
I have visual studio 2019 community edition and i have installed almost all components.
When i press ok, project is loaded, but is not possible compile it, because there are missing all assemblies. When i try add assembly, theres nothing to add and add nuget packages from nanoframework store leads to error.
when i try this:
pm> Install-Package nanoFramework.CoreLibrary.NoReflection -Version
1.10.1-preview.9
I get this error:
NU1202: Package nanoFramework.CoreLibrary.NoReflection
1.10.1-preview.9 is not compatible with netnanoframework10 (.NETna noFramework,Version=v1.0). Package
nanoFramework.CoreLibrary.NoReflection 1.10.1-preview.9 supports: net
(.NETFramework,Version=v0.0)
similiar when i try another package versions.
So the extensions is installed incorectly, but i cant find why. i tried it more times. uninstall and install again. from extenstion store, and from disc. nothing successfull.
The webserver NuGet released today fixes the issues with the version mismatches.
The issue with VS2019 16.9 remains. Reported to VS Developer Community here. Please up vote to help increase priority.
What is the Community version you're using?
After a little test, there seems to be an issue with the latest release of VS2019. A work around would be to:
Use V16.8.X
or
use an already created solution that you can edit.
or
add the required nuget to the project once it has been loaded (after the error):
Update: now fixed! it was due to a change to fix nuget, but caused an unintended consequence with nanoFramework.

Spectre-mitigated libraries are required for this project, EVEN after i disabled it in options?

I tried DISABLING the Spectre mitigation from the code generation in option, but i still cannot compile a simple hello world driver, why? how can i stop this message and just compile a simple hello world without needing to install these libraries? i tried to even install them using individual components, but there are 100 different versions in there.. tried installing the latest verison but didnt help..
I am using the latest version of visual studio 2019. SDK and WDK are both installed.
this is happening after i made a mistake of upgrading visual studio, everything was fine in my 2017 visual studio..
after you install those libraries( which is necessary ) you can go to project Property then C/C++ the Code Generation look down you going to find Spectre mitigation then you can enable it or disable it, this won't work if you didn't install those libraries which is necessary for the last update of visual studio

Can't open or create projects: The type initializer for 'MonoDevelop.Projects.MSBuild.MSBuildEvaluationContext' threw an exception

This morning, I found I was unable to create or open any projects on Visual Studio Community for macOS v8.1.1 (build 27) without getting the error...
The project could not be created
The type initializer for 'MonoDevelop.Projects.MSBuild.MSBuildEvaluationContext' threw an exception.
This install of VS has been working for quite some time on this Mac. VS had found and installed some updates recently. This is not a box where I work routinely; it may have last worked successfully a week or so ago.
Here is a screencapture when trying to create a Console app project, for instance. The error occurs when I hit the "Create" button.
I've found a very similar error on a now defunct Bugzilla for the old Xamarin Studio here, which links me to this resolved GitHub issue on MonoDevelop, which is now Visual Studio, from 2017, which is marked Closed and Merged.
I've also found a very similar error report raised as another GitHub issue for MonoDevelop here. No clear resolution there; just a reply that, "Seems like MSBuild is not installed?"
They both suggest MSBuild isn't in the right place, but I'm not sure how I'd fix that.
I have tried uninstalling Visual Studio (by trashing) and removing .NET using sudo rm -rf /usr/local/share/dotnet. This removed .NET, but on reinstall of VS and .NET, the error returns.
Is there a better way to perform a clean install? Is there another way to resolve this issue?
Round 2
Since the issue was MonoDevelop specific, I did a find to find any file with mono in it. I found some stuff like this...
/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
... in the Frameworks folder, and that looked promising. I've messed with MonoDevelop in the past (remember icsharpcode?), know that it used to be its own, independent, OSS C# IDE, and blasted that Mono.framework folder away.
sudo rm -rf /Library/Frameworks/Mono.framework/
I also deleted Visual Studio and removed /usr/local/share/dotnet again, then reinstalled .NET and VS with the VS installer.
When I tried to open Visual Studio, I got a different message.
Now we're getting somewhere. I clicked the "Download Mono Framework" button in that dialog and initially tried installing the "Visual Studio" release from the page the button opened, tried reopening VS, and got the same error as before. Strangely, the VS release is 5.18.1.3, and the error message, above, says I need 5.18.1.24+. :thinking-face:
I tried downloading the latest "Stable" release of the mono framework instead, which is version 5.20.1.19.
Visual Studio opens and creates new projects without error, but...
EDIT: That was short lived. I now get a /usr/local/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(5,5): Error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
System.TypeLoadException: Could not load type of field 'Microsoft.NET.Build.Tasks.DependencyContextBuilder:_filteredPackages' (12) due to: Could not resolve type with token 01000025 from typeref ...
error when I try to build the stock console app.
NOTE: There is an official process for deleting Mono I missed, and is better than the quick & dirty rm -rf I tried, above.

Visual Studio 2015 RTM Cordova IOS Build Error - Could not find module 'Q'

I am using Visual Studio 2015 RTM, and I am working on a Cordova project. My project works fine for Android, but I cannot get it to build for IOS. I have figured out what the problem is, but I cannot figure out how to fix it.
When I build for IOS it is sending the build to the remote build agent installed on my Mac computer, but it is returning the following error:
Could not find module 'Q'. Please Go to Tools --> Options --> Tools
for Apache cordova --> Cordova Tools --> Clear Cordova Cache and try
building again.
Following it's suggestion and clearing the Cordova cache does not help. I did some research and have found that it is a bug in the cordova_ios library. Here is a link to the commit that fixed the error https://github.com/apache/cordova-ios/commit/ed272032878959c90eb28ccc1490e96fb7b69287.
Basically what the issue is that the check_reqs.js file is require 'Q' (uppercase) instead of 'q' (lowercase).
I can work around the problem (and confirm that this is the problem) by doing the following:
Copy my Cordova project over to my Mac computer.
At the command line add IOS as a Cordova platform.
Go to the /platforms/ios/cordova/lib/check_reqs.js file and change line 25 to be a lowercase 'q'.
Build and run the project on the Mac.
What I don't know is how to fix this in Visual Studio so I can build from Visual Studio? I have tried doing NPM updates on the computer that Visual Studio is installed on, but that has not fixed it. I have also tried to manually add the IOS platform to my project via the Cordova command line, and then changing the same file that I change on the Mac, but that does not fix it either.
It looks like this issue if fixed in the latest version of the cordova_ios library, I just cannot figure out how to get Visual Studio and/or the remote build agent on my Mac to use the latest version of the cordova_ios library.
Update
It looks like this is a bug that other people are seeing with Cordova. There are discussion about it here and here. I can reproduce this on my Mac computer. If I create a new Cordova project and add the iOS platform and try to build it for iOS I receive this error. I can then correct the issue by opening the check_reqs.js file and changing the uppercase 'Q' to a lowercase 'q'. However when I build from Visual Studio it sends the project across to the Mac with the incorrect check_req.js file and the build fails. I cannot figure out how to correct this issue when doing a iOS build from Visual Studio.
If your OSX machine has case a case sensitive filesystem you can hit this though a fix is in the works. (Most people do not turn on case sensativity.)
The fix you reference has not yet been released publicly. You can watch for a "platform" release here: http://cordova.apache.org/
Once the platform is released it is very likely a Cordova CLI update will also occur (ex: 5.1.2) so you can just update to that version via the config designer.
However, as an alternative you can add the following into your config.xml file to cause Cordova to use a different iOS platform version and then do a "clean" in VS to force it to take effect:
<engine name="ios" spec="3.9.0" />
3.8.0 is the currently released version.
A "DISCUSS" thread is already going for an iOS release - it should be out in the next couple of weeks.
You can try using the Git URI to get edge - but that could be buggy so exercise care:
<engine name="ios" spec="https://github.com/apache/cordova-ios.git" />
I think we should simply do a patch release of Cordova with this bug fix. Will start a thread on the mailing list to see if a quick release is possible.
Did you already try re-installing vs-tac? Here's the doc:
https://msdn.microsoft.com/library/dn771551(v=vs.140).aspx#vstac
What version of node do you have installed on the MAC machine? I have 0.12.2 and the require(Q) gets satisfied without any errors. Can you try installing a newer version of Node? Let me know.

Resources