2

I have a problem creating a project with Visual Studio 2022 Enterprise on Windows 10.

I try to create a project with the template "Angular and ASP.NET Core".

I don't change the default options (.NET 8.0, ...). When creating the project I get the message "The version of Angular CLI was not valid." The template tries to call ng version from the project directory calling c:\Users\<username>\AppData\Roaming\npm\ng.cmd

At home (using Visual Studio Community) all works well - The ASP.NET Core server project gets created, and also the Angular client project. At work (using Visual Studio Enterprise) I get this weird error directly after creating the project. The ASP.NET Core server projects gets created, the client project is completely empty.

I am able to call ng version from command line getting the expected result: Angular CLI: 17.3.2, Node: 20.11.1, npm 10.2.4.

I added some log echos to ng.cmd to make sure the right ng.cmd was called. I uninstalled all components (Angular, Node.js), reinstalled them. I uninstalled Visual Studio Enterprise, installed Visual Studio Community. I tried to install other versions of angular/cli (e.g. 17.1.0). Nothing changed the behavior.

Do you have any ideas?

Thanks and best regards Andy

2 Answers 2

0

Yes , i get also various errors from building asp.net core and angular project. But i use VS 2022 community. I'm trying various version of NODE and Angularbut the best error i get is about Microsoft.VisualStudio.javascript.SDK who is not compiling. I'have also this error "A merge conflicted on path "/angularapp11.client/angular.json"". It's weird ....

Sign up to request clarification or add additional context in comments.

2 Comments

Kindly add as a comment.
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
0

This can happen when your company uses strict group policies which blocks ng.

Open cmd in Windows without administrator rights, enter ng, and press ENTER. You may see an error message stating that ng has been blocked due to group policies.

You can work around this problem if you have administrator rights and start Visual Studio as an administrator. Then you have a good chance of being able to create an Angular project.

At second, some Versions of Visual Studio 2022 provides Angular CLI V17.* and NodeJs V20.*. Open cmd and type 'ng version' to check your current installed versions. A higher installed Version of these both, could lead to your error message.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.