DNT icon indicating copy to clipboard operation
DNT copied to clipboard

Issues when using DNT with newest Visual Studio Build Tools 17.8.0

Open meister-d opened this issue 1 year ago • 8 comments

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

meister-d avatar Nov 21 '23 12:11 meister-d

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

hardikce015 avatar Nov 22 '23 12:11 hardikce015

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.

mcretief avatar Nov 23 '23 05:11 mcretief

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

hardikce015 avatar Nov 23 '23 05:11 hardikce015

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.

ssteiner avatar Nov 28 '23 09:11 ssteiner

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.

lucaritossa avatar Nov 30 '23 13:11 lucaritossa

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

thedacheng avatar Feb 05 '24 19:02 thedacheng

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?

sturlath avatar Aug 19 '24 10:08 sturlath