I am using msdeploy to delete web sites using this command
msdeploy -verb:delete -dest:apphostconfig="Default Web Site/FOO",computerName="BAR"
however this does not delete the files under
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\FOO
Is there an argument for msdeploy to delete these files too?
If that is not the case, is there something else I can use in a Power Shell or batch script from a remote computer?
You can use the runCommand MSDeploy provider:
msdeploy.exe -verb:sync -source:runCommand="net start MyService" -dest:auto
https://technet.microsoft.com/en-us/library/ee619740(v=ws.10).aspx
Related
This seems like it should be very straight forward but it is not working for me and I am out of ideas.
All I want to do is set the physical path when I deploy a package using msdeploy so that it doesn't go to the default inetpub\wwwroot location.
msdeploy -verb:sync -source:package="D:\PATH\TO\PACKAGE.zip" -dest:iisapp="Default Web Site/SiteName" -setParam:kind=DestinationVirtualDirectory,scope="Default Web Site/SiteName",value="C:\Program Files\Physical\Location"
I feel like I must be missing something obvious.
I've done this by adding an additional command (appcmd) to the MSDeploy package manifest to change the physical path of the IIS site during the deployment:
<runcommand path="%windir%\system32\inetsrv\appcmd set app /app.name:"Default Web Site/app12" /[path='/'].physicalPath:C:\temp\app12" waitInterval="5000"/>
http://www.dotnetcatch.com/2016/06/28/webdeploymsdeploy-quick-tip-change-iis-siteapp-physical-path-with-msdeploy/
The following changes the physical directory of a virtual application on a remote machine
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:apphostconfig="my-website-name\my-virtual-application-name",computername=my-computer-name,username=my-service-account-username,password=my-service-account-password -dest:package=template.zip -declareParam:name="destVirtualDir",kind=DestinationVirtualDirectory,scope="my-website-name",defaultValue="c:\my-default-folder-name"
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package=template.zip -dest:apphostconfig="my-website-name/my-virtual-application-name",computername=my-computer-name,username=my-service-account-username,password=my-service-account-password -setParam:name="destVirtualDir",value="c:\my-new-folder-name"
To make sure no copying of source and target occurs you can add
-enableRule:Donotdeleterule -skip:objectName=filepath,absolutePath=.*
The above was 'inspired' by https://forums.iis.net/t/1169416.aspx which also shows how to make other website and virtual app changes
The project I have uses msdeploy to publish a package to IIS. It deploys over an existing version of the project. within the web application, I have a virtual directory, but every time I deploy the project, the virtual directory disappears.
I am calling MSDepoly in the following manner:
-source:package='d:\[...]\9.1.0.67\application\AppName.zip' -dest:auto,computerName="hostSite.com",userName="AutoInstall",password="****",authtype="NTLM",includeAcls="False" -verb:sync -enableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"d:\...\9.1.0.67\application\AppName.SetParameters.xml" -skip:objectName=binding -skip:absolutePath="info$" -skip:objectName=dirPath,absolutePath="help$",skipAction=Delete
as you can see at the end, I have the following skip rules:
-skip:objectName=binding -skip:absolutePath="info$" -skip:objectName=dirPath,absolutePath="help$",skipAction=Delete
The binding skip rule is working, but the virtual directory, info, is still getting removed from the web application. the virtual directory is nested within the help directory, so I added the skip action to skip deleting that folder as well.
I based all of this information from the following blog article, but my virtual directory, info, is still getting removed on deployment.
Please help!
I encountered the same issue. In development it appears the following skip rule prevented the Virtual Directory from being removed by MSDeploy.
-skip:ObjectName=virtualDirectory,absolutePath=.*NameOfVirtualDirectory
I gave up on getting msdeploy to play nice. I just wrote a bat script that would be executed after msdeploy completed:
mkdir C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir
ECHO adding read permissions to the app pool
cacls C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir/t /e /g "IIS APPPOOL\MyAppPool":r
ECHO creating "info" virtual directory
C:\Windows\System32\inetsrv\appcmd add vdir /app.name:"WebApplication/AppVirtualDirectory" / /path:"/help/info" /physicalPath:"C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir"
C:\Windows\System32\inetsrv\appcmd set vdir /vdir.name:"Medrio/MedrioWeb/help/info" /physicalPath:"C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir"
I'm using TeamCity for deployment process. For deploy i'm running MSbuild with this command line parameters:
/P:Configuration=Release
/P:DeployOnBuild=True
/P:DeployTarget=MSDeployPublish
/P:MsDeployServiceUrl=serviceUrl
/P:DeployIisAppPath=website
/P:AllowUntrustedCertificate=True
/P:MSDeployPublishMethod=WMSvc
/P:username=username
/P:Password=password
/P:SkipExtraFilesOnServer=True
/P:VisualStudioVersion=10.0
I have this parameter P:SkipExtraFilesOnServer set to true beacause i don't want MSbuild to delete some files which i have only on service enviroment, but don't have on my local project. But the problem is when i actually want to remove something from project (i have web application), i usually delete file from project, then i rebuild my app, and commit the changes in project file to source control, MSbuild leave this file on service because of this parameter.
MSbuild is using Release configuration, which i specified to use "all files in this project" to deploy. So the behaviour i want to implement:
TeamCity will leave all files which are not in my project reference list. (.csproj file).
TeamCity will delete files which were in .csproj but was deleted from it.
Please help me with that task.
When we run ASP.NET through the debugger it runs in a special directory like:
C:\Program Files\Common
Files\Microsoft Shared\DevServer\10.0
I dont know if this directory is configureable. The problem is that if you have a file such as Transfer.xsl then you set its property "Copy to Output Directory" to "Copy if newer". This copies the file out to the bin.
But, we are not running inside the bin. So if I use a relative path
StorageFolder\Transfer.xsl
It becomes...
C:\Program Files\Common
Files\Microsoft Shared\DevServer\10.0\StorageFolder\Transfer.xsl
But, Visual Studio does not copy files here even when you set the property described above.
In the past I got around this problem by writing a pre-build routine to xcopy the dependencies to this "temp folder". It works, but flippen sucks caseadillas.
Is there a better way?
In ASP.NET application you could use the App_Data special folder to store files. And when you want to get the full path to this file you use the MapPath method:
string fullPath = Server.MapPath("~/App_Data/Transfer.xsl");
I am deploying a website using MSDeploy so using something like the below code.
"%ProgramFiles%\IIS\Microsoft Web Deploy\msdeploy.exe"
-verb:sync
-source:package=WebAppServer.zip
-dest:Auto
-setParamFile="was_params.xml"
-verbose
> webappserversync.log
Is there anyway to set the application pool ? I want to do this from the command line and not set it in a manifest or anything like that.
Shouldn't matter but this is in IIS7.
When you generate your package, you need to have an entry in the parameters.xml file for setting the Application Pool. When deploying, you either include a value for that in your setParameters.xml file, or use -setParam from the command line.
Here is the command I used to grab a site, which generated the proper parameters.xml file ...
msdeploy.exe
-verb:sync -source:appHostConfig="Default Web Site"
-enableLink:AppPoolExtension
-dest:package=site.zip
-declareParam:name="Application Pool",
defaultValue="Default Web Site",
description="Application pool for this site",
kind=DeploymentObjectAttribute,
scope=appHostConfig,
match="application/#applicationPool"
And to install this site from the command line, this ...
msdeploy.exe
-verb:sync
-dest:appHostConfig="MagicSite"
-enableLink:AppPoolExtension
-source:package=site.zip
-setParam:"Application Pool"="MagicPool"
Dig around in the parameters.xml file to see the entry necessary. And if you prefer, that -setParam entry can exist in your params.xml file instead.
Take a look at this answer:
Set application pool with MSDeploy and TFS 2010
Basically, you create a batch file with an adsutil script to set the app pool, and then you call MSDeploy to run that batch file on the target computer.