Adds support for Roslyn / Mono C# 7. (#20)
This commit is contained in:
parent
5df5b61221
commit
fad41140d1
8 changed files with 103 additions and 356 deletions
|
|
@ -219,7 +219,7 @@ namespace Server
|
|||
|
||||
DeleteFiles( "Scripts.CS*.dll" );
|
||||
|
||||
using ( CSharpCodeProvider provider = new CSharpCodeProvider() )
|
||||
using (CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp"))
|
||||
{
|
||||
string path = GetUnusedPath( "Scripts.CS" );
|
||||
|
||||
|
|
@ -233,32 +233,33 @@ namespace Server
|
|||
if( Core.HaltOnWarning )
|
||||
parms.WarningLevel = 4;
|
||||
|
||||
#if !MONO
|
||||
if (Core.Unix)
|
||||
{
|
||||
parms.CompilerOptions = String.Format("{0} /nowarn:169,219,414 /recurse:Scripts/*.cs", parms.CompilerOptions);
|
||||
files = new string[0];
|
||||
}
|
||||
|
||||
CompilerResults results = provider.CompileAssemblyFromFile( parms, files );
|
||||
#else
|
||||
parms.CompilerOptions = String.Format( "{0} /nowarn:169,219,414 /recurse:Scripts/*.cs", parms.CompilerOptions );
|
||||
CompilerResults results = provider.CompileAssemblyFromFile( parms, "" );
|
||||
#endif
|
||||
m_AdditionalReferences.Add( path );
|
||||
|
||||
Display( results );
|
||||
|
||||
#if !MONO
|
||||
if( results.Errors.Count > 0 )
|
||||
if ( results.Errors.Count > 0 )
|
||||
{
|
||||
assembly = null;
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if( results.Errors.Count > 0 ) {
|
||||
foreach( CompilerError err in results.Errors ) {
|
||||
if ( !err.IsWarning ) {
|
||||
if (!Core.Unix) {
|
||||
assembly = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (CompilerError err in results.Errors)
|
||||
{
|
||||
if (!err.IsWarning)
|
||||
{
|
||||
assembly = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if( cache && Path.GetFileName( path ) == "Scripts.CS.dll" )
|
||||
|
|
@ -359,7 +360,7 @@ namespace Server
|
|||
|
||||
DeleteFiles( "Scripts.VB*.dll" );
|
||||
|
||||
using ( VBCodeProvider provider = new VBCodeProvider() )
|
||||
using (CodeDomProvider provider = CodeDomProvider.CreateProvider("VisualBasic"))
|
||||
{
|
||||
string path = GetUnusedPath( "Scripts.VB" );
|
||||
|
||||
|
|
@ -373,15 +374,32 @@ namespace Server
|
|||
if( Core.HaltOnWarning )
|
||||
parms.WarningLevel = 4;
|
||||
|
||||
if (Core.Unix)
|
||||
{
|
||||
parms.CompilerOptions = String.Format("{0} /nowarn:169,219,414 /recurse:Scripts/*.vb", parms.CompilerOptions);
|
||||
files = new string[0];
|
||||
}
|
||||
|
||||
CompilerResults results = provider.CompileAssemblyFromFile( parms, files );
|
||||
m_AdditionalReferences.Add( path );
|
||||
|
||||
Display( results );
|
||||
|
||||
if( results.Errors.Count > 0 )
|
||||
if ( results.Errors.Count > 0 )
|
||||
{
|
||||
assembly = null;
|
||||
return false;
|
||||
if (!Core.Unix) {
|
||||
assembly = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (CompilerError err in results.Errors)
|
||||
{
|
||||
if (!err.IsWarning)
|
||||
{
|
||||
assembly = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( cache && Path.GetFileName( path ) == "Scripts.VB.dll" )
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
|
|
@ -7,7 +8,7 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<NoStandardLibraries>false</NoStandardLibraries>
|
||||
<AssemblyName>RunUO</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
|
|
@ -26,6 +27,8 @@
|
|||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Server</RootNamespace>
|
||||
|
|
@ -85,6 +88,9 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
|
|
@ -242,9 +248,16 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.Targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio AllowExistingFolder="true" />
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
@ -1,3 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/></startup></configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<gcServer enabled="true" />
|
||||
</runtime>
|
||||
<appSettings>
|
||||
<add key="aspnet:RoslynCompilerLocation" value="roslyn"/>
|
||||
</appSettings>
|
||||
<system.codedom>
|
||||
<compilers>
|
||||
<compiler language="c#;cs;csharp" extension=".cs"
|
||||
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
|
||||
warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
|
||||
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
|
||||
warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
<!--Linux users will need to uncomment and modify the following line:-->
|
||||
<!--<dllmap dll="libz" target="/lib/x86_64-linux-gnu/libz.so.1" />-->
|
||||
</configuration>
|
||||
|
|
|
|||
4
Server/packages.config
Normal file
4
Server/packages.config
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.0" targetFramework="net47" />
|
||||
</packages>
|
||||
Loading…
Add table
Add a link
Reference in a new issue