Bug 9952 - Build fails with .resx file
Summary: Build fails with .resx file
Status: NEW
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model (show other bugs)
Version: 3.0.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Lluis Sanchez
URL:
Depends on:
Blocks:
 
Reported: 2013-01-31 13:37 UTC by Scott Stephens
Modified: 2015-02-12 10:59 UTC (History)
8 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 9952 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Scott Stephens 2013-01-31 13:37:44 UTC
Cannot build the Math.Net numerics project: http://numerics.mathdotnet.com/.  Works fine on Visual Studio 2010.  Fails with error:

error CS1566: Error reading resource file 'c:\<snip>\mathnet-numerics\src\Numerics\Properties\Resources.resources' -- 'The system cannot find the file specified.

That file is indeed missing, but there is a src\Numerics\Properties\Resources.resx file that I would think should be used instead, or possibly transformed into the .resources file before compiling (not totally sure how resources work).  

Using the MSBuild/XBuild setting (Tools->Options,Build menu) allows the build to succeed.
Comment 1 Mike Krüger 2013-02-01 02:09:50 UTC
lluis: can we just pre process the .resx files ? (does affect all .NET projects)
Comment 2 Lluis Sanchez 2013-02-04 05:49:22 UTC
AFAIK, .resx files are already pre-processed
Comment 3 HA 2013-02-12 17:25:32 UTC
Did anyone find the solution? I am new to monodevelop and I am trying to compile a VS .net project using monodevelop. I am getting same error and cannot figure out how to resolve it. please let me know...
Comment 4 João Vitor 2013-04-16 18:56:22 UTC
Looks like it is changing the file name before calling csc.exe

In my csproj:
<EmbeddedResource Include="Properties\Resources.resx">

Compile command:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /noconfig "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll"
 -nostdlib
 "/out:D:\Projects\tmp\Projects\jvlppm\Jv.Social\third-party\WinRT.NET\WinRT.NET.Forms\bin\Debug\WinRT.NET.Forms.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Drawing.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Windows.Forms.dll"
 "/r:D:\Projects\tmp\Projects\jvlppm\Jv.Social\third-party\WinRT.NET\WinRT.NET\bin\Debug\WinRT.NET.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll"
 /nologo
 /warn:4
 /debug:full
 /optimize-
 "/define:DEBUG"
 
 /t:library
 "D:\Projects\tmp\Projects\jvlppm\Jv.Social\third-party\WinRT.NET\WinRT.NET.Forms\Controls\BackButton.cs"
 "D:\Projects\tmp\Projects\jvlppm\Jv.Social\third-party\WinRT.NET\WinRT.NET.Forms\Controls\PictureButton.cs"
 "D:\Projects\tmp\Projects\jvlppm\Jv.Social\third-party\WinRT.NET\WinRT.NET.Forms\Properties\AssemblyInfo.cs"
 "D:\Projects\tmp\Projects\jvlppm\Jv.Social\third-party\WinRT.NET\WinRT.NET.Forms\Properties\Resources.Designer.cs"
 "D:\Projects\tmp\Projects\jvlppm\Jv.Social\third-party\WinRT.NET\WinRT.NET.Forms\Security\Authentication\Web\WebAuthenticationBroker.cs"
 "/res:D:\Projects\tmp\Projects\jvlppm\Jv.Social\third-party\WinRT.NET\WinRT.NET.Forms\Properties\Resources.resources,WinRT.NET.Forms.Properties.Resources.resources"
 /fullpaths
 /utf8output
 

error CS1566: Error reading resource file 'd:\Projects\tmp\Projects\jvlppm\Jv.Social\third-party\WinRT.NET\WinRT.NET.Forms\Properties\Resources.resources' -- 'The system cannot find the file specified. '



If I change manually the csproj to:
<EmbeddedResource Include="Properties\Resources.res2x">

then the result is:
error CS1566: Error reading resource file 'd:\Projects\tmp\Projects\jvlppm\Jv.Social\third-party\WinRT.NET\WinRT.NET.Forms\Properties\Resources.res2x' -- 'The system cannot find the file specified. '

So it seems that the resx extension is being replaced by .resources for any reason.


I'm having this with updated Xamarin.Studio (4.0.3, stable, Windows).
Comment 5 Daniel Cazzulino 2013-04-17 17:13:33 UTC
I'm facing this issue too. Same Xamarin Studio build.
Comment 6 Lluis Sanchez 2013-05-03 10:28:56 UTC
This problem happens when building a project that has been previously built with Visual Studio or msbuild. There is a bug when checking for modified files. As a workaround, just remove the obj directory of the project. I'll work on a fix.
Comment 7 Martín Coll 2013-06-14 10:39:07 UTC
Lluis Sanchez, that helped.

Thanks.
Comment 8 Bill 2013-08-19 14:20:51 UTC
Was this bug fixed? I ran into the same issue when trying to build a project that was originally created in VS. If I remove the obj directory, it builds fine.
Comment 9 Bill 2013-08-19 14:39:57 UTC
More details on what I found:

When I open the Resources (.resx) file there's an ampersand in the comments generated by Visual Studio that causes the comments to break. Changing the ampersand to 'and' or $amp; fixes the issue UNTIL you edit the resources file in VS. Visual Studio will re-add the ampersand because it re-generates the file. 

Comments from Resources file below. The ampersand after 'Example: ... ado.net/XML headers ' is the one causing the issue.  After the ampersand the remaining lines are not seen as comments.

 <!-- 
    Microsoft ResX Schema 
    
    Version 2.0
    
    The primary goals of this format is to allow a simple XML format 
    that is mostly human readable. The generation and parsing of the 
    various data types are done through the TypeConverter classes 
    associated with the data types.
    
    Example:
    
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    There are any number of "resheader" rows that contain simple 
    name/value pairs.
    
    Each data row contains a name, and value. The row also contains a 
    type or mimetype. Type corresponds to a .NET class that support 
    text/value conversion through the TypeConverter architecture. 
    Classes that don't support this are serialized and stored with the 
    mimetype set.
    
    The mimetype is used for serialized objects, and tells the 
    ResXResourceReader how to depersist the object. This is currently not 
    extensible. For a given mimetype the value must be set accordingly:
    
    Note - application/x-microsoft.net.object.binary.base64 is the format 
    that the ResXResourceWriter will generate, however the reader can 
    read any of the formats listed below.
    
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array 
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
Comment 10 João Vitor 2014-01-07 10:15:01 UTC
I'm not having this issue anymore with the stable Xamarin Studio.
It also builds correctly with the latest builds under Linux.

---

Linux Output:

Project "/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET.Forms/WinRT.NET.Forms.csproj" (Build target(s)):
	
	Target PrepareForBuild:
		Configuration: Debug Platform: AnyCPU
	
	Target CopyFilesMarkedCopyLocal:
		Copying file from '/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET/bin/Debug/WinRT.NET.dll' to '/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET.Forms/bin/Debug/WinRT.NET.dll'
		Copying file from '/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET/bin/Debug/WinRT.NET.dll.mdb' to '/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET.Forms/bin/Debug/WinRT.NET.dll.mdb'
	
	Target GenerateResources:
		Tool /opt/mono/bin/resgen2 execution started with arguments: /useSourcePath /compile "Properties/Resources.resx,obj/Debug/WinRT.NET.Forms.Properties.Resources.resources" 
	
	Target GenerateSatelliteAssemblies:
	No input files were specified for target GenerateSatelliteAssemblies, skipping.
	
	Target CoreCompile:
		Tool /opt/mono/bin/dmcs execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/Debug/WinRT.NET.Forms.dll /resource:obj/Debug/WinRT.NET.Forms.Properties.Resources.resources Internal/Controls/BackButton.cs Internal/Controls/PictureButton.cs Properties/AssemblyInfo.cs Properties/Resources.Designer.cs Security/Authentication/Web/WebAuthenticationBroker.cs obj/Debug/.NETFramework,Version=v4.0.AssemblyAttribute.cs /target:library /define:DEBUG /reference:/opt/mono/lib/mono/4.0/System.dll /reference:/opt/mono/lib/mono/4.0/System.Drawing.dll /reference:/opt/mono/lib/mono/4.0/System.Windows.Forms.dll /reference:/opt/mono/lib/mono/4.0/System.Core.dll /reference:/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET/bin/Debug//WinRT.NET.dll /warn:4
	
	Target DeployOutputFiles:
		Copying file from '/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET.Forms/obj/Debug/WinRT.NET.Forms.dll.mdb' to '/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET.Forms/bin/Debug/WinRT.NET.Forms.dll.mdb'
		Copying file from '/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET.Forms/obj/Debug/WinRT.NET.Forms.dll' to '/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET.Forms/bin/Debug/WinRT.NET.Forms.dll'
Done building project "/home/joao/Projects/jvlppm/WinRT.NET/WinRT.NET.Forms/WinRT.NET.Forms.csproj".


---

Windows Output:

Project "D:\Projects\Community\WinRT.NET\WinRT.NET.Forms\WinRT.NET.Forms.csproj" (Build target(s)):



Target ResolveProjectReferences:

    __________________________________________________

    Project "D:\Projects\Community\WinRT.NET\WinRT.NET.Forms\WinRT.NET.Forms.csproj" is building "D:\Projects\Community\WinRT.NET\WinRT.NET\WinRT.NET.csproj" (GetTargetPath target(s)):



    __________________________________________________

    Project "D:\Projects\Community\WinRT.NET\WinRT.NET.Forms\WinRT.NET.Forms.csproj" is building "D:\Projects\Community\WinRT.NET\WinRT.NET\WinRT.NET.csproj" (GetNativeManifest target(s)):



Target CoreResGen:

    Processing resource file "Properties\Resources.resx" into "obj\Debug\WinRT.NET.Forms.Properties.Resources.resources".

Target GenerateTargetFrameworkMonikerAttribute:

  Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.

Target CoreCompile:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;NET_4_0 /errorendlocation /preferreduilang:en-US /highentropyva- /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Windows.Forms.dll" /reference:D:\Projects\Community\WinRT.NET\WinRT.NET\bin\Debug\WinRT.NET.dll /debug+ /debug:full /optimize- /out:obj\Debug\WinRT.NET.Forms.dll /resource:obj\Debug\WinRT.NET.Forms.g.resources /resource:obj\Debug\WinRT.NET.Forms.Properties.Resources.resources /target:library /utf8output Internal\Controls\BackButton.cs Internal\Controls\PictureButton.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Security\Authentication\Web\WebAuthenticationBroker.cs "C:\Users\joao\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cs"

Target _CopyFilesMarkedCopyLocal:

    Copying file from "D:\Projects\Community\WinRT.NET\WinRT.NET\bin\Debug\WinRT.NET.dll" to "bin\Debug\WinRT.NET.dll".

    Copying file from "D:\Projects\Community\WinRT.NET\WinRT.NET\bin\Debug\WinRT.NET.pdb" to "bin\Debug\WinRT.NET.pdb".

Target GetCopyToOutputDirectoryItems:

    __________________________________________________

    Project "D:\Projects\Community\WinRT.NET\WinRT.NET.Forms\WinRT.NET.Forms.csproj" is building "D:\Projects\Community\WinRT.NET\WinRT.NET\WinRT.NET.csproj" (GetCopyToOutputDirectoryItems target(s)):



Target CopyFilesToOutputDirectory:

    Copying file from "obj\Debug\WinRT.NET.Forms.dll" to "bin\Debug\WinRT.NET.Forms.dll".

    WinRT.NET.Forms -> D:\Projects\Community\WinRT.NET\WinRT.NET.Forms\bin\Debug\WinRT.NET.Forms.dll

    Copying file from "obj\Debug\WinRT.NET.Forms.pdb" to "bin\Debug\WinRT.NET.Forms.pdb".



Build succeeded.
Comment 11 Mikayla Hutchinson [MSFT] 2014-01-07 17:43:12 UTC
That's because we now use xbuild by default. I imagine if you disable it (or use a project type that does not use it yet, e.g. iOS, Mac) it would still fail.
Comment 12 Chris Hubbard 2015-02-12 10:59:20 UTC
Still seeing this with the latest Xamarin Studio 5.7.1