Example of a project sample:
Project file
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<I Include="**/*.$(Extension)"/>
</ItemGroup>
<Target Name="Build">
<Message Text="I: %(I.Identity)"/>
</Target>
</Project>
Directory contents:
N/A
Command line
msbuild /bl
Given the same version of mono (5.4.1.6) and the same version of msbuild (15.4.0.0) I expect the build to either succeed in both OSX and Linux (CentOS) environment or fail.
It succeeds on OSX, but on Linux it fails with:
/usr/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1138,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.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.
msbuild /version output:15.4.0.0
ls -l /usr/lib/mono/xbuild/ExtensionsPath/Microsoft/Microsoft.NET.Build.Extensions/
total 16
-rw-r--r--. 1 root root 2862 Oct 12 12:21 Microsoft.NET.Build.Extensions.ConflictResolution.targets
-rw-r--r--. 1 root root 6695 Oct 12 12:21 Microsoft.NET.Build.Extensions.NETFramework.targets
-rw-r--r--. 1 root root 2231 Oct 12 12:21 Microsoft.NET.Build.Extensions.targets
drwxr-xr-x. 4 root root 26 Oct 12 12:21 net461
drwxr-xr-x. 4 root root 26 Oct 12 12:21 net462
drwxr-xr-x. 4 root root 26 Oct 12 12:21 net47
drwxr-xr-x. 2 root root 16 Nov 16 16:48 net471
drwxr-xr-x. 3 root root 18 Oct 12 12:21 tools
msbuild /version output:
Microsoft (R) Build Engine version 15.4.0.0 (master/f296e67b Wed Oct 18 09:47:05 EDT 2017) for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
15.4.0.0
ls -ls /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/
total 32
8 -rw-r--r-- 1 root admin 2862 Oct 18 09:49 Microsoft.NET.Build.Extensions.ConflictResolution.targets
16 -rw-r--r-- 1 root admin 6695 Oct 18 09:49 Microsoft.NET.Build.Extensions.NETFramework.targets
8 -rw-r--r-- 1 root admin 2231 Oct 18 09:49 Microsoft.NET.Build.Extensions.targets
0 drwxr-xr-x 4 root admin 128 Oct 18 09:49 net461
0 drwxr-xr-x 4 root admin 128 Oct 18 09:49 net462
0 drwxr-xr-x 4 root admin 128 Oct 18 09:49 net47
0 drwxr-xr-x 3 root admin 96 Oct 18 09:49 net471
0 drwxr-xr-x 3 root admin 96 Oct 18 09:49 tools
OS info:
cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
Ok, I tried export FrameworkPathOverride=/lib/mono/4.5 and the compilation now succeeds on Linux.
I had this environment variable set on my OSX machine to get my other (Core SDK) projects compiling and apparently that's what was letting this project to compile.
Most helpful comment
Ok, I tried
export FrameworkPathOverride=/lib/mono/4.5and the compilation now succeeds on Linux.I had this environment variable set on my OSX machine to get my other (Core SDK) projects compiling and apparently that's what was letting this project to compile.