web project nuget package modification of azure $(ProjectDir)WebRole.cs

Topics: General
Aug 10, 2012 at 9:16 PM

When you create an azure cloud project web role, e.g. mvc4 web role, it adds a $(ProjectDir)WebRole.cs file containing just the following boiler plate implementation.  

namespace MvcWebRole1 {
    public class WebRole : RoleEntryPoint  {
        public override bool OnStart()  { return base.OnStart();  }
    }
}

In my web project nuget package I have Content\WebRole.cs.pp file that has a much more extensive boiler plate implementation. 

When i apply this nuget package to my web role projects it does not apply these nuget package contained WebRole.cs.pp updates to the stock boilerplate implementation.

Do I need to do something special to make this happen?


 


Aug 11, 2012 at 5:29 PM

The .pp transform only applies to new file. If NuGet detects that an existing file already exists in the project, it will skip the .pp file.

One option for you is to rename your .pp file and then perhaps open a readme.txt file to ask user to delete the current file.

Aug 16, 2012 at 8:36 PM

Can I use WebRole.cs.transform to apply updates to existing WebRole.cs or does .transform extension only work for Web.config, Web.Debug.config and Web.Release.config files?