iefpw
iefpw

Reputation: 7042

Obfuscated DLL and Azure package deploy

I'm using FxProtect .NET assembly obfuscator and I want to deploy the obfuscated .DLL that is in the package to Azure. How do I put back the DLL that I obfuscated back into the package? Do I unzip the .CSPKG that gets deployed to Azure and copy and paste the obfuscated DLL into the extracted .CSPKG folder and then zip it again to deploy?

Upvotes: 2

Views: 939

Answers (2)

John Wright
John Wright

Reputation: 4607

I have a similar situation where I have a set of Azure packages that include references to assemblies which need to be obfuscated (they are part of a public SDK). I use Dotfuscator as the obfuscation tool, but the process will likely work for other vendors as well. Here is how I solved this issue:

In my case, the Azure package(s) contain a reference to a WebRole project. That WebRole project then contains project references to several other library projects that need to be obfuscated.

The build process takes three passes:

  1. Build the solution, which contains all of the libraries and web projects. I have used the Visual Studio Configuration Manager to disable building of the Azure package projects, though that is not required.
  2. Run the obfuscation tool to obfuscate the assemblies that require it.
  3. Build and package just the Azure packages (via the Publish target) and instruct MSBuild not to also build any referenced projects.

That last part is key. If you don't tell MSBuild to not build referenced projects, it will rebuild them all, undoing the obfuscation. You do this by including the property BuildProjectReferences=false when building the packages.

To build the Azure packages from an MSBuild script, I use the following:

<!-- This should be run after Obfuscation to ensure the SDK assemblies included in the packages are obfuscated -->
<MSBuild Projects="..\Path\My.CloudService.ccproj" Targets="Publish" Properties="BuildProjectReferences=false;PublishDir=..\artifacts\MyCloudService"  />

Upvotes: 1

Igorek
Igorek

Reputation: 15850

If packaging from Visual Studio or MSBUILD, I'd like to suggest that you run a post-build event that obfuscates the generated .DLL's

Upvotes: 1

Related Questions