nil4 / dotnet-transform-xdt

Modern .NET tools and library for XDT (Xml Document Transformation)
Apache License 2.0
118 stars 12 forks source link

Version for package `Microsoft.Dotnet.Xdt.Tools` could not be resolved. #36

Closed Grompot77 closed 5 years ago

Grompot77 commented 5 years ago

Hi

Since adding the dotnet 2.2 SDK, I am unable to run the dotnet transform-xdt commands. All that I am getting is Version for package Microsoft.Dotnet.Xdt.Tools could not be resolved.

I do have the following: `

` And have the following as a build requirement:

`` `<_SourceConfig>$(MSBuildThisFileDirectory)nlogbase.config` `<_XdtTransform>$(MSBuildThisFileDirectory)nlogbase.$(Configuration).config` `<_TargetConfig>$(TargetDir)nlog.config` `` `` `` It works 100% when I uninstall 2.2 SDK Apart from the web.*.config that has to be transformed, we create nlog.config files per environment using the transformation tool. Any corrective measures that can be done?
nil4 commented 5 years ago

Does it help if you run dotnet restore explicitly before building? Perhaps try deleting the obj folders in your project/solution before running dotnet restore.

If that does not help, please run dotnet nuget locals all --clear then dotnet restore again.

It is usually a good idea to always force a restore explicitly when changing the installed .NET Core version.

I tried to reproduce this with .NET Core 2.2.202 (as output by dotnet --version) but I wasn't able to.

If none of the above works for you, can you try your repro on one of the projects in my simple XDT samples repo, and share your dotnet --version output, and the results your are seeing?

Grompot77 commented 5 years ago

i will have a look again, i did:

  1. clear the local caches before the obj directory.
  2. force a package restore
  3. build and still failed

only when uninstalling the netcore 2.0 sdk's it worked again

for now here is my version C:>dotnet --version 2.2.202

Grompot77 commented 5 years ago

Thank you for the response, i have now done it purely from the command line and all worked. [XDT] Transforming 'nlogbase.config' using 'nlogbase.debug.config' into 'bin\debug\netcoreapp2.1\nlog.config'

Another question, is it still compatible if we look at netcore 3.0 previews ... i can not see why it should not work

nil4 commented 5 years ago

@Grompot77 glad to hear that it worked from the command line in the end! That's the result I was seeing as well.

I believe the tool should remain compatible with 3.x, but I have not explicitly tested that scenario yet; I am waiting for an RC or final version to be available.

Given the announcement at https://github.com/dotnet/announcements/issues/107, I would expect this tool to continue working, because it already matches the emphasized part below:

.NET Core 3 takes the next step in the .NET Core tool strategy with local tools. As part of this process, starting in Preview 4 DotNetCliToolReference tools will be restricted to targeting .NET Core 2.2 and below. DotNetCliToolReference tools can be used in projects targeting .NET Core 3.0, but the tools themselves should target .NET Core 2.2 or below.

Grompot77 commented 5 years ago

just ran it from the command line with 3.0.100-preview5-011568 SDK on the existing project targeting 2.1.3 LTS, that worked as well

nil4 commented 5 years ago

@Grompot77 that's very good to hear, thanks a lot for trying it out!