-
Notifications
You must be signed in to change notification settings - Fork 0
/
building.htm
139 lines (114 loc) · 5.58 KB
/
building.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<title>How to compile solutions and projects with assemblies (executables and dynamic libraries) ?</title>
</head>
<body><a href="https://github.com/ArsenShnurkov/gentoo-mono-handbook"><img alt="Fork me on GitHub" id="forkme" src="images/forkme.png" align="right" width="100" /></a>
<table><tr><td valign="top">
<h1>How to compile solutions and projects with assemblies (executables and dynamic libraries) ?</h1>
</td><td valign="top">
<a href="index.htm">Gentoo Mono Handbook</a>
</td></tr></table>
<br />
<a href="https://devmanual.gentoo.org/eclass-reference/dotnet.eclass/index.html">dotnet.eclass reference</a>
<br />
<br />
<a href="https://github.com/gentoo/dotnet/blob/master/eclass/dotnet.eclass#L81-L85">https://github.com/gentoo/dotnet/blob/master/eclass/dotnet.eclass#L81-L85</a>
<pre><xmp>
# @FUNCTION: exbuild
# @DESCRIPTION: run xbuild with Release configuration and configurated FRAMEWORK
exbuild() {
xbuild "${1}" /p:Configuration=Release /tv:4.0 /p:TargetFrameworkVersion=v"${FRAMEWORK}" || die
}
</xmp></pre>
<h2>About properties</h2>
<a href="https://msdn.microsoft.com/en-us/library/ms171458.aspx">MSBuild Properties</a>,
<a href="https://msdn.microsoft.com/en-us/library/ms164288.aspx"><Property ...> Element</a>,
<a href="https://msdn.microsoft.com/en-us/library/t4w159bs.aspx"><PropertyGroup ...> Element</a>
<h2>Typical error messages</h2>
could not import "$(MSBuildBinPath)\Microsoft.CSharp.Targets"
<br />
<br />
# find /usr/lib/mono -name "Microsoft.CSharp.targets"
<br />
/usr/lib/mono/xbuild/12.0/bin/Microsoft.CSharp.targets
<br />
/usr/lib/mono/xbuild/14.0/bin/Microsoft.CSharp.targets
<br />
/usr/lib/mono/4.5/Microsoft.CSharp.targets
<br />
<br />
if 4.5 is set the error is
<br />
MSBUILD: error MSBUILD0000: Unknown tools version: '4.5' . Known versions: '2.0' '3.0' '3.5' '4.0' '12.0'
<br />
if 12.0 is set, then
<br />
could not import "$(MSBuildBinPath)\Microsoft.CSharp.Targets"
<br />
<br />
<a href="https://msdn.microsoft.com/en-us/library/bb383796.aspx">https://msdn.microsoft.com/en-us/library/bb383796.aspx</a>
<br />
Toolset properties specify the paths of the tools.
MSBuild uses the value of the ToolsVersion attribute in the project file to locate the corresponding registry key,
and then uses the information in the registry key to set the Toolset properties.
<h2>Framework profiles</h2>
<a href="http://manpages.ubuntu.com/manpages/utopic/man1/xbuild.1.html">http://manpages.ubuntu.com/manpages/utopic/man1/xbuild.1.html</a>
<pre>
<u>XBUILD_FRAMEWORK_FOLDERS_PATH</u>
With ToolsVersion 4.0, projects can target arbitrary frameworks
referenced by TargetFrameworkMoniker, which is of the format:
Identifier,Version=<version>[,Profile=<profile>]
Eg. ".NETFramework,Version=v4.0"
The 3 parts of the moniker are given by the msbuild properties:
$(TargetFrameworkIdentifier), $(TargetFrameworkVersion) and
$(TargetFrameworkProfile)
This moniker maps to a framework description file on disk:
<framework_root>/Identifier/Version/[Profile]/RedistList/FrameworkList.xml
This file is used to determine the path where to find the
framework assemblies for this particular framework.
Framework root here is configurable and is resolved in the
following order:
1. Paths specified in the environment variable $XBUILD_FRAMEWORK_FOLDERS_PATH
2. /Library/Frameworks/Mono.framework/External/xbuild-frameworks on Mac OSX.
3. MSBuild property $(TargetFrameworkRoot)
4. $prefix/lib/mono/xbuild-frameworks (default location)
XBuild tries the paths given above, in order, till it finds a
FrameworkList.xml for the moniker. Running with /v:detailed or
higher verbosity will show the various paths that it tries.
The FrameworkList.xml itself just has a root element like:
<FileList Name=".NET Framework 3.5"
TargetFrameworkDirectory="..\..\..\..\3.5"
IncludeFramework="v3.0">
</FileList>
Here the TargetFrameworkDirectory attribute specifies the
directory where the assemblies for this particular framework can
be found. If this is not set, then the parent of the folder
containing the xml file is taken as the framework directory.
IncludeFramework attribute specifies the version of a framework
(under the *same* $(TargetFrameworkIdentifier)) which should be
included in the final list of Target framework directories.
</pre>
<h2>Variables of .csproj files</h2>
<a href="https://msdn.microsoft.com/en-us/library/ms164309.aspx">https://msdn.microsoft.com/en-us/library/ms164309.aspx</a>
<br />
MSBuildBinPath
<br />
<br />
The absolute path of the folder where the MSBuild binaries that are currently being used are located (for example, C:\Windows\Microsoft.Net\Framework\versionNumber). This property is useful if you have to refer to files in the MSBuild directory.
<br />
Do not include the final backslash on this property.
<br />
<br />
MSBuildProjectDirectory
<br />
MSBuildProjectFile
<br />
MSBuildProjectFullPath
<br />
MSBuildProjectName
<br />
MSBuildToolsVersion
</body>
</html>