Skip to content

Commit

Permalink
Fix #229
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ganss committed Oct 28, 2020
1 parent 8ad9388 commit d7c42d2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@
<None Update="xsd\simple\restriction.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\simple\simple.xsd">
<None Update="xsd\simple\windows1250.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\ts-api\ts-api_2_8.xsd">
Expand Down
15 changes: 15 additions & 0 deletions XmlSchemaClassGenerator.Tests/xsd/simple/windows1250.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="windows-1250"?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/XMLSchema.xsd"
xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="Windows1250Root">
<xs:complexType>
<xs:sequence>
<xs:element name="elem" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
6 changes: 6 additions & 0 deletions XmlSchemaClassGenerator/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;

Expand Down Expand Up @@ -258,6 +259,11 @@ public bool SeparateSubstitutes
set { _configuration.SeparateSubstitutes = value; }
}

static Generator()
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}

public void Generate(IEnumerable<string> files)
{
var set = new XmlSchemaSet();
Expand Down
11 changes: 6 additions & 5 deletions XmlSchemaClassGenerator/XmlSchemaClassGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
Expand All @@ -37,19 +41,16 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.CodeDom" Version="4.7.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
</ItemGroup>

</Project>

0 comments on commit d7c42d2

Please sign in to comment.