Closed kimbirkelund closed 4 years ago
@kimbirkelund thank you for this suggestion! I agree it would be a good feature to have.
I added <RollForward>Major</RollForward>
in https://github.com/nil4/dotnet-transform-xdt/commit/78372c6976369c152701e90f8de5b5b206e9d538 and can see that after build, the value is included in dotnet-xdt.runtimeconfig.json
:
{
"runtimeOptions": {
"tfm": "netcoreapp2.1",
"rollForward": "Major",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "2.1.0"
}
}
}
Would you be up for helping me confirm that this works for you? You can download the artifacts of the build with this change here:
Cool.
It works as expected 👍
Thanks for checking! I plan to release a new 2.2.0 version in the next few days.
No problem. Looking forward to it 👍
@kimbirkelund the 2.2.0 packages are published to NuGet, but it may take a few hours until they are listed. The tool package (https://www.nuget.org/packages/dotnet-xdt/2.2.0) includes this change.
I'm still truggling with this. I had this completely working for a .NET core 2.0 project with .NET core 2.0 run time installed. Our IT department is pushing to remove .NET core 2.0 and move to .NET core 3.x. My project is setup like this:
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Xdt.Tools" Version="2.0.0" />
</ItemGroup>
<Target Name="ApplyXdtConfigTransform" BeforeTargets="_CopyAppConfigFile">
<PropertyGroup>
<_SourceWebConfig>$(MSBuildThisFileDirectory)app.config</_SourceWebConfig>
<_XdtTransform>$(MSBuildThisFileDirectory)App.$(Configuration).config</_XdtTransform>
<_TargetWebConfig>$(IntermediateOutputPath)$(TargetFileName).config</_TargetWebConfig>
</PropertyGroup>
<Exec Command="dotnet transform-xdt --xml "$(_SourceWebConfig)" --transform "$(_XdtTransform)" --verbose --output "$(_TargetWebConfig)"" Condition="Exists('$(_XdtTransform)')" />
<ItemGroup>
<AppConfigWithTargetPath Remove="App.config" />
<AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
<TargetPath>$(TargetFileName).config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>
</Target>
I've tried upgrading the version to 2.2.0 but that doesn't seem to be available? Help appreciated.
@elangelo the latest version of the Microsoft.DotNet.Xdt.Tools
package is still 2.0.0, published in 2017. That won't work on newer .NET Core runtimes.
The discussion in this issue is about dotnet-xdt
, a global (as opposed to project-level) tool which does run with newer .NET Core. See the release details https://github.com/nil4/dotnet-transform-xdt/releases/tag/v2.2.0 and the documentation at https://github.com/nil4/dotnet-transform-xdt#-global-tool-for-net-core-21-and-later--
What you can do for your project is:
dotnet tool install -g dotnet-xdt
to install the global tool (you only need to do this once)dotnet-xdt
successfully in your project folder<DotNetCliToolReference Include="Microsoft.DotNet.Xdt.Tools" Version="2.0.0" />
from your project<Exec Command="dotnet transform-xdt [...]
to <Exec Command="dotnet-xdt [...]
Now that .NET Core 3.1 is out it would be nice if the tool could be run without requiring .NET Core 2.x to be installed.
With 3.0 a new project property
RollForward
was introduced, and setting it toMajor
allows running to tool on a newer major version than what it was built for. See here for more details.