Skip to content

Use properties for target versions for core and framework #67717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 8, 2022
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
<NetFrameworkToolCurrent>net472</NetFrameworkToolCurrent>
<!-- Don't build for NETFramework during source-build. -->
<NetFrameworkToolCurrent Condition="'$(DotNetBuildFromSource)' == 'true'" />

<TargetFrameworkForNETFrameworkTasks>$(NetFrameworkToolCurrent)</TargetFrameworkForNETFrameworkTasks>
<!-- Don't build for NETFramework during source-build. -->
<TargetFrameworkForNETFrameworkTasks Condition="'$(DotNetBuildFromSource)' == 'true'" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line. That source build check is already covered in line 70.


<TargetFrameworkForNETCoreTasks>$(NetCoreAppToolCurrent)</TargetFrameworkForNETCoreTasks>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/sendtohelix-wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<When Condition="'$(NeedsEMSDK)' == 'true'">
<PropertyGroup>
<NeedsDotNetSdk>true</NeedsDotNetSdk>
<UseDotNetCliVersionFromGlobalJson>true</UseDotNetCliVersionFromGlobalJson>
<!--<UseDotNetCliVersionFromGlobalJson>true</UseDotNetCliVersionFromGlobalJson>-->
<IncludeXHarnessCli>true</IncludeXHarnessCli>
<EnableXHarnessTelemetry>false</EnableXHarnessTelemetry>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,28 @@
<ItemGroup>
<ProjectReference Include="$(RepoTasksDir)AotCompilerTask\MonoAOTCompiler.csproj" />

<PackageFile Include="Sdk\Sdk.props" TargetPath="Sdk" />
<PackageFile Include="build\$(MSBuildProjectName).props" TargetPath="build" />
</ItemGroup>

<Target Name="_PrepareForPack" BeforeTargets="GetPackageFiles">
<PropertyGroup>
<SdkPropsPath>$(IntermediateOutputPath)Sdk.props</SdkPropsPath>
</PropertyGroup>

<ItemGroup>
<_ReplacementValue Include="TargetFrameworkForNETCoreTasks" Value="$(TargetFrameworkForNETCoreTasks)" />
<_ReplacementValue Include="TargetFrameworkForNETFrameworkTasks" Value="$(TargetFrameworkForNETFrameworkTasks)" />
</ItemGroup>

<GenerateFileFromTemplate
TemplateFile="Sdk/Sdk.props.in"
Properties="@(_ReplacementValue)"
OutputPath="$(SdkPropsPath)" />

<ItemGroup>
<PackageFile Include="$(SdkPropsPath)" TargetPath="Sdk" />
</ItemGroup>
</Target>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<MonoAOTCompilerTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tasks\${TargetFrameworkForNETCoreTasks}\MonoAOTCompiler.dll</MonoAOTCompilerTasksAssemblyPath>
<MonoAOTCompilerTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tasks\${TargetFrameworkForNETFrameworkTasks}\MonoAOTCompiler.dll</MonoAOTCompilerTasksAssemblyPath>
</PropertyGroup>
<UsingTask TaskName="MonoAOTCompiler" AssemblyFile="$(MonoAOTCompilerTasksAssemblyPath)" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,28 @@
<PackageFile Include="Sdk\Sdk.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\Sdk.targets" TargetPath="Sdk" />
<PackageFile Include="build\$(MSBuildProjectName).props" TargetPath="build" />
<PackageFile Include="Sdk\MonoTargetsTasks.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\RuntimeComponentManifest.targets" TargetPath="Sdk" />
</ItemGroup>

<Target Name="_PrepareForPack" BeforeTargets="GetPackageFiles">
<PropertyGroup>
<MonoTargetsTasksPropsPath>$(IntermediateOutputPath)MonoTargetsTasks.props</MonoTargetsTasksPropsPath>
</PropertyGroup>

<ItemGroup>
<_ReplacementValue Include="TargetFrameworkForNETCoreTasks" Value="$(TargetFrameworkForNETCoreTasks)" />
<_ReplacementValue Include="TargetFrameworkForNETFrameworkTasks" Value="$(TargetFrameworkForNETFrameworkTasks)" />
</ItemGroup>

<GenerateFileFromTemplate
TemplateFile="Sdk/MonoTargetsTasks.props.in"
Properties="@(_ReplacementValue)"
OutputPath="$(MonoTargetsTasksPropsPath)" />

<ItemGroup>
<PackageFile Include="$(MonoTargetsTasksPropsPath)" TargetPath="Sdk" />
</ItemGroup>
</Target>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<MonoTargetsTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tasks\net6.0\MonoTargetsTasks.dll</MonoTargetsTasksAssemblyPath>
<MonoTargetsTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tasks\net472\MonoTargetsTasks.dll</MonoTargetsTasksAssemblyPath>
<MonoTargetsTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tasks\${TargetFrameworkForNETCoreTasks}\MonoTargetsTasks.dll</MonoTargetsTasksAssemblyPath>
<MonoTargetsTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tasks\${TargetFrameworkForNETFrameworkTasks}\MonoTargetsTasks.dll</MonoTargetsTasksAssemblyPath>
</PropertyGroup>
<!-- ILStrip -->
<UsingTask TaskName="ILStrip" AssemblyFile="$(MonoTargetsTasksAssemblyPath)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,32 @@
<ProjectReference Include="$(RepoTasksDir)WasmAppBuilder\WasmAppBuilder.csproj" />
<ProjectReference Include="$(RepoTasksDir)WasmBuildTasks\WasmBuildTasks.csproj" />

<PackageFile Include="Sdk\Sdk.targets" TargetPath="Sdk" />
<PackageFile Include="Sdk\AutoImport.props" TargetPath="Sdk" />
<PackageFile Include="$(RepoRoot)\src\mono\wasm\build\WasmApp.props" TargetPath="Sdk" />
<PackageFile Include="$(RepoRoot)\src\mono\wasm\build\WasmApp.targets" TargetPath="Sdk" />
<PackageFile Include="$(RepoRoot)\src\mono\wasm\build\WasmApp.Native.*" TargetPath="Sdk" />
<PackageFile Include="$(RepoRoot)\src\mono\wasm\build\EmSdkRepo.Defaults.props" TargetPath="Sdk" />
</ItemGroup>

<Target Name="_PrepareForPack" BeforeTargets="GetPackageFiles">
<PropertyGroup>
<SdkTargetsPath>$(IntermediateOutputPath)Sdk.targets</SdkTargetsPath>
</PropertyGroup>

<ItemGroup>
<_ReplacementValue Include="TargetFrameworkForNETCoreTasks" Value="$(TargetFrameworkForNETCoreTasks)" />
<_ReplacementValue Include="TargetFrameworkForNETFrameworkTasks" Value="$(TargetFrameworkForNETFrameworkTasks)" />
</ItemGroup>

<GenerateFileFromTemplate
TemplateFile="Sdk/Sdk.targets.in"
Properties="@(_ReplacementValue)"
OutputPath="$(SdkTargetsPath)" />

<ItemGroup>
<PackageFile Include="$(SdkTargetsPath)" TargetPath="Sdk" />
</ItemGroup>
</Target>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<!-- Property overrides -->
<PropertyGroup>
<_TasksDir Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tasks\net6.0\</_TasksDir>
<_TasksDir Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tasks\net472\</_TasksDir>
<_TasksDir Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tasks\${TargetFrameworkForNETCoreTasks}\</_TasksDir>
<_TasksDir Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tasks\${TargetFrameworkForNETFrameworkTasks}\</_TasksDir>

<WasmAppBuilderTasksAssemblyPath>$(_TasksDir)WasmAppBuilder.dll</WasmAppBuilderTasksAssemblyPath>
<WasmBuildTasksAssemblyPath>$(_TasksDir)WasmBuildTasks.dll</WasmBuildTasksAssemblyPath>
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/build/WasmApp.InTree.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<Platform>AnyCPU</Platform>
<EnableTargetingPackDownload>false</EnableTargetingPackDownload>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(MonoProjectRoot)' != ''">$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'emsdk'))</EMSDK_PATH>
<RunAOTCompilation Condition="'$(RunAOTCompilation)' == ''">false</RunAOTCompilation>
<PublishTrimmed>true</PublishTrimmed>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Description>Templates to create WebAssembly projects.</Description>
<PackageTags>dotnet-new;templates</PackageTags>

<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>

<IncludeContentInPack>true</IncludeContentInPack>
<IncludeBuildOutput>false</IncludeBuildOutput>
Expand Down
11 changes: 0 additions & 11 deletions src/tasks/Directory.Build.props

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public IpcSocket(AddressFamily addressFamily, SocketType socketType, ProtocolTyp
}

// .NET 6 implements this method directly on Socket, but for earlier runtimes we need a polyfill
#if !NET6_0
#if !NET6_0_OR_GREATER
public async Task<Socket> AcceptAsync(CancellationToken token)
{
using (token.Register(() => Close(0)))
Expand Down Expand Up @@ -63,7 +63,7 @@ public virtual void Connect(EndPoint remoteEP, TimeSpan timeout)
}

// .NET 6 implements this method directly on Socket, but for earlier runtimes we need a polyfill
#if !NET6_0
#if !NET6_0_OR_GREATER
public async Task ConnectAsync(EndPoint remoteEP, CancellationToken token)
{
using (token.Register(() => Close(0)))
Expand Down