NAnt MissingManifestResourceException Tip

140 words.

With NAnt 0.86 Beta 1, I found that I couldn’t use the element to include *.resx files in my task. For example, this didn’t work:

«/font>csc target="winexe" output="${bindir}\UvNotes.exe" debug="${debug}" win32icon="UvNotes.ico" >

«/font>resources>

«/font>include name="*.resx" />

</resources>

«/font>sources>

«/font>include name="*.cs" />

</sources>

</csc>

The program wouldn’t run, failing with a MissingManifestResourceException.

Initially I tried to do this:

«/font>resgen todir="${objdir}">

«/font>resources>

«/font>include name="*.resx" />

</resources>

</resgen>

«/font>csc target="winexe" output="${bindir}\UvNotes.exe" debug="${debug}" win32icon="UvNotes.ico" >

«/font>resources>

«/font>include name="${objdir}*.resources" />

</resources>

«/font>sources>

«/font>include name="*.cs" />

</sources>

</csc>

But that also failed because it was generating resource files named eg. “NoteForm.resources.”

To finally fix it, I ended up doing this:

«/font>resgen input="NoteForm.resx" output="${objdir}\UvNotes.NoteForm.resources" />

«/font>csc target="winexe" output="${bindir}\UvNotes.exe" debug="${debug}" win32icon="UvNotes.ico" >

«/font>resources>

«/font>include name="${objdir}*.resources" />

</resources>

«/font>sources>

«/font>include name="*.cs" />

</sources>

</csc>

That generated resource files named eg. “UvNotes.NoteForm.resources” which was apparently required for it to work properly.

Related

This page is a static archival copy of what was originally a WordPress post. It was converted from HTML to Markdown format before being built by Hugo. There may be formatting problems that I haven't addressed yet. There may be problems with missing or mangled images that I haven't fixed yet. There may have been comments on the original post, which I have archived, but I haven't quite worked out how to show them on the new site.

Sorry, new comments are disabled on older posts. This helps reduce spam. Active commenting almost always occurs within a day or two of new posts.