Re: [Ikvm-developers] Regarding VS2010 and IKVM
Brought to you by:
jfrijters
From: Jeroen F. <je...@su...> - 2010-02-28 17:58:44
|
Hi Eugene, I see what you mean now. It does indeed appear impossible to target .NET 2.0 with VS 2010 and use IKVM, unfortunately. Regards, Jeroen > -----Original Message----- > From: Дейзи Чейн [mailto:dai...@ma...] > Sent: Sunday, February 28, 2010 3:28 PM > To: ikv...@li... > Subject: [Ikvm-developers] Regarding VS2010 and IKVM > > Hello Jeroen, thanks for prompt your answer, > > >I get a warning when adding the reference and while building, but it > builds just fine. > >BTW, this is because IKVM.OpenJDK.Core has a couple of extention > methods and references System.Core.dll, Visual Studio assumes that an > assembly that references System.Core.dll requires .NET 3.5, but that's > a wrong assumption, IKVM 0.42 works and is supported on .NET 2.0 SP1 > and higher. > > Here is my experience: I can link to VS .NET 2.0 project any dll > written and/or cross-compiled by myself, but VS doesn't see namespaces > (packages) that are inside IKVM/JDK (of course, I added them as > references and dependencies - mybe, I missed something?). > > Let's use calling saxon Transformer as an illustrative synthetic > example: > > public static byte[] transform(byte[] xmlfile, byte[] xslfile) > { > //----here we call Java core classes to prepare arguments for saxon's > transformer.transform() call //----such way of calling saxon is used to > demonstrate the nature of problem > > StreamSource xml = new StreamSource(new > ByteArrayInputStream(xmlfile)); > StreamSource xsl = new StreamSource(new > ByteArrayInputStream(xslfile)); > > java.lang.System.setProperty("javax.xml.transform.TransformerFactory", > "net.sf.saxon.TransformerFactoryImpl"); > StreamResult outResult = new StreamResult(); > java.io.ByteArrayOutputStream outputXmlResult = new > java.io.ByteArrayOutputStream(); > outResult.setOutputStream(outputXmlResult); > > TransformerFactory trans = new > net.sf.saxon.TransformerFactoryImpl(); > Transformer transformer = trans.newTransformer(Xsl); > transformer.setParameter("dir", "output"); > transformer.transform(Xml, outResult); > return outputXmlResult.toByteArray(); > } > > In this example, VS2010 will see and understand the namespace > net.sf.saxon, but will say "The type or namespace name 'javax' could > not be found (are you missing a using directive or an assembly > reference?)" - and so on for any Java class (StreamSource, > ByteArrayInputStream and so on). > > Of course, a simple workaround is possible: make all wrapper classes in > Java with primitive argument/result types, so only "your own" packages > will be in "using" C# clause (in this synthetic example - we can make > wrapper in Java with method transform(byte[] xmlfile, byte[] xslfile) > and call it from C# code). > In 2008 this example compiles fine. > Eugene > > ----------------------------------------------------------------------- > ------- > Download Intel® Parallel Studio Eval Try the new software tools > for yourself. Speed compiling, find bugs proactively, and fine-tune > applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers |