如何使IKVM在Visual Studio 2008中构建?

时间:2020-03-05 18:55:45  来源:igfitidea点击:

我已经从http://sourceforge.net/cvs/?group_id=69637下载了IKVM源(http://www.ikvm.net/)。

现在,我试图将其构建在Visual Studio 2008中并陷入困境。有谁知道如何构建东西的文档,或者甚至可以给我指点?

我尝试打开ikvm8.sln,它会打开所有项目,但是尝试构建解决方案会导致一堆"找不到类型或者名称空间"错误。

我们可能会猜到我不是Visual Studio专家,而是习惯于在Eclipse中使用Java。

因此,我还是在寻找:分步说明或者指向有关如何在Visual Studio中构建IKVM的文档的链接。

让我知道我们是否需要更多信息。谢谢你的帮助!

编辑:我也尝试了手册" MsBuild.exe IKVM8.sln",但也得到了一堆:

JniInterface.cs(30,12): error CS0234: The type or namespace name 'Internal' does not exist in the namespace 'IKVM' (a
re you missing an assembly reference?)
JniInterface.cs(175,38): error CS0246: The type or namespace name 'ClassLoaderWrapper' could not be found (are you mi
ssing a using directive or an assembly reference?)
JniInterface.cs(175,13): error CS0246: The type or namespace name 'ClassLoaderWrapper' could not be found (are you mi
ssing a using directive or an assembly reference?)

编辑#2:我注意到一个" ikvm.build"文件,所以我下载了该文件并在该文件夹上运行了该文件,这使我又走了一步。一些事情开始成功构建,不幸的是,我现在收到以下错误:

ikvm-native-win32:

[mkdir] Creating directory 'C:\Documents and Settings\...\My Documents\ikvm\ikvm\native\Release'.
               [cl] Compiling 2 files to 'C:\Documents and Settings\...\My Documents\ikvm\ikvm\native\Release'.
        BUILD FAILED
        C:\Documents and Settings\...\My Documents\ikvm\ikvm\native\native.build(17,10):
        'cl' failed to start.
           The system cannot find the file specified
        Total time: 0.2 seconds.

编辑#3:OK通过在路径中放入cl.exe来解决,尽管仍然出现其他错误。请注意,所有这些都是为了在控制台上构建它,例如和南特。没有办法在Visual Studio中构建它吗?真可悲...

编辑#4:下一步是安装GNU classpath 0.95,现在看来我需要特定的OpenJDK安装... Linux AMD64?

[exec] javac: file not found: ..\..\openjdk6-b12\control\build\linux-amd64\gensrc\com\sun\accessibility\internal\resources\accessibility.java
             [exec] Usage: javac <options> <source files>
             [exec] use -help for a list of possible options

编辑5:得到了作者的答案。请参见下面或者http://weblog.ikvm.net/CommentView.aspx?guid=7e91b51d-6f84-4485-b61f-ea9e068a5fcf

编辑#6正如我所担心的,下一个问题:"无法打开windows.h",请参见此处的单独问题。

最终编辑:找到解决方案!在Lib和Path环境变量中获取Platform SDK文件夹后,下面介绍的解决方案对我有用。

解决方案

回答

我不知道这会为我们做到这一点,但是我们可以尝试从命令行进行构建吗?

msbuild ________

由于相同的问题,我认为这就是我构建应用程序的方式。

回答

OK,刚收到作者的以下回复:http://weblog.ikvm.net/CommentView.aspx?guid=7e91b51d-6f84-4485-b61f-ea9e068a5fcf

If you want to build from cvs, you're on your own. However, you can more easily build from source if you use an official release.
  
  If you download ikvm-0.36.0.11.zip, classpath-0.95-stripped.zip and openjdk-b13-stripped.zip from SourceForge (the last two are under the ikvm 0.36.0.5 release) you have all the sources that are needed.
  
  Now you'll have to open a Visual Studio 2008 Command Prompt (i.e. one that has cl.exe and peverify in the path).
  
  Then in the ikvm root directory, do a "nant clean" followed by "nant". That should build the whole project. After you done that, you should be able to build in Visual Studio (debug target only), but you may need to repair the assembly references in the projects (unless you have ikvm installed in c:\ikvm).
  
  Regards, 
  Jeroen

编辑:确保Platform SDK文件夹位于Path和Lib环境变量中后,这对我有用。谢谢,耶隆!