Skip to content

Commit a9bf3b3

Browse files
Do not modify .deps.json on OutDir. (#569)
* Do not modify .deps.json con OutDir. Add deps.json and runtime.json to contentFiles directory of nupkg. * Define TargetsForTfmSpecificContentInPackage for executables
1 parent 0e935f1 commit a9bf3b3

File tree

4 files changed

+61
-45
lines changed

4 files changed

+61
-45
lines changed

dotnet/Directory.Build.targets

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@
5858

5959

6060
<Target Name="PostBuild" AfterTargets="Build" Condition="'$(GxGenerateDepsFile)'=='true' AND ('$(TargetFramework)'=='net6.0')">
61+
<MakeDir Directories="$(TargetFramework)"/>
62+
<Exec Command="copy $(OutDir)$(ProjectName).deps.json $(TargetFramework)\$(ProjectName).deps.json" />
6163
<ReplaceFileText
62-
InputFilename="$(OutDir)$(ProjectName).deps.json"
63-
OutputFilename="$(OutDir)$(ProjectName).deps.json"
64+
InputFilename="$(TargetFramework)\$(ProjectName).deps.json"
65+
OutputFilename="$(TargetFramework)\$(ProjectName).deps.json"
6466
MatchExpression="GeneXus\.Classes\.Core"
6567
ReplacementText="GxClasses" />
6668
<ReplaceFileText
67-
InputFilename="$(OutDir)$(ProjectName).deps.json"
68-
OutputFilename="$(OutDir)$(ProjectName).deps.json"
69+
InputFilename="$(TargetFramework)\$(ProjectName).deps.json"
70+
OutputFilename="$(TargetFramework)\$(ProjectName).deps.json"
6971
MatchExpression="GeneXus\.Classes\.Web\.Core"
70-
ReplacementText="GxClasses.Web" />
71-
<MakeDir Directories="$(TargetFramework)"/>
72-
<Exec Command="copy $(OutDir)$(ProjectName).deps.json $(TargetFramework)\$(ProjectName).deps.json" />
72+
ReplacementText="GxClasses.Web"/>
7373
</Target>
7474

7575
<Target Name="CopyAssemblies" Condition="'$(ProjectName)'!='' AND Exists('$(ProjectDir)$(OutDir)$(TargetFileName)')">

dotnet/src/dotnetcore/GxDataInitialization/GXDataInitialization.csproj

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<PackageId>GeneXus.DataInitialization.Core</PackageId>
77
<GxGenerateDepsFile>true</GxGenerateDepsFile>
88
<DefineConstants>NETCORE</DefineConstants>
9+
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);CustomContentTarget</TargetsForTfmSpecificContentInPackage>
910
</PropertyGroup>
1011
<ItemGroup>
1112
<Compile Include="..\..\dotnetframework\GXDataInitialization\GXDataInitialization.cs" Link="GXDataInitialization.cs" />
@@ -21,12 +22,17 @@
2122
<PackagePath>\content\net6.0\</PackagePath>
2223
</Content>
2324
</ItemGroup>
24-
<ItemGroup>
25-
<None Include="$(OutputPath)\net6.0\$(MSBuildProjectName).deps.json">
26-
<PackageCopyToOutput>true</PackageCopyToOutput>
27-
<Pack>true</Pack>
28-
<PackagePath>contentFiles\any\any</PackagePath>
29-
</None>
30-
</ItemGroup>
25+
<Target Name="CustomContentTarget">
26+
<ItemGroup>
27+
<TfmSpecificPackageFile Include="$(OutputPath)\$(MSBuildProjectName).deps.json">
28+
<PackagePath>contentFiles/any/any</PackagePath>
29+
<PackageCopyToOutput>true</PackageCopyToOutput>
30+
</TfmSpecificPackageFile>
31+
<TfmSpecificPackageFile Include="$(OutputPath)\$(MSBuildProjectName).runtimeconfig.json">
32+
<PackagePath>contentFiles/any/any</PackagePath>
33+
<PackageCopyToOutput>true</PackageCopyToOutput>
34+
</TfmSpecificPackageFile>
35+
</ItemGroup>
36+
</Target>
3137

3238
</Project>

dotnet/src/dotnetcore/GxNetCoreStartup/GxNetCoreStartup.csproj

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<GxGenerateDepsFile>true</GxGenerateDepsFile>
77
<NoWarn>$(NoWarn);NU1701</NoWarn>
88
<EnableDefaultContentItems>false</EnableDefaultContentItems>
9+
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);CustomContentTarget</TargetsForTfmSpecificContentInPackage>
910
</PropertyGroup>
1011

1112
<ItemGroup>
@@ -34,12 +35,17 @@
3435
<PackagePath>\content\net6.0\</PackagePath>
3536
</Content>
3637
</ItemGroup>
37-
<ItemGroup>
38-
<None Include="$(OutputPath)\net6.0\$(MSBuildProjectName).deps.json">
39-
<PackageCopyToOutput>true</PackageCopyToOutput>
40-
<Pack>true</Pack>
41-
<PackagePath>contentFiles\any\any</PackagePath>
42-
</None>
43-
</ItemGroup>
38+
<Target Name="CustomContentTarget">
39+
<ItemGroup>
40+
<TfmSpecificPackageFile Include="$(OutputPath)\$(MSBuildProjectName).deps.json">
41+
<PackagePath>contentFiles/any/any</PackagePath>
42+
<PackageCopyToOutput>true</PackageCopyToOutput>
43+
</TfmSpecificPackageFile>
44+
<TfmSpecificPackageFile Include="$(OutputPath)\$(MSBuildProjectName).runtimeconfig.json">
45+
<PackagePath>contentFiles/any/any</PackagePath>
46+
<PackageCopyToOutput>true</PackageCopyToOutput>
47+
</TfmSpecificPackageFile>
48+
</ItemGroup>
49+
</Target>
4450

4551
</Project>
Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFrameworks>net6.0</TargetFrameworks>
4-
<OutputType>Exe</OutputType>
5-
<PackageTags>Reorg</PackageTags>
6-
<PackageId>GeneXus.Reorganization.Core</PackageId>
7-
<DefineConstants>NETCORE</DefineConstants>
8-
<GxGenerateDepsFile>true</GxGenerateDepsFile>
9-
</PropertyGroup>
10-
<ItemGroup>
11-
<Compile Include="..\..\dotnetframework\Reor\frmReorg.cs" Link="frmReorg.cs" />
12-
</ItemGroup>
2+
<PropertyGroup>
3+
<TargetFrameworks>net6.0</TargetFrameworks>
4+
<OutputType>Exe</OutputType>
5+
<PackageTags>Reorg</PackageTags>
6+
<PackageId>GeneXus.Reorganization.Core</PackageId>
7+
<DefineConstants>NETCORE</DefineConstants>
8+
<GxGenerateDepsFile>true</GxGenerateDepsFile>
9+
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);CustomContentTarget</TargetsForTfmSpecificContentInPackage>
10+
</PropertyGroup>
11+
<ItemGroup>
12+
<Compile Include="..\..\dotnetframework\Reor\frmReorg.cs" Link="frmReorg.cs" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<ProjectReference Include="..\GxClasses\GxClasses.csproj"/>
17+
</ItemGroup>
1318

14-
<ItemGroup>
15-
</ItemGroup>
16-
<ItemGroup>
17-
<ProjectReference Include="..\GxClasses\GxClasses.csproj"/>
18-
</ItemGroup>
19-
19+
<Target Name="CustomContentTarget">
20+
<ItemGroup>
21+
<TfmSpecificPackageFile Include="$(OutputPath)\$(MSBuildProjectName).deps.json">
22+
<PackagePath>contentFiles/any/any</PackagePath>
23+
<PackageCopyToOutput>true</PackageCopyToOutput>
24+
</TfmSpecificPackageFile>
25+
<TfmSpecificPackageFile Include="$(OutputPath)\$(MSBuildProjectName).runtimeconfig.json">
26+
<PackagePath>contentFiles/any/any</PackagePath>
27+
<PackageCopyToOutput>true</PackageCopyToOutput>
28+
</TfmSpecificPackageFile>
29+
</ItemGroup>
30+
</Target>
2031
<ItemGroup>
2132
<Content Include="net6.0\$(MSBuildProjectName).deps.json">
2233
<Pack>true</Pack>
2334
<PackagePath>\content\net6.0\</PackagePath>
2435
</Content>
2536
</ItemGroup>
26-
<ItemGroup>
27-
<None Include="$(OutputPath)\net6.0\$(MSBuildProjectName).deps.json">
28-
<PackageCopyToOutput>true</PackageCopyToOutput>
29-
<Pack>true</Pack>
30-
<PackagePath>contentFiles\any\any</PackagePath>
31-
</None>
32-
</ItemGroup>
3337
</Project>

0 commit comments

Comments
 (0)