Unfortunately we need to use a Visual Studio Website Project not a Visual Studio Web Application Project!
That means that our website to publish has no .csproj
We now try to setup git deployment for our azure website. however it tells me there is no project file to deploy. It seems that the azure git deployment always tries to deploy a web application project not a website project.
Do you know how i can tell the git deployment to make a website project deploy?
best
laurin
I think this is what you're looking to Customize your deployment this is done by including a .deployment file in the root of your application. It will instruct kudu the deployment engine in Azure Websites which folder to deploy instead of relying on the csproj.
Add a .deployment file to the root of your repository.
.git
.deployment <----- this file
DirOne
DirTwo
WebsiteRoot <----- points to this directory
App_Data
bin
etc
Web.config
Add the following lines to the .deployment file.
[config]
project = DirOne/DirTwo/WebsiteRoot
See also: https://github.com/projectkudu/kudu/wiki/Customizing-deployments#deploying-a-specific-folder-for-a-node-php-or-aspnet-site
Related
My repository contains an Asp.Net app, and a React app in seperate folder. I need to do a deployment to an Azure App service from a VSTS release.
Repository Root
MyAspNetApp
MyReactApp
The Asp.Net application is an MVC application. If it detects you on mobile it servers up the react app.
The react app is built using WebPack. When you do a production build, it copies the output into a folder called 'app' in the MyAspNetApp project. The production build can be run via 'npm run build-prod'.
When I was doing git deployments (kudu), I just added a command to the deploy.cmd to call 'npm install' and 'npm run build-prod'. Then another command to copy those files to the root of the deployment directory ('wwwroot').
Now that I am using VSTS to build and deploy (separate steps), I can't figure out how to get that 'app folder into wwwroot. In a build step I tried taking the stuff from the 'app' folder and putting it in an artifact called 'mobile'. Then in a deployment step, using a 'Copy Files' step to copy the 'mobile' artifact to $(build.artifactstagingdirectory)/app, but they don't show up in wwwroot on azure.
What am I missing here?
edit: cross posted here in MS VS Community site in hopes of getting a response. I will update this post if I get an answer there.
With Azure App Service Deploy task, if you check Publish using Web Deploy option, you need to put all necessary files in a zip file and specify this file in Package or folder input box.
You also can uncheck Publish using Web Deploy option and specify the root folder path of app.
Refer to these steps to do it:
Publish MVC application with File System publish method through Visual Studio build task
Run NPM commands to build React app through NPM task
Copy react app’s built files to necessary folder of MVC app deployed folder
(optional) Zip folder through Archive Files if you want to publish using web deploy
Add Azure App Service Deploy task (can be in release) and specify package or folder.
I am on .Net Core 2.0.
I create a new solution containing a webapp and a website. The website project contains an index.html and web.config file.
I have no issue publishing the web application, but the website causes me some trouble.
I added a publish profile configured for FileSystem publish method.
When I run dotnet publish on the default .publishproj generated, I get the following error message
error MSB4019: The imported project
"C:\ProgramFiles\dotnet\sdk\2.0.0\Microsoft\
VisualStudio\v10.5\Web\Microsoft.Web
Site.Publishing.targets" was not found. Confirm that the path in the
<Import> declaration is correct, and that the file exists on disk.
Ok, so I change the website.publishproj value to where the targets file is located.
<!--<Import
Project="$(_WebPublishTargetsPath)\Web\Microsoft.WebSite.Publishing.targets"
/>-->
<Import Project="C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\
Microsoft.WebSite.Publishing.targets" />
Then I get
error MSB3030: Could not copy the file
"C:\Users\Administrator\AppData\Local\Temp\WebSitePublish\WebSite2-
1026028577\obj\Debug\website.exe" because it was not found.
[C:\Users\Administrator\Documents\visual studio
2017\WebSites\WebSite2\website.publishproj]
I can publish the website using visual studio without any issue. What am I missing?
It looks like you are trying to use the dotnet CLI tooling to publish "classic" website projects which is not supported. Use msbuild from the developer command prompt instead.
I want to deploy my .Net project from GitHub repository to the azure server.
In Deployment options I am getting Building failed error.
Here are screen shots of my Deployment details and Logs
1- Deployment Details:
2- Activity Log:
According to your description and logs, I found you have error in MSbuild step.
The error shows some files not found in your project. I suggest you could exclude the related files in the csproj file or make sure the related files is in your project.
Besides, I suggest you could firstly clone the project to your local and test it , make sure the project could build well without any error then publish to the GitHub and deploy to the azure.
Update:
I also write a test demo on my computer and I reproduce your error.
Error image:
I think in your project you have inclued the bin and obj folder into your project and then you push the project to the github.
Like below:
After you push the project to the github, the csporj file will include all the bin and obj references.
Like below:
This is the reason about your MSBuild fail.
So I suggest you uninclude all the bin and obj folder in the local and push to the github again. Then it will work well.
Azure looks in your site/repository/packages folder for all the packages your app uses. By looking through it you will find that visual studio doesn't deploy all of the files from your local packages folder to the azure one. MSBuild needs these files when you push to git and trigger a build. Ftp into your azure site and look for the packages folder. Upload every missing file (dll) from your local folder to the azure one. This worked for me and now I can trigger a build and deployment from bitbucket to azure app service upon a push.
Additionally, if you have other projects in your VS solution and you are using VS to build those projects and then put the dll into your main projects bin folder, that will cause a missing file error also. I create a folder in my packages folder and link the dll to my main folder from there. That way when you perform the fix above, the file needed by your main project is in the packages folder also.
I hope this helps!
We have some configuration files in our web application, e.g. settings.js that are specific to a given environment and created during the initial setup of the web page. We are building a web package using visual studio 2015 and deploy the package using the generated cmd file (web deploy 3.5).
I have tried many suggested solutions to have the file not being updated or removed when deploying a new version of the web package but nothing has worked so far.
Any suggestions on how this can be done? Basically, the settings.js file on the server should just be ignored and not touched at all by the upgrade.
I thought that would be something very basic and that web deploy could handle very easily.
You need to ignore the file when packaging via MSBuild:
<ItemGroup>
<DeploymentFiles Include="$(MSBuildProjectDirectory)/_deployment/**" />
<ExcludeFromPackageFiles Include="#(DeploymentFiles)">
<FromTarget>Project</FromTarget>
</ExcludeFromPackageFiles>
</ItemGroup>
http://www.dotnetcatch.com/2016/05/19/extending-the-webdeploy-manifest/
And also want to not delete existing files on the site that aren't in the package using the following MSDeploy flag:
-enableRule:DoNotDelete
http://www.dotnetcatch.com/2016/02/01/webdeploymsdeploy-quick-tip-keep-existing-files-during-deployment/
I am using WebDeploy to deploy a node website to azure.
I've seen in samples and demos that it should trigger a npm install on deploy.
But it is not. I've also seen almost every demo uses git deployment.
Is automatic npm install not supported for WebDeploy or am I missing something?
when you use WebDeploy, it will just copy over all the file from your machine to cloud, it will not trigger any build process. You will have to responsible to make sure your app is ready to run.
if you want CI function, please setup continues deployment, here is tutorial for setting up local git
https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/
and there are other options if you have repository in github/bitbucket/Visual studio Team Service etc ... (go to https://portal.azure.com, select your site --> all settings --> continuous deployment to see all supported optinos)
According to the doc Publish to Microsoft Azure Website using Web Deploy, it said
Deployment will include all the files in your project. Files in the node_modules folder are included automatically, even if they are not part of the project.
So all files under your project folder in VS, including the node_modules folder, will be deployed.