I am using Microsoft.VisualStudio.SLowCheetah (v3.0.61) package to transform several configuration files to the release version during the build.
Recently i have migrated all projects in the solution from packages.config to package reference format. After that transformations performed by SlowCheetah have broken on the build server. In case of local publishing to the file system from Visual Studio 2017 (v 15.6.7) all is working fine. Previously all targets from SlowCheetah was directly imported in the end of
*.csproj
file. In package reference approach all targets from the used packages are merged to the
obj/PROJECTNAME.csproj.nuget.g.targets
file. This issue affects only Web Project. (Transformations for App.config files in projects with integration tests are working fine.)
I am using next command on the build server for restoring packages:
nuget.exe restore "C:\PATH\Web.Site.sln" -Verbosity Normal -NonInteractive -ConfigFile C:\PATH\NuGet.Config
And next one for building solution:
msbuild.exe "C:\PATH\WizNG.App.Site.sln" /nologo /nr:false /p:DeployOnBuild=true /p:PublishProfile="FileSystem.pubxml" /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="15.0" /m /verbosity:normal
Fragment of csproj file with config files:
<Content Include="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
<TransformOnBuild>true</TransformOnBuild>
</Content>
<None Include="NLog.Debug.config">
<DependentUpon>NLog.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="NLog.Local.config">
<DependentUpon>NLog.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="NLog.Release.config">
<DependentUpon>NLog.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<Content Include="Myconfig1.config">
<SubType>Designer</SubType>
<TransformOnBuild>true</TransformOnBuild>
</Content>
<None Include="Myconfig1.Local.config">
<DependentUpon>Myconfig1.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="Myconfig1.Release.config">
<DependentUpon>Myconfig1.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="Myconfig1.Debug.config">
<DependentUpon>Myconfig1.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
I am using MSBuild v 15.0
UPDATE 1
*.csproj file contains next imports:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
After some investigation i noticed that in case of changing order of import from
Microsoft.CSharp.targets
Microsoft.WebApplication.targets
to
Microsoft.WebApplication.targets
Microsoft.CSharp.targets
transformation begins to work.
Does this change have some other impact ?