NAnt MissingManifestResourceException Tip
140 words.
With NAnt 0.86 Beta 1, I found that I couldn’t use the
«/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.
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.