MonoDevelop Addin for NaCl using 'ProjectServiceExtensio
本文关键字:ProjectServiceExtensio using Addin for NaCl MonoDevelop | 更新日期: 2023-09-27 18:35:22
嗨,我
正在尝试制作一个 MonoDevelop 插件,我可以用来编译 NaCl 项目的 Mono...但是我收到一个空引用错误,并且找不到足够的信息来找出出了什么问题。
当我尝试从 MonoDevelop 中的插件创建项目时,就会发生空引用。所有资源都设置为构建为"嵌入式资源"。
建造者.cs:
using System;
using MonoDevelop.Projects;
using MonoDevelop.Core;
namespace MonoDevelop.MonoNaCl
{
public class Builder : ProjectServiceExtension
{
protected override BuildResult Build (IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration)
{
Console.WriteLine("Yahoo Build");
return base.Build (monitor, item, configuration);
}
protected override void Execute (IProgressMonitor monitor, SolutionEntityItem item, ExecutionContext context, ConfigurationSelector configuration)
{
Console.WriteLine("Yahoo Execute");
base.Execute (monitor, item, context, configuration);
}
}
}
MonoDevelop.MonoNaCl.addin.xml:注意:我真的不清楚我应该使用的"扩展",并认为问题就在那里。
<Addin namespace = "MonoDevelop"
id = "MonoNaCl"
name = "Mono for NaCl"
author = "Andrew Witte"
copyright = "BSD"
url = "http://www.URL.com"
description = "Support for developing MonoNaCl applications."
category = "NaCl Development"
version = "1.0">
<Dependencies>
<Addin id="Ide" version="3.0" />
<Addin id="Core" version="3.0" />
</Dependencies>
<Extension path = "/MonoDevelop/Ide/ProjectTemplates">
<ProjectTemplate id = "MonoNaClProject" resource = "MonoNaCl.xpt.xml"/>
</Extension>
<Extension path = "/MonoDevelop/ProjectModel/ProjectServiceExtensions">
<Class class = "MonoDevelop.MonoNaCl.Builder"/>
</Extension>
<!--<Extension path = "/MonoDevelop/ProjectModel/MSBuildItemTypes">
<SolutionItem type="MonoDevelop.MonoNaCl.Builder" extension="csproj" guid="{49DFC40D-C27A-4230-A637-8D9669269586}"/>
</Extension>-->
<Extension path="/MonoDevelop/ProjectModel/SerializableClasses">
<DataType class="MonoDevelop.MonoNaCl.Builde" />
</Extension>
</Addin>
MonoNaCl.xpt.xml:
<?xml version="1.0"?>
<Template originator = "Andrew Witte">
<TemplateConfiguration>
<_Name>MonoNaCl Project</_Name>
<_Category>C#/MonoNaCl</_Category>
<LanguageName>C#</LanguageName>
<_Description>Creates a MonoNaCl project.</_Description>
</TemplateConfiguration>
<Combine name = "${ProjectName}" directory = ".">
<Options>
<StartupProject>${ProjectName}</StartupProject>
</Options>
<Project name = "${ProjectName}" directory = "." type = "MonoNaCl">
<Options/>
</Project>
</Combine>
</Template>
这是尝试创建项目后的错误:
System.NullReferenceException: Object reference not set to an instance of an object
at MonoDevelop.Projects.SolutionFolderItemCollection.OnItemAdded (MonoDevelop.Projects.SolutionItem item) [0x0000b] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolderItemCollection.cs:59
at MonoDevelop.Projects.ItemCollection`1[MonoDevelop.Projects.SolutionItem].InsertItem (Int32 index, MonoDevelop.Projects.SolutionItem item) [0x00008] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ItemCollection.cs:39
at System.Collections.ObjectModel.Collection`1[MonoDevelop.Projects.SolutionItem].Add (MonoDevelop.Projects.SolutionItem item) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Templates.SolutionDescriptor.CreateEntry (MonoDevelop.Projects.ProjectCreateInformation projectCreateInformation, System.String defaultLanguage) [0x0026c] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SolutionDescriptor.cs:162
at MonoDevelop.Ide.Templates.ProjectTemplate.CreateWorkspaceItem (MonoDevelop.Projects.ProjectCreateInformation cInfo) [0x00000] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs:232
at MonoDevelop.Ide.Projects.NewProjectDialog.CreateProject () [0x001ef] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectDialog.cs:432
删除 Project 元素中的 type="MonoNaCl" 属性定义。您不必设置项目类型,除非您要定义自己的 Project 子类。