c# - Error Reading Resource File for any WPF Project in VS2012 -


whenever try compile wpf project in vs2012 have following compile error:

error reading resource file 'c:\users\mysuerid\documents\visual studio 2012\projects\myappname\myappname\obj\debug\' -- 'the system cannot find path specified. ' c:\users\mysuerid\documents\visual studio 2012\projects\myappname\myappname\csc myappname

the problem when vs generates csc command contains partial duplicated /resource parameter this:

/resource:obj\debug\ /resource:obj\debug\myappname.properties.resources.resources  

csc looks @ first parameter , since no file name specified throws error. went command line mode , tested , without parameter , verified problem. don't want have manually compile projects!

anyone know how vs comes these parameters , how rid of invalid parameter?

the build output looks (framework 4.5)

1>target "mainresourcesgeneration" in file "c:\windows\microsoft.net\framework\v4.0.30319\microsoft.winfx.targets" project "c:\users\jws15592\documents\visual studio 2012\projects\myappname\myappname\myappname.csproj" (target "prepareresources" depends on it): 1>building target "mainresourcesgeneration" completely. 1>input file "c:\users\jws15592\documents\visual studio 2012\projects\myappname\myappname\obj\debug\mainwindow.baml" newer output file "obj\debug\". 1>task "message" skipped, due false condition; ('$(msbuildtargetsverbose)'=='true') evaluated (''=='true'). 1>using "resourcesgenerator" task assembly "presentationbuildtasks, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35". 1>task "resourcesgenerator" 1>   1>   1>  microsoft (r) build task 'resourcesgenerator' version '4.0.30319.17929 built by: fx45rtmrel'. 1>  copyright (c) microsoft corporation 2005. rights reserved. 1>   1>   1>  generating .resources file: 'obj\debug\'... 1>c:\windows\microsoft.net\framework\v4.0.30319\microsoft.winfx.targets(709,5): error rg1000: unknown build error, 'could not find part of path 'c:\users\jws15592\documents\visual studio 2012\projects\myappname\myappname\obj\debug\'.'  1>done executing task "resourcesgenerator" -- failed. 1>done building target "mainresourcesgeneration" in project "myappname.csproj" -- failed. 

the itemgroup in project file:

  <itemgroup>     <compile include="properties\assemblyinfo.cs">       <subtype>code</subtype>     </compile>     <compile include="properties\resources.designer.cs">       <autogen>true</autogen>       <designtime>true</designtime>       <dependentupon>resources.resx</dependentupon>     </compile>     <compile include="properties\settings.designer.cs">       <autogen>true</autogen>       <dependentupon>settings.settings</dependentupon>       <designtimesharedinput>true</designtimesharedinput>     </compile>     <embeddedresource include="properties\resources.resx">       <generator>resxfilecodegenerator</generator>       <lastgenoutput>resources.designer.cs</lastgenoutput>     </embeddedresource>     <none include="app.config" />     <none include="properties\settings.settings">       <generator>settingssinglefilegenerator</generator>       <lastgenoutput>settings.designer.cs</lastgenoutput>     </none>     <appdesigner include="properties\" />   </itemgroup> 

it not extra argument, incomplete one. you'd expect see /resource:obj\debug\myappname.g.resources there. makes filename evaluate empty string. generated .xaml files in app.

tools + options, projects , solution, build , run, "msbuild project build output verbosity" setting, change detailed. you'll detailed trace of build steps. copy/paste notepad , turn on format + word wrap can see everything.

the expected build step generates myappname.g.resources file this:

1>output file "obj\debug\myappname.g.resources" not exist. 1>task "message" skipped, due false condition; ('$(msbuildtargetsverbose)'=='true') evaluated (''=='true'). 1>using "resourcesgenerator" task assembly "presentationbuildtasks, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35". 1>task "resourcesgenerator" 1>   1>   1>  microsoft (r) build task 'resourcesgenerator' version '4.0.30319.17929 built by: fx45rtmrel'. 1>  copyright (c) microsoft corporation 2005. rights reserved. 1>   1>   1>  generating .resources file: 'obj\debug\myappname.g.resources'... 1>  reading resource file: 'c:\users\hpass_000\appdata\local\temporary projects\myappname\obj\debug\mainwindow.baml'... 1>  resource id 'mainwindow.baml'. 1>  generated .resources file: 'obj\debug\myappname.g.resources'. 

compare yours , tell see different.


update: build step goes wrong exact same reason. input file generated correctly. can narrow down msbuild variable has empty string, $(_resourcenameinmainassembly).

explaining why harder however, don't see scenario empty. use text editor @ c:\windows\microsoft.net\framework\v4.0.30319\microsoft.winfx.targets. part of file assigns variable looks this:

 <_resourcenameinmainassembly condition="'$(uiculture)' == ''">$(assemblyname).g.resources</_resourcenameinmainassembly>   <_resourcenameinmainassembly condition="'$(uiculture)' != ''">$(assemblyname).unlocalizable.g.resources</_resourcenameinmainassembly> 

that .targets file 42567 bytes long , dated 06/06/12 on machine. have .net 4.5 installed.


Comments