MSDeploy skip root web.config - msdeploy

I can't get msdeploy to skip only the root web.config (I want to keep any web.config files that exist in sub folders below the root)
This is the parameter I am using:
-skip:objectName=filePath,absolutePath=^\\web\.config
I have tried ^\\web\.config, \\web\.config and the absolute path to the file, e.g.: C:\\Some Path\\web\.config. None of those seem to work.

I managed to sort this out.
You have to use the full source path in order to skip the target root web.config only. msdeploy appears to use the source path for this regex filter.
like this:
-skip:objectName=filePath,absolutePath=\\\\servername\\c\$\\syncpath\\web\.config
Hope this helps somebody else out in the future.
EDIT - ADDITIONAL INFORMATION
On top of this, if you are skipping a web.config file in a sub directory you also need that target dir and web.config in the regex, like so:
-skip:objectName=filePath,absolutePath=\\\\servername\\c\$\\syncpath\\web\.config|TargetFolder\\web\.config
This will stop msdeploy from issuing a delete directive on the target web.config.
Note that the regex compare is case-insensitive.

Related

MSdeploy skip root webconfig

I was able to skip deploying webconfig on root folder by following approach
MsDeploy Skip Root Web Config deployment only
However i have another folder containing web.config apart from "views" folder which needs to be negated from skip arguement.
I tried following which seems to be incorrect regular expression and didnot work
absolutePath="(?<!Views|Configs)\\Web\.config"
where Configs is the folder containing webconfig file. what should be right one
I got it working by this
absolutePath="(?<!Views)(?<!Configs)\\Web\.config"

How to stop git (.gitignore) from tracking minqueue (wordpress plugin) cached changes

After entering "git status", I keep getting messages like wp-content/uploads/minqueue-cache/minqueue-9cbb4cb4-9cb6af13.js
even though I have added the following line to .gitignore file: /wp-content/uploads/minqueue-cache/*
. Why is this?
The slash in the beginning of /wp-content/uploads/minqueue-cache/* means starting from the directory where the .gitignore file is in, so your pattern will match all files and folders inside wp-content/uploads/minqueue-cache/ but not the files inside www.apis.de/wp-content/uploads/minqueue-cache/.
If you change the pattern to wp-content/uploads/minqueue-cache/* it will match all files and folders in all wp-content/uploads/minqueue-cache/ folders, no matter where they start.
If you change the pattern to /www.apis.de/wp-content/uploads/minqueue-cache/* it will match all files and folders exactly in this one directory.

Website publish failing due to file path being too long

I am trying to publish a Website project from a vendor that has ridiculously long paths to some of its files. When publishing, the error is:
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
When I publish, Visual Studio 2012 Update 3 is attempting to write to a temp directory, and the prefix is quite long:
C:\Users\cuser\AppData\Local\Temp\WebSitePublish\MidasCMS400v9-1580334405\obj\Debug\Package\PackageTmp\
I thought I might be able to redirect VS to a different temporary directory at c:\tem by following this SO answer: Temp path too long when publishing a web site project
I create my publication profile, and as soon as I open it, there is an error indicating that WebPublishMethod is not an element of PropertyGroup. Regardless, I updated the file so it looks like this:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:\Sites\MidasPublish</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<AspnetCompileMergeIntermediateOutputPath>c:\tem\</AspnetCompileMergeIntermediateOutputPath>
</PropertyGroup>
</Project>
When I try to publish, I get the a modal box pop-up entitled "File Modification Detected", with the message "The project YourWebsite has been modified outside the environment", and it asks me if I want to reload. In my error list, I continue to get the error about the path being too long, as it is not attempting to use the c:\tem directory I identified.
I need to put this bloody thing onto a server, I am up for any solution that allows me to publish the bloody thing. I don't know much about the Website project template, so please let me know if there is a better way.
From http://forums.asp.net/t/1944241.aspx?Website+publish+failing+due+to+file+path+being+too+long
Add the following line in default PropertyGroup of web project file.
<IntermediateOutputPath>..\Temp\</IntermediateOutputPath>
You can likely make the above path C:\temp or ......\Temp (as needed to get it as close to root of the drive as possible.
In my case, there was no .csproj or .vbproj (website project file) but there was a website.publishproj file that warns you not to edit it, but I did anyway, and it did the trick.
Thanks to Stelvio, from http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2156195-fix-260-character-file-name-length-limitation , there is a solution :
Well, I found a workaround that ALLOW work with path with more than 260 chars.
Disclaimer: I've tried this trick only on Windows 8 x64 and Visual Studio 2013
So, to make it work I've just create a junction to the folder with the mklink command:
Assume this is the original path: d:\very\very\long\path\to\solution\folder, you can obtain a short link as d:\short_path_to_solution_folder just jaunching this command from a dos shell as administrator:
mklink /J d:\short_path_to_solution_folder d:\very\very\long\path\to\solution\folder
change source and destination path to you needs
Best Regards!
Stelvio
from this link :
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2156195-fix-260-character-file-name-length-limitation
While moving the project closer to the root file does work. I found a link to a solution that did work for me. The site also does a great job at discussion the issue as well as the details behind his solution.
Sayed Hashimi's solution to long path issue
EDIT:
To Summarize the provided link:
You can update your publish profile file, which is used by MSBuild, to include a replace rule that will shorten the path of your output when publishing to a web deploy package (Zip file).
For example, let's say publishing using the default profile created by Visual Studio, we get the following paths in the zip file:
archive.xml
Content\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp
Content\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\bin
Content\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\bin\WebApplication1.dll
Content\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\index.html
Content\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\Web.config
parameters.xml
systemInfo.xml
The trick is to replace all of the path defined after Content with a shorter path. In this particular example, replace the path with "website" in the PackagePath element.
One can edit the publishing profile file (.pubxml) and add the follow lines near the end of the file, just before the Project element is terminated.
<PropertyGroup>
<PackagePath Condition=" '$(PackagePath)'=='' ">website</PackagePath>
<EnableAddReplaceToUpdatePacakgePath Condition=" '$(EnableAddReplaceToUpdatePacakgePath)'=='' ">true</EnableAddReplaceToUpdatePacakgePath>
<PackageDependsOn>
$(PackageDependsOn);
AddReplaceRuleForAppPath;
</PackageDependsOn>
</PropertyGroup>
<Target Name="AddReplaceRuleForAppPath" Condition=" '$(EnableAddReplaceToUpdatePacakgePath)'=='true' ">
<PropertyGroup>
<_PkgPathFull>$([System.IO.Path]::GetFullPath($(WPPAllFilesInSingleFolder)))</_PkgPathFull>
</PropertyGroup>
<!-- escape the text into a regex -->
<EscapeTextForRegularExpressions Text="$(_PkgPathFull)">
<Output TaskParameter="Result" PropertyName="_PkgPathRegex" />
</EscapeTextForRegularExpressions>
<!-- add the replace rule to update the path -->
<ItemGroup>
<MsDeployReplaceRules Include="replaceFullPath">
<Match>$(_PkgPathRegex)</Match>
<Replace>$(PackagePath)</Replace>
</MsDeployReplaceRules>
</ItemGroup>
</Target>
Now, the publish profile paths should look something like the following:
archive.xml
Content\website
Content\website\bin
Content\website\bin\WebApplication1.dll
Content\website\index.html
Content\website\Web.config
parameters.xml
systemInfo.xml
The answer of Jason Beck worked to me with a small change. To avoid the error "The IntermediateOutputPath must end with a trailing slash." use the "\" at the end of the path:
..\Temp\
Your "CONFIG_PUBLISH_FILE.pubxml" should look like this (The "..." omits other configuration that you file may have):
...
...
..\Temp\
...
At the time of publishing the project, the visual studio compiler checks the size of the files that are part of the project.
So I searched for long names in files.
I found and renamed those files.
Did Work perfectly
In my case it was because the default legacy string length limitation of windows. This was still set to 256-character limit.
To fix this, from an admin powershell session I ran the following command
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
I needed to reboot the system for the changes to take effect.
Microsoft reference document link here
This error comes because of long path name....U just cut your folder from current location to D drive or F drive. suppose your project folder name is "myproject", and you should cut this folder and paste to D drive of F drive,that your current path name will be D:\myproject or F:\myproject. Then you publish again......It will work...

how do I skip files and the directories that contain them with the skip directive in msdeploy?

We are deploying a website to a DFS share. DFS creates shortcut files with the name .DFSFolderLink.lnk in various locations. Admins on the box do not have rights to delete this shortcut file. So if any exist I need to exclude them from deployment, so that they will not be deleted.
I can already exclude the .DFSFolderLink by passing -skip:File=.DFSFolderLink.lnk to msdeploy. However, if the directory that contains the shortcut file does not exist in the package being deployed, then an error is raised because it tries to delete the folder but cannot because the shortcut file still exists.
How can I get it to exclude the shortcut file and the directory that contains it without knowing ahead of time what the directory name is?
If you don't know the name of the directory, you can't skip it. What you can do is tell msdeploy to ignore the "directory not empty" error using the ignoreErrors provider setting:
msdeploy -verb:sync -source:... ^
-dest:auto,ignoreErrors=80070091,computerName=... ^
-skip:File=\.DFSFolderLink.lnk

Why files under bin folder cannot be found?

I inside my httpdocs(www), i created a folder called "bin", i put an "test.html" just to display "Hello Stackoverflow", but when I go access the page, i.e http://domain.com/bin/test.html, it says Page Cannot Be Found. But when I move the file to test folder, it display what it should be. Why?
In general, the default config, as part of generally good security practice won't be configured to do anything that isnt normal (like doing stuff other than executing stuff in the bin directory, or stuff that wouldnt normally happen in the base directory). In general, I'd say you should be trying to fit in with this, rather than going against the grain.
Possibly permissions.
chmod 755 /Path/To/Bin/
chmod 644 /Path/To/Bin/test.html
Apart from the evident "check permissions" answer and asuming you are using Apache server you may need to add a .htaccess file with the right permissions in each folder.
Look for .httaccess in other folders and remember to use ls -a ( file begining with dot are hidden by default -a = All )
By the way, it may be a bad practice to put html files in a binary folder.

Resources