Skip to content

Disable net461 build on non-Windows platforms #13917

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

Closed
wants to merge 1 commit into from

Conversation

roji
Copy link
Member

@roji roji commented Nov 7, 2018

When trying to work on EF Core on Linux, the build is complicated by the fact that some projects target net461. While various workarounds exist for targeting .NET Framework on non-Windows platforms with mono, this is complicated. In addition, while the test infrastructure does contain logic to skip .NET Framework on non-Windows platforms (see test/Directory.Build.props), 3 projects under src do not.

This PR conditionally adds net461 in these 3 projects, only when on Windows. I'm not sure what effects this could have (I don't know the EF Core build system well yet), but it does help me build the project. If this needs to be done in some other way (or is not possible for some reason), please let me know. This is not urgent.

@smitpatel
Copy link
Contributor

What is exact issue you are seeing? We are just compiling on net461 and last I checked it was working fine on Linux /Mac

@ajcvickers
Copy link
Contributor

Interestingly, whenever I dev I temporarily remove all but one TFM to make things faster. I have just been keeping a temporary Directory.Build.Props around for this, but maybe we can make it a configurable switch in some way such that anybody can easily develop just targeting on thing, since I believe this is the most efficient way to work in most cases.

@roji
Copy link
Member Author

roji commented Nov 8, 2018

@smitpatel when trying to build one of these projects (e.g. EFCore.Design) with a simple dotnet build on Linux, I get the error described in dotnet/sdk#335:

/home/roji/.dotnet/sdk/2.2.100-preview2-009404/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/roji/projects/EFCore/src/EFCore.Design/EFCore.Design.csproj]

FWIW I do have mono installed (5.6.0.179, on Ubuntu 18.10). As described in dotnet/sdk#335, there are some workarounds for getting around this and making dotnet SDK use the mono-provided reference assemblies for .NET Framework - but if any such workarounds exist in the EF Core build system they don't seem to be working for me... I wonder why you're not encountering the same error.

Regardless, as @ajcvickers wrote it seems like a good idea to at least disable building .NET Framework in dev mode to make it faster.

@roji
Copy link
Member Author

roji commented Nov 8, 2018

Note: the Ubuntu/MacOS builds are failing because the Oracle provider tests are executed. As all other tests exclude net461 on non-Windows (via Directory.Build.props), it may make sense to do the same for the Oracle tests. I'll wait for your feedback...

@smitpatel smitpatel changed the base branch from release/2.2 to master November 8, 2018 07:55
@natemcmaster
Copy link
Contributor

An alternative would be to add a reference to Microsoft.NETFramework.ReferenceAssemblies. We were planning on doing this anyways as a part of upgrading tests to .NET 4.7.2. You can see an example of this here: aspnet/HttpSysServer@3e08bf8. The important bit is this:

  <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' ">
    <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="$(MicrosoftNETFrameworkReferenceAssemblies)" PrivateAssets="All" />
  </ItemGroup>

Also, if you upgrade KoreBuild, I added a fix a few days ago to completely skip .NET Framework tests on non-Windows platforms: aspnet/BuildTools@ee0ad5b

@bricelam
Copy link
Contributor

bricelam commented Jan 2, 2019

master is using the NuGet package. Non-Windows machines should be able to build net461 now.

@ajcvickers ajcvickers closed this Jan 7, 2019
@roji roji deleted the no-more-net461 branch February 15, 2019 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants