deploying one set of files in case of win8 html/js project and another in case of xaml/c# project

Topics: General
Oct 30, 2012 at 11:56 PM

I'm working on a bunch of win8 project nuget packages where the windows runtime component library requires some boilerplate UI files to be deployed into project that nuget package is added to.

If project is a win8 html/js project then i need to deploy NuGet\Content\HtmlJsPrjFiles and if the project is a win8 xaml/c# project, *.csproj, then i need to deploy NuGet\Content\XamlCsPrjFiles.

Any thoughts on how i best setup my nuget package to do this while retaining support *.html.pp, *.js.pp, *.xaml.pp and *.cs.pp replacement of $rootnamespace$ tokens?

I thought of using a NuGet\Tools\install.ps1 script check for the existence of a .jsproj or .csproj, using $project.FileName.EndsWith(".jsproj") and $project.FileName.EndsWith(".csproj"), and then based on that result copying the files into place myself but then i'd have to also be coming up with solution for carrying out $rootnamespace$ token replacements.

Developer
Oct 31, 2012 at 7:11 PM

We have added this support for the upcoming 2.2. release. If you can wait for about 1 month, you can take advantage of that.

See more details in this thread: http://nuget.codeplex.com/discussions/398222

Oct 31, 2012 at 7:33 PM

thanks for response and work to create an update covering win8 project user stories.

in that other thread that person is talking about use of xaml/c# specific class library assemblies and html/js specific windows runtime component assemblies.   In my case i'm using windows runtime component assemblies so it is compatible with both win8 target project types.  

my issue has to do with boilerplate xaml/c# and html/js/css view and view model code that will be stored in nuget package "Content" folder and use .pp extension to get $rootnamespace$ token replacement at time of deployment.  

will the upcoming 2.2 release work also cover that aspect of nuget package work as well for win8 xaml/c# and html/js project type targets?

Developer
Oct 31, 2012 at 11:53 PM

NuGet allows you to vary contents files based on the target framework of the project. In your case you would design your package files like this:

\contents
      \windows8-javascript
            *.html, *.js files
      \windows8-managed
            *.xml, *.cs files

Token replacement is supported for these files.

Nov 1, 2012 at 3:53 PM

That is perfect.  So I have that support now in nuget 2.1 or only once 2.2 beta or rtm drop releases?

Developer
Nov 1, 2012 at 3:55 PM

It will only be avaiable in 2.2, which we hope to release by the end of this month.

Nov 8, 2012 at 3:07 AM
Edited Nov 8, 2012 at 3:10 AM

Getting further into this i'm finding that my winrt nuget package will also need to have the following package.nuspec settings be in effect if the target project is xaml/c# and not if the project is html/js. 

  <dependencies>
    <dependency id="Callisto version="1.2.5" />
  </dependencies>
  <frameworkAssemblies>
    <frameworkAssembly assemblyName="Windows" targetFramework="winrt45" />
  </frameworkAssemblies> 

I read through the linked issue http://nuget.codeplex.com/discussions/398222 and didn't see anything talking about this.   It did cover different nuget package provided assembly references that would be needed in each case but that's different.  

Any insights at this point if the nuget 2.2 work will cover the above winrt package deployment need as well?

 


Developer
Nov 8, 2012 at 3:20 AM

I'm not sure I understand your question. Are you asking if the above snippet will work? If so, yes.

Nov 8, 2012 at 3:39 AM
Edited Nov 8, 2012 at 3:40 AM

The question is how will I tell nuget package to include those dependency and frameworkassembly settings in the case of win8 xaml/c# store projects but not in the case of win8 html/js store projects?

Developer
Nov 8, 2012 at 3:01 PM

You'd do like this:

 <dependencies>
    <group targetFramework="windows8-managed">
       <dependency id="Callisto" version="1.2.5" />
    </group>
  </dependencies>
  <frameworkAssemblies>
     <frameworkAssembly assemblyName="Windows" targetFramework="windows8-managed" />
  </frameworkAssemblies> 
Nov 8, 2012 at 3:25 PM

excellent.  looks like 2.2 is really going to help with folks working on nugets targeting win8 projects.

Dec 14, 2012 at 1:01 AM
Edited Dec 14, 2012 at 1:10 AM

I saw today that the nuget extension 2.2.31210.9045 and nuget.exe 2.2.31210.9045 released.  

I installed it and changed my nuget package content folders and package.nuspec as shown below to try and make use of the support I understood it was supposed to add for targeting windows store html/js and xaml/c# apps with different contents, package dependencies and assembly references.  When I test it none of the content, package dependencies or assembly references get applied.  I also tried using "netcore45-" as the prefix and same result.

Any insights on what i'm doing wrong?

\Contents\windows8-javascript\security\*.html, *.css, *.js
\Contents\windows8-managed\Security\*.xaml.pp, *.xaml.cs.pp

    <dependencies>
      <group targetFramework="windows8-javascript">
        <dependency id="linq.js" version="2.2.0.2" />
      </group>
      <group targetFramework="windows8-managed">
        <dependency id="Callisto" version="1.2.6" />
      </group>
    </dependencies>
    <frameworkAssemblies>
        <frameworkAssembly assemblyName="Windows" targetFramework="windows8-managed" />
    </frameworkAssemblies>
  </metadata>
</package>

Developer
Dec 15, 2012 at 2:22 AM

I am very sorry that I didn't tell you earlier. We had to revert the support for these monikers due to an issue that was brought up, which made us rethink the approach to Windows 8 project flavors.

I feel your pain but we didn't want to ship half-baked solution and then be stuck with it.

I suggest a work around for now is to put the logics into your install.ps1 script and conditionally add files to projects. Let me know if you need help on that.

 

Dec 15, 2012 at 6:08 AM

No worries I already had install.ps1 logic in place to cover content and references so I just reverted back to that.

I've been using the approach of adding all content and references using NuGet support and then install.ps1 to remove what I don't need for current project as this allowed me to get .pp token replacement support.

One thing I am blocked on is my xaml case requires callisto NuGet. If there is a install.ps1 story for adding dependency nugets that would have me all set for the time being.