locked
Can't register app

    Question

  • Using the Win8 CP and VS 11 Express Beta, I can't register an empty project based on the grid template. The error is that the request to register is being rejected because the files are on a network share. In this particular case, "My Documents" is redirected to a server and I have offline caching enabled so, the files there would actually appear to be on a network share. This was not an issue in the DevPreview. Is there some kind of work around for this, or perhaps it's a bug? It would really be painful to have to have my source files outside My Docs as this is synced across numerous machines. Thanks.
    Sunday, March 11, 2012 4:56 PM

All replies

  • Yes, it's by design that you cannot run a Metro app from a network drive and deployment from Visual Studio essentially registers the app with the system without actually packaging and installing it (so it doesn't get put into the normal install location, which is local).

    You can still work with sources on a network drive, but you'll have to override the deployment location, which by default is under the project's root directory (e.g. bin\).  You have several options:

    1) You can switch from local debugging to remote debugging and set the machine name as 'localhost'.  This will do a remote deployment on your local machine (thus not using the project's directory).  You don't need to install the Remote Debugger tools, nor start msvsmon for this to work on localhost.

    2) You can override the project's output directory.  Right-click on the project and change the output directory to something like: $(Temp)\$(MSBuildProjectName)\bin\$(Configuration), where Temp is an environment variable pointing to your Temp directory.

    3) If you still want normal output to live next to the sources, e.g. when you build the appx package, etc., you can override only the layout directory instead of the entire output path.  For this you'll need to modify your project file directly (e.g. *.jsproj, *.csproj, ...) to add the new value:

      <PropertyGroup>
        <LayoutDir>C:\WorkingFolder\$(MSBuildProjectName)\$(Configuration)</LayoutDir>
      </PropertyGroup>

    Hope that helps.

    ~Gearard

    Monday, March 12, 2012 12:13 AM
  • That worked for a JavaScript app like a charm, thank you very much. But for a C# app, I changed the Build project properties, Output path, to the same values you listed above. But, it looks like VS is putting the whole string together \\server\share\users\profile\visual studio 11\project\$(temp)....

    Am I missing something, looks like I need to take out some kind of reference path but I can't seem to find out where that is. Thanks again, big help!

    Monday, March 12, 2012 3:25 AM
  • Unfortunately for C# projects you cannot set this value via the Properties Pages.  Setting it in the UI causes the value to be escaped, so it loses the tokens and therefore is treated as a relative path to the project directory.  What you need to do for C# projects to change the output path is:

    1) In Solution Explorer, Right-click on the project and select "Unload project"
    2) Right-click on the unloaded project and select "Edit project"
    3) Search for all instances of <OutputPath> and set the value directly to (do not escape the '<' and other characters!):

    <OutputPath>$(Temp)\$(MSBuildProjectName)\bin\$(Configuration)</OutputPath>

    By default there will be an <OutputPath> declaration for every configuration.
    4) Save and close the file
    5) Right-click on the project and select "Reload project"

    At this point, the value should work correctly.  Even after setting it this way, you cannot edit it via the properties pages because it will re-escape it.

    Hope that helps!

    ~Gearard


    Monday, March 12, 2012 5:15 AM
  • Actually, thinking about this a bit more: since you have to modify the project file for C# directly anyway, you might as well just delete the <OutputPath> property from each individual configuration property group, and just have a single one in the top PropertyGroup (non-config/platform dependent one) that sets it appropriately for all configs, e.g.:

        <OutputPath>$(Temp)\$(MSBuildProjectName)\bin\$(Configuration)\$(Platform)</OutputPath>

    ~Gearard
    Monday, March 12, 2012 5:24 AM