setting ACLs for subfolders using Web Deploy package - visual-web-developer

I’m trying to build a Deployment Package in Visual Web Developer Express 2010 which sets the ACL for a subfolder of the deployed website. I used the following information http://leethams.wordpress.com/2010/06/12/modifying-directory-permissions-with-web-deployment/
This is my test:
Create a new blank ASP.NET Application (WebApplication2 in this example)
In advanced compilation options, change .NET Framework target version to 3.5
Create a new folder (Config in this example) and add any file inside the folder
Create a new file called WebApplication2.wpp.targets, with this content
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Extends the AfterAddIisSettingAndFileContentsToSourceManifest action do also set ACLs -->
<IncludeCustomACLs>TRUE</IncludeCustomACLs>
<AfterAddIisSettingAndFileContentsToSourceManifest Condition="'$(AfterAddIisSettingAndFileContentsToSourceManifest)'==''">
$(AfterAddIisSettingAndFileContentsToSourceManifest);
SetCustomACLs;
</AfterAddIisSettingAndFileContentsToSourceManifest>
</PropertyGroup>
<Target Name="SetCustomACLs" Condition="'$(IncludeCustomACLs)'=='TRUE'">
<Message Text="Adding Custom ACls" />
<ItemGroup>
<MsDeploySourceManifest Include="setAcl" Condition="$(IncludeSetAclProviderOnDestination)">
<setAclUser>anonymousAuthenticationUser</setAclUser>
<path>$(_MSDeployDirPath_FullPath)</path>
<setAclAccess>Read,Write</setAclAccess>
<setAclResourceType>Directory</setAclResourceType>
<AdditionalProviderSettings>setAclResourceType;setAclAccess</AdditionalProviderSettings>
</MsDeploySourceManifest>
</ItemGroup>
</Target>
</Project>
I execute from the command line and everything works fine:
-------------------------------------------------------
Start executing msdeploy.exe
-------------------------------------------------------
"C:\Program Files\IIS\Microsoft Web Deploy\\msdeploy.exe" -source:package='C:\T
emp\WebApplication2\WebApplication2\obj\Debug\Package\WebApplication2.zip' -dest
:auto,includeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:
ContentExtension -disableLink:CertificateExtension -setParamFile:"C:\Temp\WebApp
lication2\WebApplication2\obj\Debug\Package\WebApplication2.SetParameters.xml"
Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy).
Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy).
Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy).
Número total de cambios: 3 (0 agregados, 0 eliminados, 3 actualizados, 0 parámet
ros cambiados, 0 bytes copiados)
Now, to set the permissions for the Config folder, I change the following line and rebuild the deployment package.
<path>$(_MSDeployDirPath_FullPath)/Config</path>
I get the following error:
-------------------------------------------------------
Start executing msdeploy.exe
-------------------------------------------------------
"C:\Program Files\IIS\Microsoft Web Deploy\\msdeploy.exe" -source:package='C:\T
emp\WebApplication2\WebApplication2\obj\Debug\Package\WebApplication2.zip' -dest
:auto,includeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:
ContentExtension -disableLink:CertificateExtension -setParamFile:"C:\Temp\WebApp
lication2\WebApplication2\obj\Debug\Package\WebApplication2.SetParameters.xml"
Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy).
Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy).
Info: Actualizando setAcl (C:\Temp\WebApplication2\WebApplication2\obj\Debug\Pac
kage\PackageTmp/Config).
Error: Se debe especificar un valor para 'setAclUser' cuando se usa el proveedor
'setAcl' con una ruta de acceso física.
Recuento de errores: 1.
In English it says: “Error: a value for ‘setAclUser’ must be specified when using the ‘setAcl’ provider with a physical path". Notice the third setAcl was changed to the physical path where the deployment package is located.
I then tried to modify it this way:
<AdditionalProviderSettings>setAclUser;setAclResourceType;setAclAccess</AdditionalProviderSettings>
But the error remains.
If I execute the deployment package with the “/t” switch, it does not throw the error, although it still shows the physical path.
I can hardcode the IIS path and change the line like this:
<path>Default Web Site/WebApplication2_deploy/Config</path>
It works fine. However, I wouldn’t like to do that, since the installation path need to be parameterized.
Changing the path to a backslassh makes no difference:
<path>Default Web Site/WebApplication2_deploy\Config</path>
Any help would be appreciated.
Thanks

Related

Service Fabric: The EntryPoint Blah.exe is not found

I did some project renaming and changed the folder structure and now I can't deploy my service fabric app to my local service fabric cluster.
Register-ServiceFabricApplicationType : The EntryPoint IdentityService.exe is not found.
The app was called IdentityApp and is now TheProject.Identity.App
The service was called IdentityWeb and is now TheProject.Identity.Service
More Log Details
Started executing script 'Deploy-FabricApplication.ps1'.
. 'C:\Users\mdepouw\source\repos\TheProject\TheProject.IdentityDomain\TheProject.Identity.App\Scripts\Deploy-FabricApplication.ps1' -ApplicationPackagePath 'C:\Users\mdepouw\source\repos\TheProject\TheProject.IdentityDomain\TheProject.Identity.App\pkg\Debug' -PublishProfileFile 'C:\Users\mdepouw\source\repos\TheProject\TheProject.IdentityDomain\TheProject.Identity.App\PublishProfiles\Local.5Node.xml' -DeployOnly:$true -ApplicationParameter:#{} -UnregisterUnusedApplicationVersionsAfterUpgrade $false -OverrideUpgradeBehavior 'None' -OverwriteBehavior 'Always' -SkipPackageValidation:$true -ErrorAction Stop
Copying application to image store...
Upload to Image Store succeeded
Registering application type...
Register-ServiceFabricApplicationType : The EntryPoint IdentityService.exe is not found.
FileName: C:\SfDevCluster\Data\ImageBuilderProxy\AppType\IdentityAppType\IdentityServicePkg\ServiceManifest.xml
At C:\Program Files\Microsoft SDKs\Service
Fabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:251 char:9
Register-ServiceFabricApplicationType -ApplicationPathInImage ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidOperation: (Microsoft.Servi...usterConnection:ClusterConnection) [Register-Servic
eFabricApplicationType], FabricException
FullyQualifiedErrorId : RegisterApplicationTypeErrorId,Microsoft.ServiceFabric.Powershell.RegisterApplicationType
Finished executing script 'Deploy-FabricApplication.ps1'.
Time elapsed: 00:00:26.1378123
The PowerShell script failed to execute.
In TheProject.Identity.Service\PackageRoot\ServiceManifest.xml I had to change the <Program> to match the new exe name
<!-- Code package is your service executable. -->
<CodePackage Name="Code" Version="1.0.0">
<EntryPoint>
<ExeHost>
<Program>TheProject.Identity.Service.exe</Program>
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</EntryPoint>
</CodePackage>
I have also encounter this issue, i got the below two parameters was different in *.csproj file.
<AssemblyName>servicename</AssemblyName>
<RootNamespace>servicename</RootNamespace>
Maybe it might be helpful for somebody else.
I didn't rename services in my project, but I faced the same error couple of days ago. After a lot of time of deep into the issue, I got its reason finally.
I had this line in service's *.csproj file:
<SelfContained>false</SelfContained>
And after removing this string everything started working. I'm not sure why Azure's team didn't provide the much more obvious error in this case.
Maybe it might be helpful for somebody else.
Build configuration was wrong in my case, it was set to release for Debug.
Right click on the solution -> Configuration Manager, change to debug for your project
Even I faced the same problem . I updated the serviceManifest.xml as below and got the issue resolved
<CodePackage Name="Code" Version="1.0.0">
<SetupEntryPoint>
<ExeHost>
<Program>SetupEntryPointTasks.exe</Program>
<ConsoleRedirection FileRetentionCount="5" FileMaxSizeInKb="20480"/>
</ExeHost>
</SetupEntryPoint>
<EntryPoint>
<ExeHost>
<Program>aaa.exe</Program>
<ConsoleRedirection FileRetentionCount="5" FileMaxSizeInKb="20480" />
</ExeHost>
</EntryPoint>
</CodePackage>

WIX - Reference a heat generated file ID for use in Custom Action

New to Wix, but trying to learn!
I'm using heat to generate a 'directory.wxs' file that contains all of the files I need for my application. One of these files is a Powershell script that I need to run as a custom action. I'm trying to use the -suid flag so the File Id is consistent across runs. I don't like this solution as I may be in a bad way if I ever have two files with the same name... suggestions welcome on that one.
In the customaction.wxs file, I'm trying to use what is generated, "install-service-filebeat.ps1" as my Property value in my custom action. I have looked at a quite a few examples / problems similar to this across here and other sites. I may just be an idiot and missing something, but was wondering if my issue is with referencing the ID from my directory.wxs file, or if it elsewhere in my syntax.
Below are my scripts, I included them at the end as they are long.
Thanks in advance!
My PS script:
## Powershell Script to Create MSI ##
## Variables ##
# WIX Source Dir #
$WIX_DIR="C:\Program Files (x86)\WiX Toolset v3.11\bin"
# Source Dir for files to be enumerated into MSI #
$SRC_DIR="C:\application-directory"
# Name of our Application #
$APP_NAME="Filebeat"
# Where to stage the various .wxs files #
$STG_DIR="C:\wix-project\${APP_NAME}\stage"
# Where to deliver the Final Product #
$TGT_DIR="C:\wix-project\${APP_NAME}\output"
## Create MSI ##
# Compile the source files into a Fragment to be referenced by main builder Product.wxs #
& ${WIX_DIR}\heat.exe dir $SRC_DIR -srd -dr INSTALLDIR -cg MainComponentGroup -out ${STG_DIR}\directory.wxs -ke -sfrag -gg -ssuid -var var.SourceDir -sreg -scom
# Convert the .wxs files into .wxobj for consumption by light.exe #
& ${WIX_DIR}\candle.exe -dSourceDir="${SRC_DIR}" ${STG_DIR}\*.wxs -o ${STG_DIR}\ -ext WixUtilExtension -arch x64
# Create the final MSI package --CURRENTLY REFERENCING THE FILES EXPLICITY. NEED TO FIND WAY TO WILDCARD! #
& ${WIX_DIR}\light.exe -o ${TGT_DIR}\${APP_NAME}_installer.msi ${STG_DIR}\customaction.wixobj ${STG_DIR}\directory.wixobj ${STG_DIR}\product.wixobj -cultures:en-US -ext WixUIExtension.dll -ext WiXUtilExtension.dll
This generates my files just fine, and compiles them. The contents of my customaction.wxs:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Fragment>
<!--Define the CustomAction for running the PowerShell script-->
<CustomAction Id="RunPowerShellScript_set"
Property="install_service.ps1"
Value=""[\[]POWERSHELLEXE[\]]" -Version 2.0 -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command "&'4(var.SourceDir)\[\[]#install_service.ps1[\]]'; exit $$($Error.Count)"" />
<CustomAction Id="RunPowerShellScript"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="deferred"
Return="check"
Impersonate="yes" />
<!-- Ensure PowerShell is installed and obtain the PowerShell executable location -->
<Property Id="POWERSHELLEXE">
<RegistrySearch Id="POWERSHELLEXE"
Type="raw"
Root="HKLM"
Key="SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell"
Name="Path" />
</Property>
<Condition Message="This application requires Windows PowerShell.">
<![CDATA[Installed OR POWERSHELLEXE]]>
</Condition>
</Fragment>
</Wix>
And the relevant portion of my product.wxs:
<!-- Execute Custom Action -->
<InstallExecuteSequence>
<Custom Action="RunPowerShellScript_set" After="InstallFiles" />
<Custom Action="RunPowerShellScript" After="InstallFiles">
<![CDATA[NOT Installed]]>
</Custom>
</InstallExecuteSequence>
I think that your Property="install_service.ps1" is incorrect. Try to follow the pattern from my blog post. I hope it helps you, just tested my script again and it works. Have a nice day!

msdeploy skip only web.config root

I'm deploying a website using a package provider with msdeploy and I'm trying to skip only the Web.config root file.
I've got this command but unfortunately it skips any Web.config files not just the root Web.config file that I want. I have read other posts on this forum and different websites about this same issue but it still doesn't work. I don't understand why msdeploy is so complicated to use, it is just ridiculous.
This is the command I'm using:
msdeploy -source:package='"src\Parapa.Website\obj\Test\Package\Parapa.Website.csproj.zip"'
-dest:auto,computerName='http://computer/MSDeployAgentService',username='luis',password='luis',includeAcls='False'
-verb:sync
-disableLink:AppPoolExtension
-disableLink:ContentExtension
-disableLink:CertificateExtension
-setParamFile:""src\Parapa.Website\obj\Test\Package\Parapa.Website.csproj.SetParameters.xml"" -setParam:"IIS Web Application Name"="staging-cm"
-skip:objectName=filePath,absolutePath='.*\\Web.config$'
-enableRule:DoNotDelete
Info: Object filePath (C:\ProgramFiles\TeamCity\buildAgent\work\d29656a51131c443\src\Parapa.Website\obj\Test\Package\PackageTmp\Views\Web.config) skipped
Info: Object filePath (C:\ProgramFiles\TeamCity\buildAgent\work\d29656a51131c443\src\Parapa.Website\obj\Test\Package\PackageTmp\Web.config) skipped due to skip directive 'CommandLineSkipDirective 1'.
Add the root folder to your Regex expression then it should not skip the web.config in the views folder only the root:
-skip:objectName=filePath,absolutePath='.*\\PackageTmp\\Web.config$'
To complement about chief7 mentions about:
-skip:objectName=filePath,absolutePath='.*\\PackageTmp\\Web.config$'
this command works if you are using -enableRule:DoNotDelete, because the web.config will be skipped from the source but will be deleted from the target.
So if you are not using the -enableRule:DoNotDelete, another approach is using the skipAction over the target web.config.
-skip:objectName=filePath,absolutePath='{WebSiteName}\\Web\.config$',skipAction=Update
replace {WebSiteName} by your web site name.
e.g
-skip:objectName=filePath,absolutePath='CommicsTest\\Web\.config$',skipAction=Update

Appxmanifest definition for sideloading app

I have a active app on the Windows Store.
I want to distribute this app via a MDM system (MobileIron).
My store appxmanifest looks like this:
<Identity Name="MyApp" Publisher="CN=<Publisher-GUID>" Version="1000.2000.300.4001"/>
<mp:PhoneIdentity PhoneProductId="<PhoneProductId>" PhonePublisherId="<Publisher-GUID>"/>
My sideloading appxmanifest looks like this:
<Identity Name="MyApp" Publisher="OID.0.9.1234.21301800.500.5.3=2272904, CN=My Company, OU=My Company" Version="1000.2000.300.4001"/>
<mp:PhoneIdentity PhoneProductId="<PhoneProductId>" PhonePublisherId="<Publisher-GUID>"/>
If I now use the Microsoft Powershell script BuildMDILAPPX.ps1 i get a unknown error:
Powershell.exe -ExecutionPolicy Bypass -File "C:\Program Files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1" -appxfilename ./MyApp.WP81_1000.2000.300.4001_arm.appxbundle -pfxfilename C:\SigningCert\symantec.pfx -password pw
UnPack the Appx
MakeAppx successfully extracted ./MyApp.WP81_1000.2000.300.4001_arm.appxbundle to C:\temp\APPXInput\MyApp.WP81_1606.3100.711.1567_arm.
Extract MyApp.WP81_1000.2000.300.4001_ARM.appx to temprorary folder ...
MakeAppx successfully extracted ./MyApp.WP81_1000.2000.300.4001_arm.appxbundle to C:\temp\APPXInput\MyApp.WP81_1606.3100.711.1567_arm.
Optimize Main Appx (MyApp.WP81_1000.2000.300.4001_ARM.appx) ...
EXITING SCRIPT
If I change the productid on my sideloading appxmanifest to a pseudo value:
<Identity Name="MyApp" Publisher="OID.0.9.1234.21301800.500.5.3=2272904, CN=My Company, OU=My Company" Version="1000.2000.300.4001"/>
<mp:PhoneIdentity PhoneProductId="<Publisher-GUID>" PhonePublisherId="<Publisher-GUID>"/>
The PS script successfully finishs. Deploying to MobileIron also works out, but if installing on a device I get a error
Installation failed. This app might already be installed
So my question is what value is expected on PhoneProductId on a sideloading manifest. How can I debug which error occurs on the BuildMDILAPPX.ps1? How can I see further log details if installation fails on a WP8.1 device?
Thanks in advance. Any help is appreciated!

Deploy to remote server using scp in NANT script

I am trying to copy a file to a remote server using scp task in Nant.Contrib .
I have used the following code to do that:
<target name= "QADeploy"description="gthtyb" >
<loadtasks assembly="C:\nantcontrib-0.85\bin\NAnt.Contrib.Tasks.dll" />
<echo message="htyh"/>
<scp file="D:\SourceTest\redist.txt" server="\\10.4.30.19" user="xxx:uuuu">
</scp>
</target>
But I am getting an error: scp failed to start. The system cannot find the file specified.
The code is as follows:
Then I have downloaded pscp.exe and modified the code as below:
<target name= "QADeploy"
description="gthtyb" >
<loadtasks assembly="C:\nantcontrib-0.85\bin\NAnt.Contrib.Tasks.dll" />
<echo message="htyh"/>
<scp file="D:\SourceTest\redist.txt" server="\\10.4.30.19" user="xxx:uuuu" program="C:\pscp\pscp.exe">
</scp>
Now I am getting the following error:
[scp] ssh_init:host does not exist
External Program Failed:C:\pscp\pscp.exe
can u please help whats the best way to copy a file to a remote server using Nant. I am using this code to deploy files to a remote server.
Thanks
You don't have to put two backslashes behind the IP of your server.
<scp file="D:\SourceTest\redist.txt" server="10.4.30.19" user="xxx:uuuu" program="C:\pscp\pscp.exe">
Also note that without the "path" parameter, the default destination folder is "~".
Update: it is the username that is crashing the pscp.exe program. Remove the ":" from your username or try with a different one.
it seems like there is some weirdness on how pscp parses paths in windows. The following should fix ssh_init:host does not exist problem:
-upload
pscp some.file user#[remote-host-or-ip]:/some/path/
-download
pscp user#[remote-host-or-ip]:/some/path/some.file some.file