Visual Studio GenerateResource Error Building on Windows 10

A couple of weeks ago when I installed Windows 10 on my primary machine I ran into an issue where Windows Phone/Windows/Universal applications stopped building due to a rather cryptic error relating to trusted network resources…. which was bizarre since the projects were all local on my machine. This is the same error reported on the Windows Dev Center – https://social.msdn.microsoft.com/Forums/windowsapps/en-US/82fea1c9-ae5a-4595-a2c1-46efb853303b/error-2-generateresource?forum=wpdevelop.

The good news is that there’s a relatively simple fix as indicated in the error message ”please enable the loadFromRemoteSources switch. Of course this shouldn’t need to be applied but that’s the danger of running on the edge with a pre-release product. What’s not obvious is where the switch should be applied – if you follow the link to MSDN it seems to indicate that the switch needs to be added to Devenv.exe.config, which does nothing to fix the issue. Turns out you need to add it to the MSBuild configuration file (eg C:Program Files (x86)MSBuild12.0Bin MSBuild.exe.config).

<?xml version =”1.0″?>
<configuration>
    <configSections>
        <section name=”msbuildToolsets” type=”Microsoft.Build.BuildEngine.ToolsetConfigurationSection, Microsoft.Build.Engine, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” />
    </configSections>
    <startup useLegacyV2RuntimeActivationPolicy=”true”>
        <supportedRuntime version=”v4.0″ sku=”.NETFramework,Version=v4.5.1″/>
    </startup>
    <runtime>
    <loadFromRemoteSources enabled=”true”/>
    ….

Leave a comment