Trying to create my .cspkg Azure package file, but getting an error "Need to specify the physical directory for the virtual path..." - azure

When I try to package my Azure web app (to create the .cspkg and .cscfg files), I get the following error in my ServiceDefinition.csdef file:
Need to specify the physical directory for the virtual path
'AzurePOCWebRole/' of role AzurePOCWebRole
Here's my .csdef file:
I'm assuming the error is referring to my <Site name="AzurePOCWebRole"> piece. I try adding physicalDirectory to <Site name="AzurePOCWebRole" physicalDirectory="../AzurePOCWebRole">:
And try to create the package again, but I get the same error and it reverts that change I just made back to <Site name="AzurePOCWebRole">:
QUESTION: What can I do to resolve this error and create my package?

I was editing the "automatically generated" version of ServiceDefinition.csdef, which wasn't apparent because it didn't indicate it wasn't the actual file, so whenever I rebuilt, it reverted this file back to the original ServiceDefinition.csdef's file, which I WASN'T editing.

Related

Failed to delete a file in Azure File Share, Error: The specified resource is read-only and cannot be modified at this time

While trying to delete a file in the Azure Storage File Share. I continuously get following error:
Failed to delete file
'cs-firstName-lastname-domain-com-10033fff99999999/mslearn-my-app-folder-word-and-word-wd/.git/objects/pack/pack-someguid.idx'.
Error: The specified resource is read-only and cannot be modified at
this time
Tried to check if there are any current open handles but I see none.
https://learn.microsoft.com/en-us/rest/api/storageservices/list-handles
<?xml version="1.0" encoding="utf-8"?>
<EnumerationResults>
<Entries />
<NextMarker />
</EnumerationResults>
Also, I tried to connect to this Azure file share from Windows by running powershell cmdlet New-PSDrive, but there too and using Remove-Item, getting below error
Remove-Item : Cannot remove item
Z:\mslearn-my-app-folder-word-and-word-wd/.git/objects/pack/pack-someguid.idx: **You
do not have sufficient access rights to perform this operation**.
Any help, about how to change the property from read-only/ how can I delete/ or anything which I am missing.
Thanks,
As mentioned in the link shared by #BhargaviAnnadevara-MSFT, https://social.msdn.microsoft.com/Forums/en-US/6fde433a-aef0-49e9-8568-2aaf5a9b673a/unable-to-delete-a-file-from-azure-file-storage?forum=windowsazuredata The read-only attribute can be removed only once mounted, I did following.
Mounted the File Share using the script provided in the Azure portal
Once mounted, doing a ls command will show the file attributes
In powershell or CMD change the file attribute. I found it hard to do it via powershell so instead used ATTRIB cmd. attrib pack-someguid.idx -R
Update : Easier Solution
https://learn.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-windows#mount-the-azure-file-share-with-file-explorer

Azure Cloud Service Virtual Directory Issue

I am trying to add virtual directory in WebRole1 of my could service using following directive in csdf file...
<Site name="Web">
<VirtualDirectory name="aspnet_client" physicalDirectory="..\..\..\crazureresource\aspnet_client" />
<VirtualDirectory name="Downloads" physicalDirectory="..\..\..\crazureresource\Downloads" />
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
The development machine directory structure is...
..\CR1\CR1\ProjectFiles
..\CR1\crazureresource\aspnet_client
..\CR1\crazureresource\Downloads
The azure webrole1 directory structure is...
siteroot\0\website-deployed-files
siteroot\crazureresource\aspnet_client
siteroot\crazureresource\Downloads
The package gets published successfully; instance is also updated but WebRole's status is either 'Busy' or 'Restarting'. The website is not deployed on the webrole. If I shorten the path of virtual directory to
> ..\..\..\aspnet_clients and ..\..\..\Downloads
It works (the deployment); but the contents are modified on azure cloud service. In place of these physical folders a new folder by the name of 1 and 2 are created. Inside these two replacement folders, config files are placed by system - the original files are replaced. While at the same time in IIS, a valid link shows for virtual directory.
I am not able to access the resources from virtual directory due to this!
For Azure this is the valid directory structure
siteroot\0\website-deployed-files
siteroot\1\ ----name it as aspnet_client
siteroot\2\ ----name it as Downloads
and the contents will be availble like below urls
www.exapmple.com --- default (website-deployed-files)
www.exapmple.com/aspnet_client --contents of (aspnet_client)
www.exapmple.com/Downloads --contents of Downloads
you can update you local directroy structure to match.
for the path in csdef file
physicalDirectory="..\..\..\crazureresource\Downloads"
This is the path from /bin directory of Azure project to the Other projects Downloads.csproj directory.
Refer this for updating the Path properly in your csdef file
Hope this helps.

TFS Deployment to Azure Error: cannot find ClientPerfCountersInstaller.exe

I configured our implementation to use the Azure Caching provider to maintain session state between all cloud instances like described here:
http://msdn.microsoft.com/en-us/library/windowsazure/gg185668.aspx
This created a new startup task on my csdef file that always fails with this error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools\2.0\Microsoft.WindowsAzure.targets (987): CloudServices64 : Cannot find file named 'approot\bin\Microsoft.WindowsAzure.Caching\ClientPerfCountersInstaller.exe' for startup task Microsoft.WindowsAzure.Caching\ClientPerfCountersInstaller.exe install of role MyRole.Web.
The .exe in the nuget package and in the main folder is included in the source control that TFS uses for the deployment.
I found this previous question that addresses this same issue:
Azure Deployment Error: cannot find ClientPerfCountersInstaller.exe
But the accepted answer states to just delete the startup task that installs the .exe needed for the caching to take place.
Make sure the .exe is marked as CopyAlways so that it is copied to your \bin directory.
To do so, right click on the .exe in Visual Studio and select properties. Make sure it looks like this:
I had a similar issue with a dedicate cache worker role, but in my case the Microsoft.WindowsAzure.Caching folder never showed up in VisualStudio. In the end, I had to open the .csproj file for the worker role project and this:
<None Include="Microsoft.WindowsAzure.Caching\ClientPerfCountersInstaller.exe.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Microsoft.WindowsAzure.Caching\ClientPerfCountersInstaller.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Microsoft.WindowsAzure.Caching\PerformanceCounters.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
I put that within the same <ItemGroup> tag as the app.config file, and now it's deploying as it should.

VS 2012 Publishing Profiles and Copy Files Using MSBuilld Commands

I've set up asp.net website on Azure with TFS online for source control using VS 2012. I'm trying to copy files using VS 2012 new publishings profiles and MSBuild. Reading this article Visual Studio 2012 Web Deployment Projects are Dead – Long Live Publishing Profiles, in which Doug says you can use build scripts in your publishing profile.
So I setup a test that works in my .csproj on my local build. I'm just simply copying the robots.txt file from the root directory to the css directory. Here is my test. I set my pubxml in the TFS Build Process template under process > 6. Publishing -- Azure Website, Web Deploy Pubish Profile.
<Target Name="AfterBuild">
<Copy SourceFiles="$(ProjectDir)robots.txt" DestinationFolder="$(ProjectDir)css\" />
</Target>
I dropped this Code into my my pubxml file and I get a big nothing. What am I doing wrong?
Is it possible to copy files afterbuild on Azure?
Additional Information
The log file contains these lines so I'm sure the publishing profile is running.
AfterBuild:
Creating directory "C:\a\src\...\css".
Copying file from "C:\a\src\...\robots.txt" to "C:\a\src\...\css\robots.txt".
Here are the build steps that Azure's default build template uses:
ValidateSolutionConfiguration:
PrepareForBuild:
CoreCompile:
_CopyFilesMarkedCopyLocal:
CopyFilesToOutputDirectory:
GenerateTargetFrameworkMonikerAttribute:
CoreCompile:
_CopyFilesMarkedCopyLocal:
CopyFilesToOutputDirectory:
_CopyWebApplicationLegacy:
ValidateGlobalPackageSetting:
CollectFilesFromIntermediateAssembly:
CollectFilesFromContent:
CollectFilesFromIntermediateSatelliteAssembliesWithTargetPath:
CollectFilesFromReference:
CollectFilesFromAllExtraReferenceFiles:
CollectFilesFrom_binDeployableAssemblies:
PipelineCollectFilesPhase:
ExcludeGeneratedDebugSymbol:
PreTransformWebConfig:
TransformWebConfigCore:
PostTransformWebConfig:
PreProfileTransformWebConfig:
PipelineTransformPhase:
ProcessPublishDatabaseSettings:
PreAutoParameterizationWebConfigConnectionStrings:
AutoParameterizationWebConfigConnectionStringsCore:
PostAutoParameterizationWebConfigConnectionStrings:
PipelineMsdeploySpecificTransformPhase:
ValidatePublishProfileSettings:
CopyAllFilesToSingleFolderForMsdeploy:
PipelineCopyAllFilesToOneFolderForMsdeploy:
Package:
GenerateMsdeployManifestFiles:
PackageUsingManifest:
GenerateSampleDeployScript:
PipelineDeployPhase:
AfterBuild:
So it looks like Azure packages all the files up during the "31. CopyAllFilesToSingleFolderForMsdeploy" step. It would appear that running copy during the AfterBuild step is to late. I moved the Copy command to the target "BeforeBuild" but the files are still not ending up in the CopyAllFilesToOneFolderForMsdeploy step.
Thanks to Sayed Ibrahim Hashimi for his article How to compress CSS/JavaScript before publish/package for helping me solve this.
It's possible to copy directly Package Temp Directory. I ended up adding this target to my publishing profile (pubxml) file. After the "CopyAllFilesTOSingleFolderForMsdeploy" step finishes this step will run which will copy a file from one part of the solution into the destinationfolder you specify.
<Target Name="AdditionalFilesForPackage" AfterTargets="CopyAllFilesToSingleFolderForMsdeploy">
<Copy SourceFiles="$(ProjectDir)robots.txt" DestinationFolder="$(_PackageTempDir)\css\" />
</Target>

Cruisecontrol.net with UCM Clearcase - How to?

I am trying to configure Cruisecontrol.net for UCM Clearcase for the first time. Following is the sourceControl tag in the ccnet.config file:
<sourcecontrol type="clearCase">
<branch>123_India_Release</branch>
<autoGetSource>true</autoGetSource>
<viewName>admin_123_CRUISE</viewName>
<viewPath>$(ViewDirectory)</viewPath>
<useLabel>false</useLabel>
<useBaseline>false</useBaseline>
<executable>cleartool.exe</executable>
</sourcecontrol>
I constantly receive the following error:
ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control
operation failed: cleartool: Error: Not an object in a vob: "PATH TO
THE VIEW"
When I run cleartool from an arbitrary directory with the following parameters:
cleartool.exe lshist -r -nco -branch "123_India_Release" -since
05-Dec-2012.14:38:18 -fmt
I get the same error. But if I change the working directory to $(ViewDirectory) before running cleartool, it runs fine.
How should I make Cruisecontrol.net run cleartool.exe from the $(ViewDirectory)?
I have already tried adding <workingDirectory>$(ViewDirectory)</workingDirectory> tag before <executable>cleartool.exe</executable> but it did not work.
Any help would be appreciated.
EDIT 1:
As a workaround I have done the following:
<exec>
<executable>cleartool.exe</executable>
<baseDirectory>d:\Workspace\123_India_Release\VOB</baseDirectory>
<buildArgs>update -force</buildArgs>
<buildTimeoutSeconds>6000</buildTimeoutSeconds>
</exec>
I have added this to the tasks tag. I have configured an hourly trigger which does the following:
1) Update snapshot view
2) Build the VS 2010 solutions mentioned in the tasks tag.
The limitations are:
1) The trigger is hourly. I want it to be a commit based trigger.
2) This is a workaround
EDIT 2:
Further experimentation revealed that the ccnet.exe works fine. It does all that is needed. The issue is caused by the service ccservice.
I have stopped ccservice for now and started ccnet.exe. I plan to leave it running.
The View directory isn't enough: you must specify a vob.
See for instance:
"clearfsimport: Error: Not an object in a vob: "\"." (as an illustratio of that error message)
this thread (or this one): "You have to specify explicitly the VOB(s) to check for modification set"
The path should looks like:
<viewPath>Drive:\path\to\view\vobname</viewPath>
If your $(ViewDirectory) already references Drive:\path\to\view, then you could use:
<viewPath>$(ViewDirectory)\vobname</viewPath>

Resources