Build Nant无法识别namespace.Properties
我正试图使用nant为一个c#项目构建一个解决方案,但是我在指定构建文件中的资源时遇到了一个问题。我得到了错误代码: CS0234:命名空间“暗边”中不存在类型或命名空间名称“Properties”。如何修改生成文件以删除错误 以下是导致问题的源文件中的一段代码:Build Nant无法识别namespace.Properties,build,nant,csc,Build,Nant,Csc,我正试图使用nant为一个c#项目构建一个解决方案,但是我在指定构建文件中的资源时遇到了一个问题。我得到了错误代码: CS0234:命名空间“暗边”中不存在类型或命名空间名称“Properties”。如何修改生成文件以删除错误 以下是导致问题的源文件中的一段代码: Image enemyImage = DarkSide.Properties.Resources.DarkSide_Asteroid_Medium_Gray; 其中,暗边是项目的名称空间,其余部分访问资源 以下是我的生成文件的一个片
Image enemyImage = DarkSide.Properties.Resources.DarkSide_Asteroid_Medium_Gray;
其中,暗边是项目的名称空间,其余部分访问资源
以下是我的生成文件的一个片段:
<target name="build" depends="init" description="compiles the source code">
<property name="build.dir" value="${project::get-base-directory()}/${project::get-name()}/bin/release/${project.version}${basedir.suffix}"/>
<mkdir dir="${build.dir}"/>
<csc target="exe" output="${build.dir}/Darkside.exe" debug="${build.debug}">
<sources>
<include name="Darkside/*.cs"/>
</sources>
<resources >
<include name="${project::get-base-directory()}/${project::get-name()}/Properties/**" />
</resources>
</csc>
</target>
您可能应该为
资源
标记(使用dynamicprefix=“true”)定义前缀
实际上,csc
任务的状态是:
注意:为了让
任务生成与Microsoft Visual Studio.NET生成的清单资源名称相匹配的清单资源名称,
元素的prefix属性的值应与C#项目的“默认名称空间”相匹配,而dynamicprefix属性的值应设置为“true”
即使在添加默认名称空间后,我仍然会收到相同次数的错误。@Mozly尝试使用prefix=“DarkSide.Properties.Resources”和dynamicprefix=“false”。@Mozly-Ah。。。你还需要一个更好的cs包含。类似于include name=“Darkside/***.cs”
<target name="build" depends="init" description="compiles the source code">
<property name="build.dir" value="${project::get-base-directory()}/${project::get-name()}/bin/release/${project.version}${basedir.suffix}"/>
<mkdir dir="${build.dir}"/>
<csc target="exe" output="${build.dir}/Darkside.exe" debug="${build.debug}">
<sources>
<include name="Darkside/*.cs"/>
</sources>
<resources dynamicprefix="true" prefix="DarkSide">
<include name="${project::get-base-directory()}/${project::get-name()}/Properties/**" />
</resources>
</csc>
</target>