Archive for July 2014
A friend needed the Xml Serializers dll, the one named something like “ClassLibrary1.XmlSerializers.dll”, so he went into the project properties in VS and set “Build > Generate serialization assembly” to “On”. But nothing happened. No XmlSerializers dll was created.
We hunted round for an answer and came across this: Generating an Xml Serialization assembly as part of my build.
After setting the above project property you must go into the project file in your favorite text editor and add this:
just after the line:
You should end up with something like this:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <GenerateSerializationAssemblies>On</GenerateSerializationAssemblies> <SGenUseProxyTypes>false</SGenUseProxyTypes> </PropertyGroup>
Do that for every build configuration where you need the serializer.
Hope that helps.
If you ever see Entity Framework code that looks something like this:
SELECT 1 AS [C1], CAST(NULL AS int) AS [C2], CAST(NULL AS int) AS [C3], CAST(NULL AS varchar(1)) AS [C4] FROM ( SELECT 1 AS X ) AS [SingleRowTable1] WHERE 1 = 0
and your EF LINQ query was nothing like it (and who’s would be?), then you probably have a
in your query and the collection “somelist” is empty.
I hit this today and was scratching my head until I found this:
Hope that helps someone.