I'm having a weird issue with my Silverlight 4 project, although it's one I've seen before. Basically, embedding fonts forces my Silverlight app to always rebuild even if everything is up to date. This kind of sucks as the font embed task takes a lot of memory and will eventually crash VS. I'd like to be able to build the project from the command line, but no matter what my local projects are out of date so the "Run" command forces another rebuild. I've tried to snip out some of the relevant log information out of my msbuild log.
Project "D:\Projects\Test\Test.Web\Test.Web.csproj" (10) is building "D:\Projects\Test\Test.SL\Test.SL.csproj" (2:4) on node 1 (default targets).
Building with tools version "4.0".
// Build operation starts normally (well, the dependency set on the server project is forcing the SL application to build).
...
Target "ResolveReferences" skipped. Previously built successfully.
// A bunch of tasks are skipped (like this one)
...
Target "SubsetFontsSilverlight" in file "C:\Program Files\MSBuild\Microsoft\Expression\Blend\Silverlight\v4.0\SubsetFontSilverlight.targets" from project "D:\Projects\Test\Test.SL\Test.SL.csproj" (target "PrepareResources" depends on it):
Using "SubsetFontsSilverlight" task from assembly "C:\Program Files\MSBuild\Microsoft\Expression\Blend\Silverlight\v4.0\SubsetFontTask.dll".
Task "SubsetFontsSilverlight"
Done executing task "SubsetFontsSilverlight".
Done building target "SubsetFontsSilverlight" in project "Test.SL.csproj".
// this task never gets skipped
...
Target "MainResourcesGeneration" in file "C:\Program Files\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.Common.targets" from project "D:\Projects\Test\Test.SL\Test.SL.csproj" (target "PrepareResources" depends on it):
Building target "MainResourcesGeneration" completely.
Input file "obj\Debug\Fonts\Fonts.zip" is newer than output file "obj\Debug\Test.SL.g.resources".
// note that the Fonts.zip file now makes the resources file out of date
...
Target "CoreCompile" in file "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.Targets" from project "D:\Projects\Test\Test.SL\Test.SL.csproj" (target "Compile" depends on it):
Building target "CoreCompile" completely.
Input file "obj\Debug\Test.SL.g.resources" is newer than output file "obj\Debug\Test.SL.pdb".
// and the full recompile begins...
Anyhow, is there a way to stop the font task from running if the font files have not changed? Because constant rebuilds are really annoying.
Update: a sample font from the project file.
<BlendEmbeddedFont Include="Fonts\MyriadPro-BoldIt.otf">
<IsSystemFont>True</IsSystemFont>
<All>True</All>
<AutoFill>True</AutoFill>
<Characters>
</Characters>
<Uppercase>True</Uppercase>
<Lowercase>True</Lowercase>
<Numbers>True</Numbers>
<Punctuation>True</Punctuation>
</BlendEmbeddedFont>
Update 2:
I'd like to post a little repro project, but I'm not sure where to toss the zip file. In any case, one can be whipped up in a few seconds flat. Here are the steps:
Create Sillverlight Application (Blend or VS, though you need Blend for this to work anyhow)
Use the Font Manager (Tools -> Font Manager) in Blend, you may have to open MainPage.xaml for it to become enabled. Embed the "Tahoma" font.
Now, every time you hit "Rebuild" you can verify that csc.exe runs every time, regardless of whether anything was changed or not.