We have a .net MVC application where it involves deployments every week. We need to package the application and give it to the clients every week for them to install as an .exe or .msi
The package will involve DB changes also and site in IIS is already set.
The exe/msi just has to replace the old files(bin and views) and do the DB changes(run scripts). I don't want client to see either our code or DB script while installing.
So how can I achieve this as a single package?
Related
I'm developing in ASP.NET Core Blazor WebAssembly.
Originally I had made a Blazor wasm project in Visual Studio 2019 where client, server, and shared were all part of the same project.
The project grew and I decided to split up the project into separate git repos.
I'm using Serilog.Sinks.BrowserHttp and it was working fine before I split up the project.
Now I'm getting an error in Console (Chrome):
Before the project was split up into two separate git repositories, all logging was saved in the database, but after the split, only the server-side logs are being stored in the database.
Is there a way I can store the logs straight into my Microsoft SQL database after having split up the Blazor project?
Here is my Program.cs logger configuration:
Logger Configuration
I just figured since both server and client were both in the same project and everything worked fine, the problem must be that the logger is assuming they still are in the same folder.
The problem was an old Nuget packet Serilog.Sinks.BrowserHttp 1.0.0-dev-00012. When selecting to manage nuget packets for my solution in Visual Studio, under package description the only version available is the installed version. But from the command line I was able to update to the lastest version 1.0.0-dev-00021.
I want to create Kestrel stand alone .exe DotNetCore 2.0 MVC Web API application in Visual Studio 2017, however I can't find any documentation.
On how to compile it as a self contained .exe (not using dotnet run).
The Microsoft documentation here: https://learn.microsoft.com/en-us/dotnet/articles/core/deploying/deploy-with-vs only covers a console application, and following the modifications to the .csproj makes no difference
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
(note this is not a .NET Core 1.x question)
dotnet publish command is responsible for packing deployable .Net Core application. It will build the application and copy all its dependencies to the output directory.
The easisest way to run it is to switch to the project directory (the one where csproj resides) and execute:
dotnet publish --configuration Release --runtime win-x64
Change the build configuration and runtime version accoring to your needs. You could learn other command line settings on the doc I have referenced.
According to this answer:
At the moment, there are no fail-safe methods to create a single executable file. Since there are a lot of type-forwarding dll files involved, even ILMerge and similar tools might not produce correct results (though this might improve, the problem is that those scenarios haven't undergone extensive testing, esp. in production applications)
There are currently two ways to deploy a .NET Core application:
As a "portable application" / "framework-dependent application", requiring a dotnet executable and installed framework on the target machine. Here, the XYZ.runtimeconfig.json is used to determine the framework version to use and also specifies runtime parameters. This deployment model allows running the same code on various platforms (windows, linux, mac)
As a "self-contained application": Here the entire runtime is included in the published output and an executable is generated (e.g. yourapp.exe). This output is specific to a platform (set via a runtime identifier) and can only be run on the targeted operating system. However, the produced executable is only a small shim that boots the runtime and loads the app's main dll file. This also allows an XYZ.runtimeconfig.json to set additional runtime properties like garbage collection settings.(think of it as a "new" app.config file)
In the future, the CoreRT runtime – which is still under development at the time of writing – aims to allow creating a single pre-compiled native executable that is specific to a runtime and does not require any other files.
Although that question was asked (by yours truly) more than 6 months ago, it looks like CoreRT is still a work in progress.
Pros and Cons of a Self-Contained Deployment
Deploying a Self-contained deployment has two major advantages:
You have sole control of the version of .NET Core that is deployed with your app. .NET Core can be serviced only by you.
You can be assured that the target system can run your .NET Core app, since you're providing the version of .NET Core that it will run on.
It also has a number of disadvantages:
Because .NET Core is included in your deployment package, you must select the target platforms for which you build deployment packages in advance.
The size of your deployment package is relatively large, since you have to include .NET Core as well as your app and its third-party dependencies.
Deploying numerous self-contained .NET Core apps to a system can consume significant amounts of disk space, since each app duplicates .NET Core files.
I realize you already found that Microsoft deployment document, but if you go through the walkthroughs for command line and for Visual Studio deployments, you will note they are telling you to use dotnet publish in the procedure. This is exactly the same as with ASP.NET Core applications because they can be deployed as console applications.
In short, it is possible to make a self-contained deployment package with a .exe file, but it is NOT (yet) possible to make a self-contained EXE on .NET Core.
So as a beginner to the entire Visual Studio IDE and a beginner to F# and the F# based WebSharper, I have certain issues on the system. I use the 'Ctrl+F5' to test the application. Now what do I do if I want to package the application and deploy it on another server, say apache server? Assuming the basic example here has just the .js files and HTML files, where do I find the generated web pages and/or .js files or how do I generate them.
If you created the application using the HTML Site template you’ll find the HTML bundle in the project’s bin folder. You can deploy WebSharper applications built using this template on any server you prefer. If you used one of the Web Application templates (Sitelets, ASP.NET, …) you have the choice between Windows hosting and following these instructions to host the application using Mono on a Linux box running nginx.
When it comes to Windows hosting, AppHarbor is a great choice for deploying WebSharper apps and you can use one of these two templates which both build on AppHarbor to jumpstart your project:
WebSharperMVC
WebSharperBootstrap
Now that MVC 3 Tools Update has been released, that's all I see on the Web Platform Installer -- I no longer see MVC 3? Is this because the Tools Update is essentially MVC 3 PLUS enhancements to the development environment? Presumably, none of these additions are needed on a server so I thought that MVC 3 would still be offered for server installs.
So can/should I install the MVC 3 "Tools Update" from the Web Platform installer on a server?
I know this doesn't help you Decker, but it may help others:
The easiest way to get MVC on the server is by using the "Add Deployable Dependancies..." menu:
Also useful for deploying SQL CE.
You can use the installer from WebPI on the server just fine. It will detect if you don't have Visual Studio installed and will only install the runtime.
You could also try unzipping the installer file and only copying the runtime MSIs but I think that's overkill.
You could also use Web Platform Installer from the command line:
webpicmd /install /Products:MVC3Runtime /log:webpi.log /accepteula /SuppressReboot
If your servers don't have internet access, you can use the offline flag from a machine which does have access to download a copy of the required install files.
So your flow would be as follows:
Prepare Cached Version of Installers
webpicmd /Offline /Products:MVC3Runtime /log:webpi.log /Path:"%~dp0wbpiCache"
Install from cache (copy folder structure to target machine)
webpicmd /install /Products:MVC3Runtime /log:webpi.log /accepteula /SuppressReboot /XML:"%~dp0wbpiCache"
You don't need to install MVC3 on a server.
Just copy the MVC DLLs along with your projects.
In my visual studio asp.net mvc applications I have 4 build configurations; one is to use IIS as the web server, which requires "run as administrator" when running visual studio.
So I ran as admin and created some new files. I have a multi-project template that I use for all my web applications. So I copied the new files from the project I was using back to my template project because they would be useful for all my projects, but didn't think about the "run as administrator" thing.
So now when I create a new project from my template and try to run the asp.net development web server nothing happens, but when a run as administrator the web server loads everything with no problems.
So my question is how can I remove the "run as administrator" requirements from all the files and folders, and I really don't know which files were added, there were many? I have to remove the administrator requirement because many people maintain the code besides me after its in production. Do I need to just recreate the entire project template?
I am using VS 2008 sp1, Windows 7 RC
The Run As Administrator requirement for VS is based on it requiring access to IIS, if I remember correctly, not the files themselves.
People on other machines that don't have this level of UAC protection, say Windows XP, should not have this problem.
The problem is very likely that some of the files are owned by an administrative user and cannot be overwritten by non-administrative users. The ACLs on the files likely need to be updated. One way to do this is to right-click Properties on every file, go to the security tab, and add the appropriate users/groups with the appropriate permissions to each file (probably try to match the files that already exist and have correct permissions).
There is a command line tool called CACLS (more info here and here) that can do this much more quickly, but it's non-trivial and you don't want to screw it up. You would run CACLS as the owner of the directory or the administrator to grant permissions to non-administrators.
Here's an example that gives user "Michael" full control to the SQL Server data directory and all subdirectories and files:
CACLS C:\SQLData\MSSQL$INSTANCE1 /T /E /G Michael:F
Please note that I have no experience with Windows 7. ACLs have been around since the first version of Windows NT and I'm assuming nothing changed radically in Windows 7.