How to deploy a "Release" build of an ASP.NET MVC5 application - c#

So It's the first time I'm trying to deploy an ASP.NET MVC application to a Windows host.
I set the compile mode to "Release" in Visual Studio 2015 and I compile it but don't know which folder(s) to zip and upload to server...
I see an obj folder in project directory that has two folder inside it. "Debug" and "Release". I'm not sure about them though.
On the other hand in project directory root, there is a folder with the same name as project, inside it I can see controllers so I'm pretty sure that folder is not a "Release" build.
My host is running Plesk and IIS 8.
What should I do?

You should use the Publish wizard of visual studio. As a shortcut --> Right click on the MVC project and click publish. You will find many option here.
Make sure you configure your publish profile in release mode if you are publishing on server

Related

How do I publish a WPF application with ClickOnce correctly?

I have written a WPF application, which uses a third-party API (as .dll) as a project dependency, in Visual Studio 2022. I'm able to publish the application both to a local folder and with ClickOnce, however, with the former, the application file does not run and with the latter, the application does not run after installation either. The application file in my bin\Release and bin\Debug folders both work, however.
I've tried the following:
Unload Project and Reload Project with Dependencies
Defining the Starting object
I would like to publish the project with ClickOnce, but I'm not sure what the problem could be. Thank you for your help in advance.
Project properties
Project properties (continued)

Visual Studio 2019 (16.11.5) clickonce publish succeeds but clickonce is not packaged and pushed to network share

I have a winforms application that had click once working in visual studio. after the recent update to 16.11.5, the exact same publish profile for the clickonce app is no longer working after updating from an earlier version of visual studio.
Anywhere I should check for changes to click once? this is really baffeling and my google skills seem to be failing me in finding an issue.
The only output I get from the publish (build output log) is that the publish succeeded. The files are being published to the staging publish folder and I have made sure I have full permissions on the network share configured for the user install location.

Created mvc project and published but newly-added folder did not follow

I created an MVC project in Visual Studio 2013 and published it to Azure and it worked great. I made some changes by adding an image folder under content. Well, when I went to publish my changes to Azure, that folder did not get published.
I had to manually right-click on the folder in Solution Explorer and publish it separately. Can I do this automatically?

Visual Studio Publish gives different binaries to build

I usually deploy my web application by right clicking on the app and selecting the publish option. VS copies everything to a local file system folder then I zip it up and copy it to the web server.
For some reason when I publish my branch the binary in the publish folder is different from the binary in the local build folder. It's as if it's building different code.
Both the local build and the publish are using Debug (Any CPU) configuration.
Here's a screenshot of the decompiled assemblies.
This first one is the one from the project bin folder and runs perfectly.
This one is from the publish folder and as you can see it contains some lines which aren't in the other build.
This particular class doesn't have any #IF DEBUG pragmas in it.
I've tried clearing out the bin and obj folders with no success.
Does Visual Studio have a cached copy of all the code somewhere that it uses to do the publish build that I can clear out?
Are you sure you have Debug configuration enabled in Publish settings? Publish settings override current Visual Studio project configuration.
Having Debug publish configuration enabled, publishing applies the Web.Debug.config transformations over Web.config, while local build ignores Web.Debug.config. As I see, you miss the NewJobRegisteredObject in published assembly, you may have xdt:Replace section in Web.Debug.config removing object registration.

How to create exe of a console application

How can we create the exe for a console forms application ?
an EXE file is created as long as you build the project. you can usually find this on the debug folder of you project.
C:\Users\username\Documents\Visual Studio 2012\Projects\ProjectName\bin\Debug
For .net core 2.1 console application, the following approaches worked for me:
1 - from CLI (after building the application and navigating to debug or release folders based on the build type specified):
dotnet appName.dll
2 - from Visual Studio
R.C solution and click publish
'Target location' -> 'configure' ->
'Deployment Mode' = 'Self-Contained'
'Target Runtime' = 'win-x64 or win-x86 depending on the OS'
References:
https://stackoverflow.com/a/44039013/5063433
https://stackoverflow.com/a/52443448/5063433
For an in depth explanation of all the deployment options available for .net core applications, checkout the following articles:
https://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-vs?tabs=vs156
https://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli
Normally, the exe can be found in the debug folder, as suggested previously, but not in the release folder, that is disabled by default in my configuration. If you want to activate the release folder, you can do this:
BUILD->Batch Build And activate the "build" checkbox in the release configuration. When you click the build button, the exe with some dependencies will be generated. Now you can copy and use it.
For .NET Core 2.2 you can publish the application and set the target to be a self-contained executable.
In Visual Studio right click your console application project. Select publish to folder and set the profile settings like so:
You'll find your compiled code with the .exe in the publish folder.
The following steps are necessary to create .exe i.e. executable files which are as
1) Open visual studio framework
2) Then, create a new project or application
3) Build or execute your application by pressing F5

Categories