NAnt MissingManifestResourceException Tip

Tom 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.

Originally posted on my personal blog which was active from 2003 to 2020. You may have arrived here by redirection from the original permalink.

Elsewhere: Loading...

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.

AI Disclosure: I write all posts by hand, but I may use AI assistance for image generation (they will be marked as such), file management, titles, summaries, tagging, HTML coding.