MissingManifestResourceException when running tests after building with MSBuild (.mresource has path in manifest)

前端 未结 1 633
陌清茗
陌清茗 2020-12-19 23:16

I am having a problem with embedded resources for a C# project on a build server using MSBuild on the command line. The project works just fine when building and running tes

相关标签:
1条回答
  • 2020-12-19 23:43

    It appears adding LogicalName to the project file fixes it:

    <LogicalName>$(RootNamespace).Properties.Resources.resources</LogicalName> 
    

    i.e. so the embedded resource entry in the project file looks like this:

    <ItemGroup>
      <EmbeddedResource Include="Properties\Resources.resx">
        <Generator>ResXFileCodeGenerator</Generator>
        <LastGenOutput>Resources.Designer.cs</LastGenOutput>
        <LogicalName>$(RootNamespace).Properties.Resources.resources</LogicalName> 
      </EmbeddedResource>
    </ItemGroup>
    

    This is detailed in: http://blogs.msdn.com/b/msbuild/archive/2007/10/19/manifest-resource-names-changed-for-resources-files.aspx

    Note that we are using a .resx file, but the bug still appears to occur.

    0 讨论(0)
提交回复
热议问题