In a solution, I have three projects (for the sake of this example):
- MyWebJob
- MyFrontendWebsite
- MyBackendWebsite
/Views/EmailTemplates/SomeEmailTemplate.cshtml (file in MyBackendWebsite)
When deployed, MyWebJob runs as we webjob below MyFrontendWebsite.
However, it needs the email templates from the MyBackendWebsite Emailtemplates folder.
I think the solution could be...:
Publish the EmailTemplates as an artifact.
During release, copy that artifact to the webjob folder, using a "Copy Files" task.
The problem is, I don't know what to enter in the Target Folder.
Using KUDU, I know that the webjob is stored in
D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob, but setting that as the target folder does not copy anything, despite the release log file telling me it did copy the file to that folder...
2017-10-25T15:09:11.7357129Z ##[section]Starting: Copy Files to: D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob
2017-10-25T15:09:11.7591720Z ==============================================================================
2017-10-25T15:09:11.7591720Z Task : Copy Files
2017-10-25T15:09:11.7591720Z Description : Copy files from source folder to target folder using match patterns (The match patterns will only match file paths, not folder paths)
2017-10-25T15:09:11.7591720Z Version : 2.117.0
2017-10-25T15:09:11.7591720Z Author : Microsoft Corporation
2017-10-25T15:09:11.7591720Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=708389)
2017-10-25T15:09:11.7591720Z ==============================================================================
2017-10-25T15:09:14.3013048Z found 1 files
2017-10-25T15:09:14.3013048Z Copying d:\a\r1\a\MyBuildDefinition\EmailTemplates\SomeEmailTemplate.cshtml to D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob\EmailTemplates\SomeEmailTemplate.cshtml
2017-10-25T15:09:14.3043047Z ##[section]Finishing: Copy Files to: D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob\EmailTemplates
2017-10-25T15:09:14.3093036Z ##[section]Finishing: Release
What am I missing here? How do I copy that email template to where the webjob can get to it?
Pre-empting what I myself would have asked...:
Q: Why not just put the templates in the webjob project in the first place?
A: Because the template is actually used in the MyBackendWebsite as well, to preview emails.
You're copying files to the folder D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob\EmailTemplates on your release agent.
You need to use the Windows Machine File Copy task to copy the files to the appropriate server.
Related
I am using azure devops to host my angular application on azure appservice and it's working great. I have two files in my src folder of project and I want to move or paste those files into the wwwroot directory where my application's published code is placed.
If I add dist in the Target Folder of "Copy Files To" then files copying to the dist folder as you can see in the second image. But If i place wwwroot then after completion of this pipeline the message shows that Copying "D:\a\1\s\src\server.js to wwwroot\server.js" but if i see the directory then these files are not showing any where. I have tried $(Build.ArtifactStagingDirectory) in the Target Folder also but it's not working though. How can i copy the files from src to wwwroot?
1.You should make sure the target folder and the folder to publish is the same folder.
For example: If you copy those two files directly into $(Build.ArtifactStagingDirectory), then your Publish Artifact Task's Path To Publish should also be $(Build.ArtifactStagingDirectory).
2.Then in your Azure App Service Deploy task(if this task is in release pipeline), you should make sure the path is correct to find the drop folder:
(Use the button to find the artifact path, and add /drop)
3.Finally in Azure Web Portal, navigate to App Service=>Configurations=>Virtual path and make sure the physical path is wwwroot instead of wwwroot\dist:
Then it works well on my side to deploy the files in wwwroot folder.
I'm running Cypress in one of my release stages and it gives me this output:
Finished processing: D:\a\r1\a\_ClientWeb-Build-CI\ShellArtifact\tests\integration\cypress\videos\onboarding.spec.js.mp4 (0 seconds)
I have 2 questions:
Is the path name relative to the app service? If I have a app service called randomname and run the Cypress Stage on that randomname app service should I be able to find tCypresshe output in randomname.scm.azurewebsites.net.
If I go into the scm debug console and I do cd D:\a\ I get:
cd : Cannot find path 'D:\a\' because it does not exist.
So how do I actually access my Cypress test results?
I've also tried archiving the files into a zip file:
In the output of the task step I see:
Creating archive: d:\home\testing\somefile.zip
But when I try to access the D:/home/testing folder on my appname.scm.azurewebsites.net I get:
cd : Cannot find path 'D:\home\testing' because it does not exist.
The path D:\a\r1\a is inside the hosted agent that run the release pipeline, is not in your application.
The same thing is for the zip file, when you specify d:/home/... is in the agent.
After the release is finish all the files are deleted, so you need to save the file in another place (maybe in azure?) during the pipeline, for example, with "Azure File Copy" task.
I've configured TeamCity for build and deploy IIS app.
Everything works fine. Here is my command line param:
-verb:sync -source:package="webapi-%dep.xxx.build.counter%.zip"
-dest:contentpath="C:\inetpub\wwwroot\test2.com\bin",computerName="www",userName="uuu",password="ccc",includeAcls="False"
-AllowUntrusted -verbose
So, artifacts zip file should extract files to C:\inetpub\wwwroot\test2.com\bin folder. In bin folder i have a lot of xml and config files (zip file dont include this files). In every deploy it delete bin folder and extract zip files.
How can I skip deleting? I just need publish with replace what i have in archive without deleting another files?
Thanks for help
add one more parameter:
-enableRule:DoNotDeleteRule
according to doc:
In a sync operation, blocks deletions of files on the destination computer that do not exist on the source computer. This rule applies to the contentPath, dirPath, and filePath providers. This rule is disabled by default.
I am deploying my ASP .Net Core 2.0 app to my remote server using FTP. Remote Server is using IIS 8. When I publish my app, I get the following error.
Unable to add 'Project.dll' to the Web site. The process cannot access the file because it is being used by another process (550).
I been able to bypass this by manually creating an app_offline.htm first on the publish directory, and then publishing my app via Visual Studio 2017.
I was wondering, is there an easier way of doing this? or is there an easy way I can script this, so that app_offline gets created automatically before publish? and then deleted after publish?
Anyone that's curious, I gave up depending on VS to publish my .NET Core project. I'm now using WinSCP and _PublishToWeb.bat script I created to accomplish the task.
I first created a file called _app.offline.htm on root directory my publish folder. Then when I need to publish, I run the script below.
This script does the following:
1. Builds the .NET Core project to a specific folder, let's call it "_dist" folder.
2. Connects to my ftp server/publish folder and renames "_app_offline.html" to "app_offline.html", so that the server goes offline.
3. Synchronizes _dist folder with publish folder.
4. When done, changes "app_offline.htm" to "_app_offline.html", so the website is restarted.
_PublishToWeb.bat
echo off
echo Publishing to ProjectName (Optional)
set ProjectRemoteFolder=RemoteFolderName
set ConnectionString=ftp://username:password#serverIp:serverPort
set WinSCP="path to WinSCP.com"
set ProjectDistPath="a folder where dotnet publish will build the project to"
set WebAppProject="path of the project. dotnet publish will run here"
rem Build project and put it in to distribution folder
cd %WebAppProject%
dotnet publish -c Release -o %ProjectDistPath%
rem Connect to FTP and synchronize folder
%WinSCP% /command "open %ConnectionString%/%ProjectRemoteFolder%/" "mv _app_offline.htm app_offline.htm" "synchronize remote %ProjectDistPath%" "mv app_offline.htm _app_offline.htm" "exit"
rem pause
I'm sure there are better solutions out there, but this has been working well for me so far.
TFS Version: 14.102.25423.0 (Tfs2015.Update3)
In my build definition when I set the Path argument of the
Publish Build Artifacts step
with
Artifact type: File share
to
\VSALM\share
Behind the scene this build step executes a node.js script function which is called recursively, but there is a bug and the function repeats itself over and over again while trying to create the drop folder**.
The failing node.js script is
mkdir.js
and resides below the build agent folder:
agent\tasks\PublishBuildArtifacts\1.0.28\node_modules\shelljs\src\mkdir.js
Name of the failing function is:
mkdirSyncRecursive
The error msg:
016-07-23T21:22:02.3703397Z shell.js: internal error
2016-07-23T21:22:02.3703397Z RangeError: Maximum call stack size
exceeded
--> Stackoverflow
When I enter an absolut path like
c:\workspaces\share
I get this error:
2016-07-23T21:03:07.5727256Z shell.js: internal error
2016-07-23T21:03:07.5727256Z Error: EEXIST: file already exists, mkdir
'C:\workspaces\share'
Workaround
When I set the drop folder to (escaped network share path):
\\\\VSALM\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)
Then the build step succeeds but the files are not dropped under the path of the share.
They are dropped here in my case:
C:\VSALM\share\MyBuildDefinition\20160723.7\drop
I don't know why it doesn't work with my share set to:
C:\workspaces\share
but it works when I create a network share in
C:\drop\share
and set the drop folder path in my build definition to:
\\\\drop\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)
Question:
Someone knows how to fix this script?
"Publish Build Artifacts" task publishes the build output to a shared network path when you select "File Share" type. The "Maximum call stack size exceeded" error usually occurs when the shared network path cannot be found. Please check if the "Path" you entered is correct and can be accessed from the build agent. The format is usually like following:
\\hostnameoripaddress\sharedfolder
When you enter a path with "\\\\" prefix, the task will copy the output to the root of the drive where the build agent located. For example, your build agent work folder is placed in C drive, when you specify "\\\\VSALM\share" as the path, it will copy files to "C:\VSALM\Share" folder(It will create the folder if the path does not exist).