Skip to content

Instantly share code, notes, and snippets.

@smarenich
Last active October 13, 2016 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarenich/fd4dd3934e88f067751d950d50281522 to your computer and use it in GitHub Desktop.
Save smarenich/fd4dd3934e88f067751d950d50281522 to your computer and use it in GitHub Desktop.
Azure Repacking Script
rem Extracting Data
rmdir in\Acumatica /S /Q
rmdir Package\approot /S /Q
rmdir Package\sitesroot /S /Q
Package\7za.exe x in\Service.cspkg -oIn\Acumatica
for /f %%f in ('dir /b in\*.cspkg') do Package\7za.exe x In\%%f -oIn\Acumatica
for /f %%f in ('dir /b in\Acumatica\*.cssx') do Package\7za.exe x In\Acumatica\%%f -oPackage approot\
for /f %%f in ('dir /b in\Acumatica\*.cssx') do Package\7za.exe x In\Acumatica\%%f -oPackage sitesroot\0\
Pause
rem replacing current path in template file
del Package\files.txt
powershell -Command "(gc Package\template.txt) -replace '<FOLDER>', '%CD%\Package\approot' | Out-File Package\files.txt"
rem fixing web.confing version
powershell -Command "(gc Package\sitesroot\0\web.config) -replace '</assemblyBinding>', '<dependentAssembly><assemblyIdentity name=""Microsoft.WindowsAzure.ServiceRuntime"""" publicKeyToken=""31bf3856ad364e35"""" culture=""neutral"""" /><bindingRedirect oldVersion=""0.0.0.0-2.7.0.0"""" newVersion=""2.7.0.0"""" /></dependentAssembly></assemblyBinding>' | Out-File Package\sitesroot\0\web.config" -encoding UTF8
rem packing azure package
"C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9\bin\"cspack.exe "ServiceDefinition.csdef" /out:"Out\AcumaticaService.cspkg" /roleFiles:Web;"Package\files.txt" /rolePropertiesFile:Web;"Package\properties.txt" /sitePhysicalDirectories:Web;Main;"Package\sitesroot\0"
pause
TargetFrameWorkVersion=v4.0
<FOLDER>\Default.aspx;Default.aspx
<FOLDER>\Default.aspx.cs;Default.aspx.cs
<FOLDER>\startup.cmd;startup.cmd
<FOLDER>\web.config;web.config
<FOLDER>\Bin\Microsoft.WindowsAzure.Diagnostics.dll;Bin\Microsoft.WindowsAzure.Diagnostics.dll
<FOLDER>\Bin\Microsoft.WindowsAzure.StorageClient.dll;Bin\Microsoft.WindowsAzure.StorageClient.dll
<FOLDER>\Bin\PX.Azure.dll;Bin\PX.Azure.dll
<FOLDER>\Bin\PX.Dummy.dll;Bin\PX.Dummy.dll
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" serviceName="AcumaticaService" osFamily="4" osVersion="*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="Web">
<ConfigurationSettings>
<Setting name="ConnectionString" value="[ConnectionString]" />
<Setting name="CompanyID" value="" />
<Setting name="SessionLimit" value="" />
<Setting name="WebConfig" value="section=system.web/pxdatabase;property=providers/add|name:PXSqlDatabaseProvider/Parameters/secureCompanyID;value=False
&amp;section=system.web/machineKey;property=ValidationKey;value=72250A3D87E9F8D15A8D5BAEE42B3280135DB321208D7120DBD051A713123E57E1D996F98915DE3ABE7349E08313673C151A3C420CE9F49DD5AE3E45F8C21C36
&amp;section=system.web/machineKey;property=DecryptionKey;value=95297EA96BCE0E80F0C3039B6F3DA231F8858B9088975D04
&amp;section=system.web/machineKey;property=Validation;value=SHA1" />
<Setting name="Version" value="5.30.2562" />
<Setting name="Type" value="" />
</ConfigurationSettings>
<Instances count="1" />
<Certificates>
<Certificate name="Certificate" thumbprint="[Cerificate]" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AcumaticaService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="Web" enableNativeCodeExecution="true" vmsize="Medium">
<Sites>
<Site name="Main">
<Bindings>
<Binding name="HttpIn" endpointName="HttpIn" />
<Binding name="HttpsIn" endpointName="HttpsIn" />
</Bindings>
</Site>
</Sites>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
<ConfigurationSettings>
<Setting name="ConnectionString" />
<Setting name="CompanyID" />
<Setting name="SessionLimit" />
<Setting name="WebConfig" />
<Setting name="Version" />
<Setting name="Type" />
</ConfigurationSettings>
<Certificates>
<Certificate name="AcumaticaCertificate" storeLocation="LocalMachine" storeName="My" />
</Certificates>
<Endpoints>
<InputEndpoint name="HttpIn" protocol="http" port="80" />
<InputEndpoint name="HttpsIn" protocol="https" port="443" certificate="AcumaticaCertificate" />
</Endpoints>
<Startup>
<Task commandLine="..\startup.cmd" executionContext="elevated" taskType="simple" />
</Startup>
<LocalResources>
<LocalStorage name="Snapshots" cleanOnRoleRecycle="false" sizeInMB="10240" />
</LocalResources>
</WebRole>
</ServiceDefinition>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment