You've already forked linux-packaging-mono
Imported Upstream version 5.16.0.100
Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
parent
0a9828183b
commit
7d7f676260
@@ -2,10 +2,9 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<PreReleaseLabel>preview1</PreReleaseLabel>
|
||||
<PackageVersion>1.1.0</PackageVersion>
|
||||
<PackageVersion>2.0.0</PackageVersion>
|
||||
<SkipValidatePackage>true</SkipValidatePackage>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||
<AssemblyFileVersion>$(AssemblyVersion)</AssemblyFileVersion>
|
||||
<AssemblyKey>Open</AssemblyKey>
|
||||
</PropertyGroup>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<_SerializerDllIntermediateFolder>$(IntermediateOutputPath)$(_SerializationAssemblyName).dll</_SerializerDllIntermediateFolder>
|
||||
<_SerializerPdbIntermediateFolder>$(IntermediateOutputPath)$(_SerializationAssemblyName).pdb</_SerializerPdbIntermediateFolder>
|
||||
<_SerializerCsIntermediateFolder>$(IntermediateOutputPath)$(_SerializationAssemblyName).cs</_SerializerCsIntermediateFolder>
|
||||
<_SGenWarningText>SGEN : warning SGEN1: Fail to generate the serializer for $(AssemblyName)$(TargetExt). Please follow the instructions at https://go.microsoft.com/fwlink/?linkid=858594 and try again.</_SGenWarningText>
|
||||
<_SGenWarningText>SGEN: Fail to generate the serializer for $(AssemblyName)$(TargetExt). Please follow the instructions at https://go.microsoft.com/fwlink/?linkid=858594 and try again.</_SGenWarningText>
|
||||
<_SerializationAssemblyDisabledWarnings>$(NoWarn);219;162;$(SerializationAssemblyDisabledWarnings)</_SerializationAssemblyDisabledWarnings>
|
||||
</PropertyGroup>
|
||||
<Target Name="GenerateSerializationAssembly" AfterTargets="Build">
|
||||
@@ -12,7 +12,7 @@
|
||||
<Delete Condition="Exists('$(_SerializerPdbIntermediateFolder)') == 'true'" Files="$(_SerializerPdbIntermediateFolder)" ContinueOnError="true"/>
|
||||
<Delete Condition="Exists('$(_SerializerCsIntermediateFolder)') == 'true'" Files="$(_SerializerCsIntermediateFolder)" ContinueOnError="true"/>
|
||||
<Message Text="Running Serialization Tool" Importance="normal" />
|
||||
<Exec Command="dotnet Microsoft.XmlSerializer.Generator $(IntermediateOutputPath)$(AssemblyName)$(TargetExt) /force /quiet" ContinueOnError="true"/>
|
||||
<Exec Command="dotnet Microsoft.XmlSerializer.Generator "$(IntermediateOutputPath)$(AssemblyName)$(TargetExt)" --force --quiet --reference "@(Reference)"" ContinueOnError="true"/>
|
||||
<Warning Condition="Exists('$(_SerializerCsIntermediateFolder)') != 'true'" Text="$(_SGenWarningText)" />
|
||||
<Csc Condition="Exists('$(_SerializerCsIntermediateFolder)') == 'true'" ContinueOnError="true" OutputAssembly="$(_SerializerDllIntermediateFolder)" References="@(ReferencePath);@(IntermediateAssembly)" EmitDebugInformation="$(DebugSymbols)" Sources="$(_SerializerCsIntermediateFolder)" TargetType="Library" ToolExe="$(CscToolExe)" ToolPath="$(CscToolPath)" DisabledWarnings="$(_SerializationAssemblyDisabledWarnings)"/>
|
||||
<Warning Condition="Exists('$(_SerializerDllIntermediateFolder)') != 'true' And Exists('$(_SerializerCsIntermediateFolder)') == 'true'" Text="$(_SGenWarningText)"/>
|
||||
@@ -43,10 +43,10 @@
|
||||
<Delete Files="%(_ReferenceSerializerIntermediateFolder.Identity).cs" ContinueOnError="true"/>
|
||||
<Delete Files="%(_ReferenceSerializerIntermediateFolder.Identity).pdb" ContinueOnError="true"/>
|
||||
<Message Text="Running Serialization Tool for Reference Assembly" Importance="normal" />
|
||||
<Exec Command="dotnet Microsoft.XmlSerializer.Generator /force /quiet /assembly:%(_TargetSerializationAssembly.Identity) /type:%(_TargetSerializationAssembly.SerializationTypes) /out:$(IntermediateOutputPath)" ContinueOnError="true" />
|
||||
<Warning Condition="Exists('$(IntermediateOutputPath)%(_ReferenceSerializationAssemblyName.Identity).cs') != 'true'" Text="SGEN : warning SGEN1: Fail to generate %(_ReferenceSerializationAssemblyName.Identity)'. Please follow the instructions at https://go.microsoft.com/fwlink/?linkid=858594 and try again." />
|
||||
<Exec Command="dotnet Microsoft.XmlSerializer.Generator --force --quiet --reference "@(Reference)" --assembly "%(_TargetSerializationAssembly.Identity)" --type %(_TargetSerializationAssembly.SerializationTypes) --out "$(IntermediateOutputPath)"" ContinueOnError="true" />
|
||||
<Warning Condition="Exists('$(IntermediateOutputPath)%(_ReferenceSerializationAssemblyName.Identity).cs') != 'true'" Text="SGEN: Fail to generate %(_ReferenceSerializationAssemblyName.Identity)'. Please follow the instructions at https://go.microsoft.com/fwlink/?linkid=858594 and try again." />
|
||||
<Csc Condition="Exists('$(IntermediateOutputPath)%(_ReferenceSerializationAssemblyName.Identity).cs') == 'true'" ContinueOnError="true" OutputAssembly="$(IntermediateOutputPath)%(_ReferenceSerializationAssemblyName.Identity).dll" References="@(ReferencePath);@(IntermediateAssembly)" EmitDebugInformation="$(DebugSymbols)" Sources="$(IntermediateOutputPath)%(_ReferenceSerializationAssemblyName.Identity).cs" TargetType="Library" ToolExe="$(CscToolExe)" ToolPath="$(CscToolPath)" DisabledWarnings="$(_SerializationAssemblyDisabledWarnings)"/>
|
||||
<Warning Condition="Exists('$(IntermediateOutputPath)%(_ReferenceSerializationAssemblyName.Identity).dll') != 'true' And Exists('$(IntermediateOutputPath)%(_ReferenceSerializationAssemblyName.Identity).cs') == 'true'" Text="SGEN : warning SGEN1: Fail to compile %(_ReferenceSerializationAssemblyName.Identity).cs. Please follow the instructions at https://go.microsoft.com/fwlink/?linkid=858594 and try again." />
|
||||
<Warning Condition="Exists('$(IntermediateOutputPath)%(_ReferenceSerializationAssemblyName.Identity).dll') != 'true' And Exists('$(IntermediateOutputPath)%(_ReferenceSerializationAssemblyName.Identity).cs') == 'true'" Text="SGEN: Fail to compile %(_ReferenceSerializationAssemblyName.Identity).cs. Please follow the instructions at https://go.microsoft.com/fwlink/?linkid=858594 and try again." />
|
||||
<Copy Condition="Exists('%(_ReferenceSerializerIntermediateFolder.Identity).dll') == 'true'" SourceFiles="%(_ReferenceSerializerIntermediateFolder.Identity).dll" DestinationFolder="$(OutputPath)" />
|
||||
</Target>
|
||||
|
||||
@@ -58,4 +58,4 @@
|
||||
<Target Name="CopySerializerForReferenceAssemblies" AfterTargets="PrepareForPublish" Condition="@(SerializationAssembly)!=''">
|
||||
<Copy Condition="Exists('$(OutputPath)%(SerializationAssembly.Identity).XmlSerializers.dll') == 'true'" SourceFiles="$(OutputPath)%(SerializationAssembly.Identity).XmlSerializers.dll" DestinationFolder="$(PublishDir)" SkipUnchangedFiles="false" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<StringResourcesPath>..\..\System.Private.Xml\src\Resources\Strings.resx</StringResourcesPath>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetExt>.dll</TargetExt>
|
||||
<NoWarn>$(NoWarn);0169;0414;0649</NoWarn>
|
||||
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the options -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
|
||||
|
@@ -21,6 +21,9 @@ namespace Microsoft.XmlSerializer.Generator
|
||||
return sgen.Run(args);
|
||||
}
|
||||
|
||||
private static string s_references = string.Empty;
|
||||
private static Dictionary<string, string> s_referencedic = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private int Run(string[] args)
|
||||
{
|
||||
string assembly = null;
|
||||
@@ -35,27 +38,15 @@ namespace Microsoft.XmlSerializer.Generator
|
||||
bool silent = false;
|
||||
bool warnings = false;
|
||||
|
||||
AppDomain.CurrentDomain.AssemblyResolve += SgenAssemblyResolver;
|
||||
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
string arg = args[i];
|
||||
string value = string.Empty;
|
||||
|
||||
if (arg.StartsWith("/") || arg.StartsWith("-"))
|
||||
{
|
||||
int colonPos = arg.IndexOf(":");
|
||||
if (colonPos != -1)
|
||||
{
|
||||
value = arg.Substring(colonPos + 1).Trim();
|
||||
arg = arg.Substring(0, colonPos).Trim();
|
||||
}
|
||||
}
|
||||
|
||||
string originalArg = arg;
|
||||
arg = arg.ToLower(CultureInfo.InvariantCulture);
|
||||
|
||||
if (ArgumentMatch(arg, "?") || ArgumentMatch(arg, "help"))
|
||||
|
||||
if (ArgumentMatch(arg, "help") || ShortNameArgumentMatch(arg, "h"))
|
||||
{
|
||||
WriteHeader();
|
||||
WriteHelp();
|
||||
@@ -69,34 +60,45 @@ namespace Microsoft.XmlSerializer.Generator
|
||||
{
|
||||
proxyOnly = true;
|
||||
}
|
||||
else if (ArgumentMatch(arg, "out"))
|
||||
else if (ArgumentMatch(arg, "out") || ShortNameArgumentMatch(arg, "o"))
|
||||
{
|
||||
if (codePath != null)
|
||||
{
|
||||
errs.Add(SR.Format(SR.ErrInvalidArgument, "/out", arg));
|
||||
i++;
|
||||
if(i >= args.Length || codePath != null )
|
||||
{
|
||||
errs.Add(SR.Format(SR.ErrInvalidArgument, arg));
|
||||
}
|
||||
else
|
||||
{
|
||||
codePath = args[i];
|
||||
}
|
||||
|
||||
codePath = value;
|
||||
}
|
||||
else if (ArgumentMatch(arg, "type"))
|
||||
{
|
||||
if (value != string.Empty)
|
||||
i++;
|
||||
if (i >= args.Length)
|
||||
{
|
||||
string[] typelist = value.Split(';');
|
||||
errs.Add(SR.Format(SR.ErrInvalidArgument, arg));
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] typelist = args[i].Split(';');
|
||||
foreach (var type in typelist)
|
||||
{
|
||||
types.Add(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ArgumentMatch(arg, "assembly"))
|
||||
else if (ArgumentMatch(arg, "assembly") || ShortNameArgumentMatch(arg, "a"))
|
||||
{
|
||||
if (assembly != null)
|
||||
i++;
|
||||
if (i >= args.Length || assembly != null)
|
||||
{
|
||||
errs.Add(SR.Format(SR.ErrInvalidArgument, "/assembly", arg));
|
||||
errs.Add(SR.Format(SR.ErrInvalidArgument, arg));
|
||||
}
|
||||
else
|
||||
{
|
||||
assembly = args[i];
|
||||
}
|
||||
|
||||
assembly = value;
|
||||
}
|
||||
else if (ArgumentMatch(arg, "quiet"))
|
||||
{
|
||||
@@ -118,16 +120,32 @@ namespace Microsoft.XmlSerializer.Generator
|
||||
{
|
||||
warnings = true;
|
||||
}
|
||||
else if (ArgumentMatch(arg, "reference"))
|
||||
{
|
||||
i++;
|
||||
if (i >= args.Length)
|
||||
{
|
||||
errs.Add(SR.Format(SR.ErrInvalidArgument, arg));
|
||||
}
|
||||
else
|
||||
{
|
||||
s_references = args[i];
|
||||
if (!string.IsNullOrEmpty(s_references))
|
||||
{
|
||||
ParseReferences();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arg.EndsWith(".dll") || arg.EndsWith(".exe"))
|
||||
if (arg.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase) || arg.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (assembly != null)
|
||||
{
|
||||
errs.Add(SR.Format(SR.ErrInvalidArgument, "/assembly", arg));
|
||||
errs.Add(SR.Format(SR.ErrInvalidArgument, arg));
|
||||
}
|
||||
|
||||
assembly = originalArg;
|
||||
assembly = arg;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -232,23 +250,37 @@ namespace Microsoft.XmlSerializer.Generator
|
||||
{
|
||||
Type type = types[i];
|
||||
|
||||
if (type != null)
|
||||
try
|
||||
{
|
||||
bool isObsolete = false;
|
||||
object[] obsoleteAttributes = type.GetCustomAttributes(typeof(ObsoleteAttribute), false);
|
||||
foreach (object attribute in obsoleteAttributes)
|
||||
if (type != null)
|
||||
{
|
||||
if (((ObsoleteAttribute)attribute).IsError)
|
||||
bool isObsolete = false;
|
||||
object[] obsoleteAttributes = type.GetCustomAttributes(typeof(ObsoleteAttribute), false);
|
||||
foreach (object attribute in obsoleteAttributes)
|
||||
{
|
||||
isObsolete = true;
|
||||
break;
|
||||
if (((ObsoleteAttribute)attribute).IsError)
|
||||
{
|
||||
isObsolete = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isObsolete)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (isObsolete)
|
||||
}
|
||||
//Ignore the FileNotFoundException when call GetCustomAttributes e.g. if the type uses the attributes defined in a different assembly
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
if (warnings)
|
||||
{
|
||||
continue;
|
||||
Console.Out.WriteLine(FormatMessage(parsableerrors, true, SR.Format(SR.InfoIgnoreType, type.FullName)));
|
||||
WriteWarning(e, parsableerrors);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!proxyOnly)
|
||||
@@ -264,6 +296,19 @@ namespace Microsoft.XmlSerializer.Generator
|
||||
|
||||
bool gac = assembly.GlobalAssemblyCache;
|
||||
outputDirectory = outputDirectory == null ? (gac ? Environment.CurrentDirectory : Path.GetDirectoryName(assembly.Location)) : outputDirectory;
|
||||
|
||||
if (!Directory.Exists(outputDirectory))
|
||||
{
|
||||
//We need double quote the path to escpate the space in the path.
|
||||
//However when a path ending with backslash, if followed by double quote, it becomes an escapte sequence
|
||||
//e.g. "obj\Debug\netcoreapp2.0\", it will be converted as obj\Debug\netcoreapp2.0", which is not valid and not exist
|
||||
//We need remove the ending quote for this situation
|
||||
if (!outputDirectory.EndsWith("\"") || !Directory.Exists(outputDirectory.Remove(outputDirectory.Length - 1)))
|
||||
{
|
||||
throw new ArgumentException(SR.Format(SR.ErrDirectoryNotExists, outputDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
string serializerName = GetXmlSerializerAssemblyName(serializableTypes[0], null);
|
||||
string codePath = Path.Combine(outputDirectory, serializerName + ".cs");
|
||||
|
||||
@@ -278,11 +323,6 @@ namespace Microsoft.XmlSerializer.Generator
|
||||
throw new InvalidOperationException(SR.Format(SR.ErrDirectoryExists, codePath));
|
||||
}
|
||||
|
||||
if (!Directory.Exists(outputDirectory))
|
||||
{
|
||||
throw new ArgumentException(SR.Format(SR.ErrDirectoryNotExists, codePath, outputDirectory));
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
bool toDeleteFile = true;
|
||||
|
||||
@@ -338,16 +378,27 @@ namespace Microsoft.XmlSerializer.Generator
|
||||
}
|
||||
}
|
||||
|
||||
// assumes all same case.
|
||||
|
||||
private bool ArgumentMatch(string arg, string formal)
|
||||
{
|
||||
if (arg[0] != '/' && arg[0] != '-')
|
||||
// Full name format, eg: --assembly
|
||||
if (arg.Length < 3 || arg[0] != '-' || arg[1] != '-' )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
arg = arg.Substring(2);
|
||||
return arg.Equals(formal, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
public bool ShortNameArgumentMatch(string arg, string shortName)
|
||||
{
|
||||
// Short name format, eg: -a
|
||||
if (arg.Length < 2 || arg[0] != '-')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
arg = arg.Substring(1);
|
||||
return (arg == formal || (arg.Length == 1 && arg[0] == formal[0]));
|
||||
return arg.Equals(shortName, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
private void ImportType(Type type, ArrayList mappings, ArrayList importedTypes, bool verbose, XmlReflectionImporter importer, bool parsableerrors)
|
||||
@@ -404,16 +455,16 @@ namespace Microsoft.XmlSerializer.Generator
|
||||
private void WriteHelp()
|
||||
{
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpDescription));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpUsage, this.GetType().Assembly.GetName().Name));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpUsage, this.GetType().Assembly.GetName().Name.Substring("dotnet-".Length)));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpDevOptions));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpAssembly, "/assembly:", "/a:"));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpType, "/type:", "/t:"));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpProxy, "/proxytypes", "/p"));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpForce, "/force", "/f"));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpOut, "/out:", "/o:"));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpAssembly, "-a", "--assembly"));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpType, "--type"));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpProxy, "--proxytypes"));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpForce, "--force"));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpOut, "-o", "--out"));
|
||||
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpMiscOptions));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpHelp, "/?", "/help"));
|
||||
Console.Out.WriteLine(SR.Format(SR.HelpHelp, "-h", "--help"));
|
||||
}
|
||||
|
||||
private static string FormatMessage(bool parsableerrors, bool warning, string message)
|
||||
@@ -467,5 +518,76 @@ namespace Microsoft.XmlSerializer.Generator
|
||||
{
|
||||
return parent.Name + ".XmlSerializers" + (ns == null || ns.Length == 0 ? "" : "." + ns.GetHashCode());
|
||||
}
|
||||
|
||||
private static void ParseReferences()
|
||||
{
|
||||
var referencelist = new List<string>();
|
||||
if (s_references.Length > 0)
|
||||
{
|
||||
foreach(var entry in s_references.Split(';'))
|
||||
{
|
||||
string trimentry = entry.Trim();
|
||||
if (string.IsNullOrEmpty(trimentry))
|
||||
continue;
|
||||
referencelist.Add(trimentry);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var reference in referencelist)
|
||||
{
|
||||
if (reference.EndsWith(".dll") || reference.EndsWith(".exe"))
|
||||
{
|
||||
if (File.Exists(reference))
|
||||
{
|
||||
string filename = Path.GetFileNameWithoutExtension(reference);
|
||||
if (!string.IsNullOrEmpty(filename))
|
||||
{
|
||||
s_referencedic.Add(filename, reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static Assembly SgenAssemblyResolver(object source, ResolveEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(e.Name) || e.Name.Split(',').Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string assemblyname = e.Name.Split(',')[0];
|
||||
if (string.IsNullOrEmpty(assemblyname))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(s_referencedic.ContainsKey(assemblyname))
|
||||
{
|
||||
string reference = s_referencedic[assemblyname];
|
||||
if (!string.IsNullOrEmpty(reference))
|
||||
{
|
||||
if (File.Exists(reference))
|
||||
{
|
||||
return Assembly.LoadFrom(reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
if (exp is ThreadAbortException || exp is StackOverflowException || exp is OutOfMemoryException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
WriteWarning(exp, true);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<ItemGroup Condition=" '$(SkipTestsOnPlatform)' != 'true' ">
|
||||
<Compile Include=".\SGenTests.cs" />
|
||||
<Compile Include="$(TestSourceFolder)..\..\System.Runtime.Serialization.Xml\tests\Utils.cs" />
|
||||
<Compile Include="$(CommonTestPath)\System\Runtime\Serialization\Utils.cs" />
|
||||
<Compile Include="$(TestSourceFolder)..\..\System.Runtime.Serialization.Xml\tests\SerializationTypes.cs" />
|
||||
<Compile Include="$(TestSourceFolder)..\..\System.Private.Xml\tests\XmlSerializer\XmlSerializerTests.cs" />
|
||||
</ItemGroup>
|
||||
@@ -56,9 +56,9 @@
|
||||
<SerializerName>$(AssemblyName).XmlSerializers</SerializerName>
|
||||
</PropertyGroup>
|
||||
<Message Text="Running Serialization Tool" Importance="normal" />
|
||||
<Exec Command="$(GeneratorCliPath)dotnet $(OutputPath)dotnet-Microsoft.XmlSerializer.Generator.dll $(OutputPath)Microsoft.XmlSerializer.Generator.Tests.dll /force /quiet" />
|
||||
<Exec Command="$(GeneratorCliPath)dotnet $(OutputPath)dotnet-Microsoft.XmlSerializer.Generator.dll $(OutputPath)Microsoft.XmlSerializer.Generator.Tests.dll --force --quiet" />
|
||||
<Warning Condition="Exists('$(OutputPath)$(SerializerName).cs') != 'true'" Text="Fail to generate $(OutputPath)$(SerializerName).cs"/>
|
||||
<Csc Condition="Exists('$(OutputPath)$(SerializerName).cs') == 'true' AND '$(MSBuildRuntimeType)' != 'core'"
|
||||
<Csc Condition="Exists('$(OutputPath)$(SerializerName).cs') == 'true'"
|
||||
OutputAssembly="$(OutputPath)$(SerializerName).dll"
|
||||
References="@(ReferencePath);@(IntermediateAssembly)"
|
||||
EmitDebugInformation="$(DebugSymbols)"
|
||||
@@ -69,19 +69,6 @@
|
||||
ToolPath="$(CscToolPath)"
|
||||
DisabledWarnings="$(NoWarn), 219"
|
||||
UseSharedCompilation="true" />
|
||||
<!-- when building on core CSC requires the OverrideToolHost parameter, but this is not supported by desktop csc -->
|
||||
<Csc Condition="Exists('$(OutputPath)$(SerializerName).cs') == 'true' AND '$(MSBuildRuntimeType)' == 'core'"
|
||||
OutputAssembly="$(OutputPath)$(SerializerName).dll"
|
||||
References="@(ReferencePath);@(IntermediateAssembly)"
|
||||
EmitDebugInformation="$(DebugSymbols)"
|
||||
DebugType="$(DebugType)"
|
||||
Sources="$(OutputPath)$(SerializerName).cs"
|
||||
TargetType="Library"
|
||||
ToolExe="$(CscToolExe)"
|
||||
ToolPath="$(CscToolPath)"
|
||||
OverrideToolHost="$(OverrideToolHost)"
|
||||
DisabledWarnings="$(NoWarn), 219"
|
||||
UseSharedCompilation="true" />
|
||||
<Warning Condition="Exists('$(OutputPath)$(SerializerName).dll') != 'true'" Text="Fail to generate $(OutputPath)$(SerializerName).dll"/>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -19,7 +19,7 @@ namespace Microsoft.XmlSerializer.Generator.Tests
|
||||
string codefile = "Microsoft.XmlSerializer.Generator.Tests.XmlSerializers.cs";
|
||||
var type = Type.GetType("Microsoft.XmlSerializer.Generator.Sgen, dotnet-Microsoft.XmlSerializer.Generator");
|
||||
MethodInfo md = type.GetMethod("Main", BindingFlags.Static | BindingFlags.Public);
|
||||
string[] args = new string[] { "Microsoft.XmlSerializer.Generator.Tests.dll", "/force", "/quiet" };
|
||||
string[] args = new string[] { "Microsoft.XmlSerializer.Generator.Tests.dll", "--force", "--quiet" };
|
||||
int n = (int)md.Invoke(null, new object[] { args });
|
||||
Assert.Equal(0, n);
|
||||
Assert.True(File.Exists(codefile), string.Format("Fail to generate {0}.", codefile));
|
||||
|
Reference in New Issue
Block a user