Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a school project where I have to build a desktop application in C# with ASP.NET MVC 5.Im using Visual Studio 2015, and Sql Server.
That application contains a small database with about 5 tables and some data. The project is done and it works fine on my computer. My problem is: part of the task is making the program I made work on another computer.
How do I publish my application? Publish with One-Click makes the installer, but, when I do install the software in another computer, it gives an error that it cannot connect to the database. How can I deploy my project WITH the database to another computer?
Thanks in advance
EDIT 1:
After an long search, i found an youtube video that explains how to do a Setup Project using Visual Studio 2015, where you can choose what you need to install and the configurations you need to adjust. I´m still trying to make it work, but i can fell im at the right path finally.
Youtube video: https://www.youtube.com/watch?v=zx6w3BDD6Sg
What database are you using?
File-based databases like SQLite or SQL Server Express are built to store their data in easily transportable files that can be shipped along with your app/site.
If you're using a server-based database like SQL Server, MySQL, etc., you'll need to ensure that the target machine/environment has the same database server installed and you'll need to write a deployment script that attaches pre-populated data files to the server. This may be a lot more work.
Try with using Sqlite as a database with entity framework code first approach with that you can hold the database in user's computer (c:/users/username/appdata). By code first approach you can create the database while the user install the application and you can drop the database while user uninstall the application.
Related
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last month.
Improve this question
I just downloaded a project with Entity Framework installed; the difference with my co-workers is that I'm using a Mac.
I created a docker container for the database, and someone sent me a backup of the database, so I have the database restored and working with the project.
Someone created a new database migration, so I pulled the changes and needed to run the update database command. So I need to use the CLI version because it does not have the Package Manager Console.
So I try to run: dotnet ef database update 20221229175926_addSalariesTable
But this is returning:
Unable to create an object of type 'MyContext'. For the different
patterns supported at design time
My project consists in two layers, one for the web and the other for models and data
Web project name: Web
Data project name: Persistence
How can I run the update migration correctly?
You will need to navigate to the directory that contains your data project (Persistence) in the command line and execute the following command:
dotnet ef database update 20221229175926_addSalariesTable --project Persistence --startup-project Web
This command tells the Entity Framework to update the database using the migration with the specified name and to look for the migration files in the Persistence project.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
While connecting to SQL Server database by attaching to an MDF file, the following error is returned:
The database cannot be opened because it is version 904. This server supports version 852 and earlier. A downgrade path is not supported.
How to deal with that?
That file has been created with a SQL Server 2019 version (localdb or full).
The localdb installed on your machine supports SQL Server 2016 files.
Therefore you are not able to open that file.
You have two options:
Upgrade your version of localdb to version 2019.
Try to get a file produced with a version compatible with yours.
According to this article
https://sqlserverbuilds.blogspot.com/2014/01/sql-server-internal-database-versions.html
you can retrieve the internal database version using one of these commands
SELECT DATABASEPROPERTYEX(N'YourDatabaseName', 'Version');
-- Column DatabaseVersion
RESTORE HEADERONLY FROM DISK = N'C:\backups\Database.bak';
-- Column status: search "Version="
EXEC sp_helpdb;
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I use linux and I am not willing to switch to windows. I need to create asp.net application for windows server with people working with visual studio on windows. I would like to work from my linux machine. I have heard about mono. Can I get some instructions and suggestions?
Note that the application will be deployed on windows.
One way or another you are probably going to have to use Windows at some point. Even if everything runs fine under mono you will still need to check that it does on Windows.
You could set up a virtual machine on Linux running Windows, or have a separate machine for testing. If you are working in a team where someone else is responsible for most of the testing you could avoid that too.
Start by installing mono with apt-get install mono-complete. It would probably be easiest to get Visual Studio to setup the project. Hopefully you are using some form of version control, so you can push the code and pull it to your Linux machine. You can write the code on Linux in your preferred text editor and test it running under mono. Finally deploy it back to the Windows machine/VM to verify that it works as expected on your target platform.
You can check which features are currently fully, partially or not supported in mono here:
http://www.mono-project.com/docs/about-mono/compatibility/
http://www.go-mono.com/status/
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a MVC project (web application) created using C# in Visual Studio 2015 on Windows. It is working perfectly on a Windows Server.
Now there is a requirement to shift the server from a Windows OS to CentOS.
I googled around to check how to run MVC project on CentOS and found that we can use mono.
But my query is, can we use it in the same way as we use IIS and Windows OS ?
I mean can I just take the project files from my current server (Windows Server 2012) and deploy them as it is on the new server (CentOS) and it will run as it is or do I have to make any programmatic changes ?
I tried this in the past and it wasn't a straight compile and ready to go, I had to follow instructions to get it all migrated.
Here're couple of good resources to read as far as compatibility and migration:
http://www.mono-project.com/docs/about-mono/compatibility/
http://www.integratedwebsystems.com/walkthrough-porting-asp-net-mvc-website-to-mono-2-6-1-and-mysql-on-linux-apache-porting-to-mono-part-3-of-3/
I currently have an ASP.NET MVC 3 project, plus a class library project, that I am planning on open-sourcing. Before I do that though I want to clean up the project a little bit. One modification I want to make is with the database. Currently the site is published to a shared hosting server and I setup the SQL database on that server. However, since people will be forking the project and running it locally I'd like to just attach a SQL server express database or something that is part of the project. I want people to clone the repository, open the project, press F5 and have it run. Currently they'd have to setup a SQL database and create all the tables and stuff.
The solution consists of two projects: MvcUI and Domain. Domain is where all the application logic occurs. In fact, the domain is UI agnostic which means that it could be consumed by a desktop application just as easily as it could be by a web application.
I would like the database to be part of the Domain (class library) project. I have never done this before. If anyone could provide a simple explanation for how I would need to go about setting this up I would be thrilled. It would be very nice to have the database just be a in the solution because I could pre-populate it with some basic data. What do I need to do to get this database in my project as a database file or what not?
SQL Server Compact Edition is a portable SQL database that should do exactly what you are asking.
Microsoft SQL Server Compact 4.0 is a free, embedded database that
software developers can use for building ASP.NET websites and Windows
desktop applications. SQL Server Compact 4.0 has a small footprint and
supports private deployment of its binaries within the application
folder, easy application development in Visual Studio and WebMatrix,
and seamless migration of schema and data to SQL Server.