App_Code in local IIS and Azure/TFS build - asp.net

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.

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.

Configuring existing ASP.NET project for DNVM, DNX environment on a Mac

I have an ASP.NET Web API project created on Windows using Visual Studio. How can I set this up for use with DNX/DNVM (on a Mac)?
Switching to Git solved the source control compatibility with TFS. But I wasn't able to find references to getting a project working across both these development environments.
I'm assuming as a first step the project will have to be migrated to ASP.NET 5/vNext but wondering other problems lurk around the corner with different project members using different environments.
I get an error when I run - git:(master):dnx . kestrel
As you mentioned yes you will have to migrate any namespace changes. I have a project that is developed across both. Also changing csproj files to xproj. Support is coming for some kind of interop between the different project types but its not here yet.
For build, publish, deploy from git without relying on VS publish capabilities or MSBuild you can follow my blog post here.
Basically you use DNU to publish and then kudu to deploy.

How to deploy ASP.NET MVC application with devexpress components to Azure websites

Is there a way to deploy asp net application with dexexpress components other than using virtual machine with installed libs on it?
I want to deploy it to azure websites but get an error that .dll are missing (dont get that error during debugging on localhost where devexpress installed).
Be sure, that you marked the referenced assemblies that you want to publish on the vm as "copy local = true". You can find that option in the properties of a reference.
The output folder of your web app will be automatically copied over to azure websites. For more information how web pages are packaged have a look How to: Create a Web Deployment Package in Visual Studio
You can try one of these options:
Find a NuGet package which includes the dll's you need. I don't know which components you use but NuGet contains a lot of packages -> https://www.nuget.org/packages?q=devexpress
Include the dll's you need in a 3thPartyLib in your project and then reference these assemblies (with copy local = true) from your project.
Be sure to include the license file in your deployment.

How to add reference to Microsoft.Office.Interop.Word.dll while copying an asp.net app from dev server to test server

I am referencing Microsoft.Office.Interop.Word.dll in my asp.net web application at development server.
No i need to move this app from development server to testing server.
I can't see the dll in the bin folder of the app as it is pointing to GAC.
How should i reference the above specified dll in testing server?
Do we need to do anything with web.config?
Please advice.
Thanks,
Ram
Visual Studio uses different sets of the PIAs on the development computer. These different sets of assemblies are in the following locations:
A folder in the program files directory.
These copies of the assemblies are used when you write code and build projects. Visual Studio installs these assemblies automatically.
The global assembly cache.
These copies of the assemblies are used during some development tasks, such as when you run or debug projects that target the .NET Framework 3.5. Visual Studio does not install and register these assemblies; you must do this yourself.
Link
If not found DLL you have to download from internet....

Creation of asp.net websites artifacts in Teamcity from SVN repository

I'm using TeamCity Professional Version 4.5.4 (build 9071) at work to build my asp.net web application project.
My solution file consists of several projects (e.g. web application, unit tests, some web service project, etc).
I want to create an artifact consisting of my web application (the others can be ignore for now), so I have the following configuration on teamcity (deviating from the default values):
General Settings
Artifact Paths: trunk\project-src\intranet-webapp***=>WebAppArtifact
Version control settings (SVN)
Automatically checkout on agent
Runner (sln2008)
Targets: Clean Publish
It builds my artifacts just fine, but there is a big problem: The artifact keeps the ".svn" folders and the .cs (C# code-behind) files in it.
I expected that with the "Publish" target in my runner, I would have exactly what the "Publish project" menu in VS 2008 does: copies the compiled project to some location without the code-behind files and no .svn folders.
Could anyone tell me what configuration am I missing?
If you will use checkout on server, there will be no .svn directories.

Resources