Unable to build the Asp.Net 5 web app on Mac - asp.net

I installed all the packages and tools from get.asp.net on new Mac.
When I create a new Web app and run dnu build command I get bellow error. Any thoughts how to fix it?
Logs: https://gist.github.com/prashantvc/73e1e9b5c71b26b2ba0e
Update 7-Dec-2015
dnu restore execute worked fine, output and project.json is here https://gist.github.com/prashantvc/9c0230f7fe058e80be2c
But, I am still not able to build the project :(

Related

dotnet build stopped working after VS 2022 upgrade

I upgraded Visual Studio Community to the final release, and it stopped working. Specifically, I could generate a new project, but when I try to load it, it gave me an error
Critical Project 'SdkTest' load failed| [MSB4236] The SDK 'Microsoft.NET.Sdk.Web' specified could not be found. ...\SdkTest.csproj
Even though build and run worked fine
I ran "repair" on VS2022, and it seems to be working now from Visual Studio. However, dotnet --info doesn't show any SDKs; only runtime; and dotnet build or dotnet new give an error:
C:\Code>dotnet new console -o myapp
Could not execute because the application was not found or a compatible .NET SDK is not installed.
Possible reasons for this include:
* You intended to execute a .NET program:
The application 'new' does not exist.
* You intended to execute a .NET SDK command:
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download
I even reinstalled .NET 6 and I see it in the list of applications (along with older SDKs). I checked the path, and I see everything that I expect to see:
C:\Program Files (x86)\dotnet\
C:\Program Files\dotnet\
C:\Users\me\.dotnet\tools
I am running Windows 11.
It's known bug in VS2022 installation.
Problem is that dotnet you access is located inside Program Files(x86)/dotnet, but all sdk's are located in Program Files/dotnet. You simply need to edit PATH environment variable so Program Files/dotnet goes before Program Files(x86)/dotnet. If you don't see Program Files(x86)/dotnet in user environment variable (which is likely to happen) then edit system environment variable (located below)
Example with screenshots: https://stackoverflow.com/a/44272417/10339675

Nothing to do. None of the projects specified contain packages to restore dotnet restore

I am working on an ASP.NET Web API 2 project with .NET target framework 4.6.1. I am trying to setup github workflow for my repo. When the dotnet restore command is run, it throws an error like below.
I am getting the same error if I run the same command in from command prompt inside my project. Also if I run dotnet build, it shows below error.
The project builds fine from Visual Studio but not working from command line or github workflow yml. Can anyone please point me on what am I missing?
The project builds fine from Visual Studio but not working from command line
Check which sln file Visual Studio is using to build your project.
Since I don't see any sln/csproj in your GitHub repository, it is also possible that you have a .gitignore which would prevent adding those in the first place.
DOTNET Restore does not support pacakges.config https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-restore
So you have to move the nuget package references to csproj file itself
Here is a great comment on how to do that https://stackoverflow.com/a/65701746/8318698
Note: check that if multiple projectGuid is there on csproj at the end of the steps
After that you will be able to use dotnet restore without a hitch.

VSCode hangs when attempting to build dotnet project

I had been using Visual Studio Code with a netcore 3.1 project without any issues.
After being away for about a week, I tried to continue development. However, when I run the build task from VSCode, the terminal shows
> Executing task: dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary <
and hangs indefinitely. Running dotnet build from the console works fine.
How can I use VSCode for debugging again?
This was a general issue with the terminal, and not specific to dotnet.
A temporary fix was to run vscode from the terminal (instead of clicking the desktop icon).
After system upgrades and restarting this problem disappeared.

New project xamarin.form prism Error NETSDK1004 - Prism 2.2.1

when generating a new project xamarin.form prism I get this error when running. With the previous version 2.1.7 it worked for me OK.
It does not allow me to open the Nuget Package since it also gives an error.
Any recommendation?
I saw the 2 posts of this error but they do not apply to me.
Error NETSDK1004 Assets file 'C:\Empresas\Job_Facu\Job\Job.Prism\Job.Prism\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. Job.Prism C:\Program Files\dotnet\sdk\3.1.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 234
The error tells you what to do. Run a NuGet restore. Visual Studio should help you do this automatically. Note that if this occurred after updating dependencies sometimes Visual Studio gets confused and it's best to close Visual Studio and reopen it. This usually gets it to refresh itself so you get the updated package restore.
If that's not working for you, you can download the latest nuget.exe and from the command line navigate to the solution directory and execute the command {path to nuget.exe} restore.
When NuGet performs a restore it generates the project.assets.json file in the obj folder of each project it has restored. This in turn provides MSBuild with the reference information it needs to properly reference your dependencies like Prism and Xamarin.Forms.
I have recently ran into similar issue as well, seemingly out of the blue. I believe upgrading my build machine to the latest VS version (VS for Mac 8.10.4 (build 11))
NETSDK1004: */project.assets.json' not found. Run a NuGet package restore to generate this file.
To fix, I had to run Nuget Restore twice. Once for the shared project directory and once for the iOS project.
If I run the restore just for the Shared/(main.sln file) project directory I get the error.
If I run the restore for the iOS project the build passes but IPA file isn't created.
Need to run both.
Modules used for CI/CD build in Azure Devops Pipeline

dnu restore returns path error ''/Users/<account name>/.dnx/packages/Microsoft.AspNet.IISPlatformHandler/1.0.0-rc1-final' is denied.' on OS X

I've been trying to follow along the OS X ASP.NET 5 guide Your first ASP.NET 5 Application on a Mac.
I set up my environment following the Installing ASP.NET 5 on Mac OS X guide using the command line and installing DNX for .NET Core.
Yeoman has successfully scaffolded my app and when I get to the next step and run dnu restore I get the following path error.
Restore failed
Access to the path
'/Users/simon/.dnx/packages/Microsoft.AspNet.IISPlatformHandler/1.0.0
-rc1-final' is denied.
Full output from dnu restore is here: https://gist.github.com/simonneedham/aed410bbb31a98427164
Anyone have any pointers?
As per chat with Victor below. The resolution was
Delete my entire ~/.dnx folder and delete my project.lock.json file.
Make sure my .net execution environment is up to date. I was trying to run on coreclr so I ran dnvm upgrade -r -coreclr
Then run dnu restore to recreate the .dnx folder and the packages folder below. This time around the packages folder was re-created with regular permissions that didn't require elevation.

Resources