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"
Related
I am trying to run some sample code for ASP.NET Core and Angular 2.
I cloned the project from https://github.com/PacktPublishing/ASPdotNET-Core-and-Angular-2 and changed the sdk version in the global.json to the current version I have installed (1.0.0-preview2-1-003177). When I run the web application I get the following error page:
I grepped the project looking for the config file path but came up with nothing. I also contacted support but they aren't helpful.
Does anybody know how to change the config file path?
You must open hidden .vs folder in root of your solution folder, then find applicationhost.config file in the config folder.
... and change
<virtualDirectory path="/" physicalPath="......"
to the proper path.
I am trying to publish a project in Visual Studio 2013 that has some files with very long names, including the path location. I moved the project to a location closer to my root C:\ drive, which allows it to compile, but when publishing, it tries to copy files to the %appdata% folder which results in a name over the limit.
Here is the error I get:
Error 10 Copying file node_modules\grunt-bower\node_modules\bower\node_modules\bower-registry-client\node_modules\bower-config\node_modules\optimist\node_modules\minimist\.travis.yml to C:\Users\jake\AppData\Local\Temp\WebSitePublish\WebProject--1320288221\obj\Debug\Package\PackageTmp\node_modules\grunt-bower\node_modules\bower\node_modules\bower-registry-client\node_modules\bower-config\node_modules\optimist\node_modules\minimist\.travis.yml failed. 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. 0 0 WebProject
Is there a way to either adjust this project's name or where it copies to temporarily so that I am able to publish from Visual Studio?
Citing #Britton from Temp path too long when publishing a web site project:
Add this to your publish profile to modify the temporary directory for
package/publish:
<AspnetCompileMergeIntermediateOutputPath>c:\shortPath\</AspnetCompileMergeIntermediateOutputPath>
Or according to Website publish failing due to file path being too long (citing #Jason Beck and #VeeKayBee):
Add the following line in default PropertyGroup of web project file:
<IntermediateOutputPath>..\Temp</IntermediateOutputPath>
In addition to Amnon Shochot's answer, above, I also had to apply Roland's answer from another thread.
My publish paths (in .pubxml) now look like this:
<publishUrl>c:\publish\proj\</publishUrl>
<IntermediateOutputPath>c:\publish\inter\</IntermediateOutputPath>
<_PackageTempDir>c:\publish\package</_PackageTempDir>
You have to be careful with this:
Important: If this option is set, be sure not to nest your temporary files inside the publishUrl directory, because it will wipe out the _PackageTempDir files, causing a failed publish, even if it appears successful.
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.
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
I'm writing unit tests for an asp.net mvc project. I have a config file that I use in my tests, but for some reason, the config file has to be in in the bin folder in order to be found. Is there another way to do this as I don't feel it is best practice in having config files in the bin folder.
During compilation, your app.config file is copied automatically from the root directory to the bin folder. You shouldn't have to manually place an app.config file in the bin folder.
Assuming your project name is
MyTestProject
then after a build your bin should contain the following:
MyTestProject.dll
MyTestProject.dll.config
Plus any other referenced assemblies.
One interesting thing about this is that if, in Solution Explorer, you right click your app.config and go to properties (F4) you should see that the "Copy to Output Directory" option is set to "Do not copy". This is correct. The compiler should handle the copying and renaming. If you had the setting set to "Copy always", your bin would contain a file called app.config, which the runtime would ignore.
EDIT: If you are referencing other config files from within your app.config (or web.config for that matter) then these files will need to be deployed to the appropriate directory. An example of this might be a Spring.config file, referenced in the app.config:
<spring>
<context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="~/Spring.config"/>
</context>
</spring>