Compact Framework & Adding reference to System * problem

SneWs's picture

We've been having some problems with Compact Framework and referencing assemblies from the 3.5 release. The problem shows during compile time with a nice message like "Consider app.config remapping of assembly "System.Data, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "2.0.0.0" [] to Version "3.5.0.0" [c:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Data.dll] to solve the conflict and get rid of all warnings."
After doing some investigation and googling around I solve (or rather made the warning message go away) by adding this to a our app.config file.

<configuration>
	<runtime>
		<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<!-- 2.0 to 3.5 -->
			<dependentassembly>
				<assemblyidentity culture="neutral" publickeytoken="969db8053d3322ac" name="System.Data" />
				<bindingredirect newVersion="3.5.0.0" oldVersion="2.0.0.0" />
			</dependentassembly>
			
			<!-- 1.0 to 3.5 -->
			<dependentassembly>
				<assemblyidentity culture="neutral" publickeytoken="969db8053d3322ac" name="System.Data" />
				<bindingredirect newVersion="3.5.0.0" oldVersion="1.0.5000.0" />
			</dependentassembly>
		</assemblybinding>
	</runtime>
</configuration>

This will ensure that the warnings goes away. But be aware that if the app.config is deployed into the device as the app.exe.config, the start-up time of your application may be affected since the CLR will attempt to decipher the config file.

Tags: 

2 Comments

Thanks a lot

Thanks a lot for this concrete example. Helped a lot.

Thanx!

Old thread, but I had to work on an old project :) Redused the compile time to 1/3!

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.