RicoSuter / DNT

DNT (DotNetTools): Command line tools to manage .NET projects and solutions.
MIT License
421 stars 64 forks source link

Issues when using DNT with newest Visual Studio Build Tools 17.8.0 #136

Open meister-d opened 1 year ago

meister-d commented 1 year ago

Hi, we're using dnt to switch our solution from packages to projects in a Azure DevOps Build Pipeline. After updating the VS Build Tools to version 17.8.0 (.net 8) DNT is failing with the message below:

DNT (DotNetTools, https://github.com/RSuter/DNT, v1.8.3.0)
Binary: C:\Windows\ServiceProfiles\NetworkService\.dotnet\tools\.store\dnt\1.8.3\dnt\1.8.3\tools\net7.0\any\dnt.dll

System.InvalidOperationException: No instances of MSBuild could be detected.
Try calling RegisterInstance or RegisterMSBuildPath to manually register one.
   at Microsoft.Build.Locator.MSBuildLocator.RegisterDefaults()
   at Dnt.Program.Main(String[] args) in C:\projects\dnt\src\Dnt\Program.cs:line 29

Is there a new version for .net 8 already planned? Can't wait to update my Self Hosted Build agent to the newest version :-)

Regards meister-d

hardikce015 commented 1 year ago

I am also facing similar problem is it due to VS update?

mcretief commented 1 year ago

Having the same problem after updating to VS 17.8.0. Seems the issue is DNT is specifically only targeting up to .net 7 currently.

hardikce015 commented 1 year ago

it is possible that the environment variables are affected and DNT is not able to locate the path of the same

ssteiner commented 1 year ago

I managed to do a .NET 8 build. changed the TargetFrameworks to net8.0 in both projects (Dnt.Commands and Dnt), adapted to changes when removing the outdated Nuget packages. Not too hard, if it helps I can fork and upload my changes.

lucaritossa commented 1 year ago

Waiting for a new version of DNT with .NET 8 target.

In the meantime I found a workaround in my machine: since DNT currently is targeting <TargetFrameworks>netcoreapp3.1;net6.0;net7.0</TargetFrameworks> I decided to install .NET6 SDK.

After that DNT returned to work.

thedacheng commented 10 months ago

I am having the same issue. @ssteiner can you share your changes with a PR?

sturlath commented 3 months ago

Installing the .NET 6.0 SDK is a valid workaround but it would be better to have a new version with this fixed. @ssteiner could you submit a PR if you have it ready?

ssteiner commented 2 months ago

@sturlath : I'm now using version 1.9.0.0 which supports .NET 8 natively. Not using my fork anymore - so I don't see the need for a PR. Or do you want to make your own build anyway?