MSBuild in VSTS deploy web app on root - asp.net

I am trying to Continuous Delivery my ASP.NET WEB API 2 app with Visual Studio Team Services (VSTS).
I created Release with Deploy Azure App Service task with default settings (i changed only Package or Folder field to match my bin\Release folder)
Build and deploy were successful, but nothing changed. When I open DebugConsole/CMD in Diagnostic Console (app-name.scm.azurewebsites.net) I saw that VSO put all binaries to the ...\wwwroot, while Visual Studio puts all binaries to ...\wwwroot\bin folder.
WWWROOT structure with Visual Studio Publish... task
...\wwwroot
Web.Config
Global.asax
packages.config
bin\
*.dll
WWWROOT structure with Visual Studio Online Deploy Azure App Service task
...\wwwroot
Web.Config
Global.asax
packages.config
*.dll
How can I set target folder on deploy?

Related

Deploy ASP.NET Core Razor page to Azure App Service

I'm trying to host a ASP.NET Core RazorPages project in Azure App Service.
As an example I've created a new project and that's the app I want to publish.
At first: the publish function from VS2019 (CE) failed with an exception. It is a common exception and I'm not investigate more time in in.
So I thought: I publish it using the portal. So i have a Free account of Azure, create a Resource Group, a Hosting Plan and a Web App. Then i've upload my website using OneDrive and that works.
I've add the ASP.NET Core 3.1 (x86) Runtime to the extensions and the stack is .NET Core (32 bit, because of free plan). I've build the app also for x86.
But the application doesn't work. When I add a default Index.html to the application it works (but not the Razor Pages).
Who can solve this problem??
Regards
Donovan
Looks like you copied too many files to your App Service. The bin/debug and/or bin/release folders should not be there. You need to prepare the website for deployment. In Visual Studio, you can do so by doing a right-click on the ASP.NET project and selecting 'Publish'. On the page that opens, configure a local publish to a folder. The contents of that folder should then be copied to the App Service.
For more information, see Deploy an app to a local folder using Visual Studio.
Also interesting: Host and deploy ASP.NET Core
The dotnet publish command compiles app code and copies the files required to run the app into a publish folder. When deploying from Visual Studio, the dotnet publish step occurs automatically before the files are copied to the deployment destination.
Folder contents
The publish folder contains one or more app assembly files, dependencies, and optionally the .NET runtime.
A .NET Core app can be published as self-contained deployment or framework-dependent deployment. If the app is self-contained, the assembly files that contain the .NET runtime are included in the publish folder. If the app is framework-dependent, the .NET runtime files aren't included because the app has a reference to a version of .NET that's installed on the server. The default deployment model is framework-dependent. For more information, see .NET Core application deployment.
In addition to .exe and .dll files, the publish folder for an ASP.NET Core app typically contains configuration files, static assets, and MVC views. For more information, see ASP.NET Core directory structure.

VSTS won't publish *.resx and *.rldc files after successful build

I have a ASP.NET Web Application using MVC5 Razor. I am using VS2017 Team Explorer (Git) for versioning and on push am building my web application within Visual Studio Team Services. After build success I deploy to Microsoft Azure. Everything works as expected except that on Release my set-up and configuration won't publish the App_GlobalResources (containing my resource files for language) and CommonReports (containing my visualized reports from Microsoft.ReportViewer) folders and files.
Folder content
/App_GlobalResources/
- Resource.resx
- Resource.de.resx
/CommonReports/
- CustomerRatingsReport.rdlc
File properties
Resource.resx
Resource.de.resx
CustomerRatingsReport.rdlc
Azure Release Definition
When I publish manually within Visual Studio 2017 (Right-click on file / folder, "Publish ", the files are successfully published to azure and the application works fine.
The files are available within my repository.
How can I automatically publish these files on successful build?

App_Code in local IIS and Azure/TFS build

I am using Visual Studio Express 2013 for Web & developing web APPS ( not sites ) on .net 4.5.
I build,test & view my site on a local IIS 7.5.
I host on Azure - using App Services.
I build and release to an App Services slot using VSTS Online
I have my classes in an App_Code folder - files are marked as compile
This appears to be the only way I can set this up to work on local IIS ( or am I missing something ?)
And it all works - all classes are available
But I need to build and release on VSTS/TFS ( using VS Team explorer to push)
I am using the standard Azure Web App build definition module on TFS -
Which takes the App_Code folder and moves it into the bin folder - but does not compile it - thus breaking the classes when they are deployed
I have tried renaming App_Code but that breaks local and still does not compile on TFS
What am I missing - how do I get TFS to either compile my classes OR copy the App_Code folder to the root ( not ideal but hey it works )?
In TFS, dll files will be generated under bin folder when you build a Class Library project. This is the correct phenomenon. Suggest you to create a Nuget Packages to manage your class libraries . And you can add a "NuGet Installer" task at the top of your build definition to restore the nuget packages for your solution.
If you are using vNext Build on TFS. There also has been a very detail tutorial Build and Deploy Azure Web Apps using Team Foundation Server/Services vNext Builds for you reference.

How to automatically add recycleApp provider in the *.deploy.cmd file generated by Visual Studio

Is it possible to configure Visual Studio 2010 to add the recycleApp provider and its value in the deploy.cmd file it generates when building a web deploy package?
W3wp is locking a file in the bin folder and I hope doing an app recycle will make the process release it so the deployment package can be installed.
msdeploy.exe -verb:sync -source:recycleApp="Default Web Site/myapp" -dest:auto
About the provider: http://technet.microsoft.com/en-us/library/ee522997%28v=ws.10%29.aspx

build ASP.Net default web site error

I am using VSTS 2008 and I am using Create new ASP.Net web site and using default settings/automatically generated files.
My questions are,
How to use command line script (msbuild) to build the ASP.Net web site automatically?
I want to build the web site into a DLL which could be easily copied to target IIS server later.
Any samples or quick answer how to do these tasks in msbuild?
EDIT1: There is no sln and csproj file in the web site folder. Here is the link.
http://tinypic.com/view.php?pic=dra5jp&s=5
Here is how I create in VSTS 2008.
http://i40.tinypic.com/208zfxv.jpg
I use VS.NET 2005 and using this command to build my asp.net web application in release mode :
cd "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\"
MSBuild "C:\Projects\MyProject.csproj" /t:Rebuild /p:Configuration=Release /verbosity:quiet /p:WarningLevel=0
"Web Applications" have .csproj files, "Web Sites" do not. http://damieng.com/blog/2008/02/07/web-site-vs-web-application
You want to compile it with aspnet_compiler.exe in the bin directory C:\windows\framework\version
http://msdn.microsoft.com/en-us/library/ms178466.aspx
Easier way is to use deployment projects or the "Publish Web Site" command in Visual Studio. (Right Click on website)
http://weblogs.asp.net/scottgu/archive/2008/01/28/vs-2008-web-deployment-project-support-released.aspx

Resources