When using Make I get an error that C# is outdated

olimatt

Citizen
Jul 30, 2020
12
0
1
Hi all. I've installed mono and the .net core runtime from a tutorial and am using gnome desktop for ubuntu 20.04. When I run the make file I get the same error for two lines in server/utility.cs.

C#:
Feature `default literal' cannot be used because it is not part of the C# 7.0 language specification
Did I do something wrong when setting everything up?
 

Cray

Citizen
Jan 10, 2020
1
0
1
I have the same problem.
Can anyone please help me solve it?

This issue is a combination of the following.
* ServUO Pub 57
* Ubuntu 20.04 and 18.04
* AWS EC2

Bash:
make
mcs -target:library -out:`pwd`/Ultima.dll -r:System.Drawing.dll -nowarn:0618,0219,0414,1635 -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:`pwd`/Ultima/*.cs
mcs -win32icon:`pwd`/Server/servuo.ico -r:`pwd`/Ultima.dll,System.Drawing.dll -nowarn:0618,0219,0414,1635 -target:exe -out:`pwd`/ServUO.exe -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:`pwd`/Server/*.cs
/opt/ServUO/Server/Utility.cs(869,11): error CS1644: Feature `default literal' cannot be used because it is not part of the C# 7.0 language specification
/opt/ServUO/Server/Utility.cs(909,11): error CS1644: Feature `default literal' cannot be used because it is not part of the C# 7.0 language specification
Compilation failed: 2 error(s), 0 warnings
Makefile:35: recipe for target 'ServUO.exe' failed
make: *** [ServUO.exe] Error 1

I've edited Makefile as follows.
But I got an error and could not solve the problem.

Makefile --- Original:
${EXENAME}.exe: Ultima.dll Server/*.cs
    ${MCS} -win32icon:${SRVPATH}/servuo.ico -r:${CURPATH}/Ultima.dll,${REFS} -nowarn:${NOWARNS} -target:exe -out:${CURPATH}/${EXENAME}.exe -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:${SRVPATH}/*.cs
Makefile --- Compiler version specified :
${EXENAME}.exe: Ultima.dll Server/*.cs
    ${MCS} -langversion:latest -win32icon:${SRVPATH}/servuo.ico -r:${CURPATH}/Ultima.dll,${REFS} -nowarn:${NOWARNS} -target:exe -out:${CURPATH}/${EXENAME}.exe -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:${SRVPATH}/*.cs
Bash:
make
mcs -langversion:7.1 -win32icon:`pwd`/Server/servuo.ico -r:`pwd`/Ultima.dll,System.Drawing.dll -nowarn:0618,0219,0414,1635 -target:exe -out:`pwd`/ServUO.exe -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:`pwd`/Server/*.cs
/opt/ServUO/Server/Utility.cs(864,57): error CS0702: A constraint cannot be special class `System.Enum'
/opt/ServUO/Server/Utility.cs(872,79): error CS0702: A constraint cannot be special class `System.Enum'
Compilation failed: 2 error(s), 0 warnings
Makefile:35: recipe for target 'ServUO.exe' failed
make: *** [ServUO.exe] Error 1
 

nacrem

Citizen
Jan 31, 2020
4
0
1
Vorspire, your fix fixed the utility.cs error

Now I'm getting this error. Do you have any idea?

C#:
[[email protected] ServUO]# make
mcs -target:library -out:`pwd`/Ultima.dll -r:System.Drawing.dll -nowarn:0618,0219,0414,1635 -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:`pwd`/Ultima/*.cs
mcs -win32icon:`pwd`/Server/servuo.ico -r:`pwd`/Ultima.dll,System.Drawing.dll -nowarn:0618,0219,0414,1635 -target:exe -out:`pwd`/ServUO.exe -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:`pwd`/Server/*.cs
error CS5001: Program `ServUO.exe' does not contain a static `Main' method suitable for an entry point
Compilation failed: 1 error(s), 0 warnings
make: *** [ServUO.exe] Error 1
 

nacrem

Citizen
Jan 31, 2020
4
0
1
Code in Makefile is

C#:
Ultima.dll: Ultima/*.cs
    ${MCS} -target:library -out:${CURPATH}/Ultima.dll -r:${REFS} -nowarn:${NOWARNS} -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:${SDKPATH}/*.cs

${EXENAME}.exe: Ultima.dll Server/*.cs
    ${MCS} -win32icon:${SRVPATH}/servuo.ico -r:${CURPATH}/Ultima.dll,${REFS} -nowarn:${NOWARNS} -target:exe -out:${CURPATH}/${EXENAME}.exe -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:${SRVPATH}/*.cs

${EXENAME}.sh: ${EXENAME}.exe
    echo "#!/bin/sh" > ${CURPATH}/${EXENAME}.sh
    echo "mono ${CURPATH}/${EXENAME}.exe" >> ${CURPATH}/${EXENAME}.sh
    chmod a+x ${CURPATH}/${EXENAME}.sh
    sed -i.bak -e 's/<!--//g; s/-->//g' ${EXENAME}.exe.config