Skip to content

Commit

Permalink
Corefx Windows build on .NET Core MSBuild (dotnet/corefx#30675)
Browse files Browse the repository at this point in the history
* Corefx Windows build on .NET Core MSBuild

Note:  Need to move to the 3.0 SDK because the DiaSymReader.Native shipped in .NET Core's shared framework is out of date.  See https://github.com/dotnet/core-setup/issues/4291.

* Workaround .NET Core MSBuild bug.

MSBuild on .NET Core doesn't support non-string resources. However, the ResourceManager tests need to test this scenario. Using the .NET Framework's resgen.exe during the build until the MSBuild bug is fixed.

* Update BuildTools to 2.2.0-preview1-02928-01


Commit migrated from dotnet/corefx@50ba6a2
  • Loading branch information
eerhardt authored Jun 28, 2018
1 parent 7955437 commit ce62cc1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/libraries/DotnetCLIVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.301
3.0.100-preview1-009019
4 changes: 2 additions & 2 deletions src/libraries/Native/build-native.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ if "%__BuildArch%" == "arm64" (
set __msbuildArgs=/p:Platform=%__BuildArch% /p:PlatformToolset="%__PlatformToolset%"
)

call %__rootDir%/run.cmd build-managed -project="%__IntermediatesDir%\install.vcxproj" -- /t:rebuild /p:Configuration=%CMAKE_BUILD_TYPE% %__msbuildArgs%
call msbuild "%__IntermediatesDir%\install.vcxproj" /t:rebuild /p:Configuration=%CMAKE_BUILD_TYPE% %__msbuildArgs%
IF ERRORLEVEL 1 (
goto :Failure
)
Expand All @@ -174,7 +174,7 @@ popd

if not exist "%__IntermediatesDir%\install.vcxproj" goto :Failure

call %__rootDir%/run.cmd build-managed -project="%__IntermediatesDir%\install.vcxproj" -- /t:rebuild /p:Configuration=%CMAKE_BUILD_TYPE% %__msbuildArgs%
call msbuild "%__IntermediatesDir%\install.vcxproj" /t:rebuild /p:Configuration=%CMAKE_BUILD_TYPE% %__msbuildArgs%
IF ERRORLEVEL 1 (
goto :Failure
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,41 @@
<Compile Include="SatelliteContractVersionAttributeTests.cs" />
<Compile Include="MissingSatelliteAssemblyException.cs" />
<Compile Include="ResourceSetTests.cs" />
<EmbeddedResource Include="Resources\TestResx.netstandard17.resx">
<_WorkaroundCoreMSBuildResource Include="Resources\TestResx.netstandard17.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>TestResx.netstandard17.Designer.cs</LastGenOutput>
</EmbeddedResource>
</_WorkaroundCoreMSBuildResource>
<Compile Include="Resources\TestResx.netstandard17.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>TestResx.netstandard17.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\TestResx.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>TestResx.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<!--
MSBuild on .NET Core doesn't support non-string resources.
See https://github.com/Microsoft/msbuild/issues/1352 and https://github.com/Microsoft/msbuild/issues/2221
Workaround this for now by invoking the desktop resgen.exe on Windows.
-->
<Target Name="WorkaroundCoreMSBuildResources"
BeforeTargets="PrepareResources"
Condition="'$(OS)' == 'Windows_NT'">
<PropertyGroup>
<_ResourceRelativeDir>%(_WorkaroundCoreMSBuildResource.RelativeDir)</_ResourceRelativeDir>
<_ResourceRelativeDir>$(_ResourceRelativeDir.TrimEnd('\'))</_ResourceRelativeDir>
<_ResourceOutputName>$(IntermediateOutputPath)$(RootNamespace).$(_ResourceRelativeDir).%(_WorkaroundCoreMSBuildResource.FileName).resources</_ResourceOutputName>
</PropertyGroup>

<Exec Command="resgen.exe %(_WorkaroundCoreMSBuildResource.Identity) $(_ResourceOutputName)" />

<ItemGroup>
<EmbeddedResource Include="$(_ResourceOutputName)"
WithCulture="false"
Type="Non-Resx" />
</ItemGroup>
</Target>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
8 changes: 4 additions & 4 deletions src/libraries/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,12 @@
"msbuild": {
"osSpecific": {
"windows": {
"defaultParameters": "/nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false /l:BinClashLogger,Tools\\net46\\Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log",
"path": "Tools/msbuild.cmd"
"defaultParameters": "msbuild /nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false /l:BinClashLogger,Tools\\Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log",
"path": "Tools/dotnetcli/dotnet"
},
"unix": {
"defaultParameters": "/nologo /verbosity:minimal /clp:Summary /maxcpucount /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log",
"path": "Tools/msbuild.sh"
"defaultParameters": "msbuild /nologo /verbosity:minimal /clp:Summary /maxcpucount /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log",
"path": "Tools/dotnetcli/dotnet"
}
},
"valueTypes": {
Expand Down

0 comments on commit ce62cc1

Please sign in to comment.