I am trying to deploy an ASP.NET MVC 4 Website to Azure. In my solution I have two projects: The MVC project which contains folders for views, controllers, jQuery, CSS etc. The other project is a class library which contains all of the models such as data models, viewmodels and migration settings for Entity Framework.
I've published the first project (the MVC website) to Azure with no problems but of course it can't function without the class library. There is no option to publish the class library when I right click on it.
How do I publish the class library as well so the MVC project in Azure has access to it.
Here's an image showing my solution (project name redacted):
If you have the dependencys of the MVC Project right, using VS to deploy (by publish profile) it will automatically upload all the dependent projects of the main project you want to deploy.
It's one of the thinks that you must say that it just works
1.Expand the References
2.Right Click the reference whatever you want
3.select properties on right click
4.In Properties pane Focus on Copy Local
5.set true.
Then Publish Your Solution. that automatically publish your dll
Related
We are building a solution with 3 projects.
MVC
API
DAL
The DbContext class is located inside the DAL project.
Migrations have been successfully enabled on DAL project.
Everything works fine locally.
When trying to deploy on azure the MVC project the
Execute Code First Migrations checkbox is missing.
It seems that somehow our project is not recognized as a code first project (Publishing profile is DbDacFx instead of DbCodeFirst). After trying several solutions we tried creating the projects from the beggining and adding the files one by one checking for the checkbox each time.
The checkbox disappeared after we added a class that inherits from FlowMetaData class from Google Analytics SDK.
Is it possible that a third party library could cause such an issue ?
Or maybe something else if forcing Visual Studio (2013) to not show the checkbox ?
I am working on a asp.net project with react and want to use react-router. On its git repo the setup is only explained for Node.js. I found the TypeScript packages of NuGet but after installing them, I cannot build my project anymore due to compilation errors.
Does anyone have experience with installing react-router for asp.net projects?
What we did to build our application in React. We created our whole application in React in Visual Studio Code with Redux and React-Router. Webpack is used to build all the files. Once whole application is completed, we build the js (transpiled and minified) and added a script tag pointing to that url of the bundle js into our web application page (specifically .aspx page).
Now issues you might face with react-router, if you have hosted it inside a directory of your existing project. For e.g. inside root - you have folder named myapp. If that is the case - you need to make changes to your Routes in your react app to have a base name.
I tried React.NET but after doing it this way - I really liked this approach as you can separately build the whole application with all the awesome tools you have in client side ecosystem - for instance - hot reloading
Hope it helps.
I have never used React.NET, but what you can do is create a separate project, outside of your ASP.NET project. Use webpack for bundling and other purposes. Build your react project, which generates static assets (main.js, chunks, css files and images/sprites). Add these generated files in your ASP.NET project directly and set index.html as Start Page.
We have built our React project on top of this boilerplate. It uses industry-grade ways of optimization, uglification, minification, bundling and what not! Good luck!
I have a MVC web application that I am developing in Visual Studio 2010. Along side my MVC project in my solution I also have 2 Class Library projects.
When I right click the MVC project in the solution explorer I get (among others) these options: Build Deployment Package, Publish..., and Package/Publish Settings.
These options are not available for the 2 Class Library projects, so prior to uploading any code I am currently putting everything in a deployment folder on my local machine using the Publish... option for the MVC project and just copy & pasting the other 2 projects in windows explorer.
I would very much like to use the Publish... option to deploy all 3 projects using FTP to our server.
I have discovered that if I change the Output Type of the 2 Class Library projects from Class Library to Console Application then I get the options to Publish... etc., but they aren't Console Applicationss so I don't really want to do this.
My question is, how can I , using Visual Studio 2010 publish Class Library projects using FTP?
UPDATE
Turns out I'm a numpty!
Because the MVC app references the 2 class libraries, the .dlls for them are already included in the bin folder for the MVC app and I didn't need to include the other projects when I publish.
You shouldn't need to separately publish the class library projects. When you publish the MVC project it will include any references the project has. As your MVC project references the 2 class library projects, when you publish it the class libraries will be included.
Might this one help
Change Solution Configuration to Release mode (by default it may be debug)
Click on Solution Explorer and Rebuld the library project.
This will release the dlls to [yourProjectFolder]\bin\Release
You need to customize how deployment process collects files you want to include in your deployment package.
Since your question is about Visual Studio 2010, I've found a Q&A here in StackOverflow that will guide you to the right direction in terms of including additional files (like your class library assemblies) as part of your deployment:
How do you include additional files using VS2010 web deployment packages?
I have a solution, Asp.Net web application and inside the solution I have two projects. One contains VB code that handles the UI. forms etc. and the other one C# that basically uses Linq-to-Entity to handle my data. When I run the project from my local computer it works good. Now, to publish, I notice only when the UI Project is selected, the publish option is enabled. Why is that? If I publish this, would the other project not be published? Another question, I have XML files created in app_data folder, when I publish it, will I be able to access it?
Publishing only applies to web projects. If you've included a reference to the other project in your web project, it will be compiled and the DLL will be published along with your web project. Your XML files should be published along with your web project, if they aren't check their properties and make sure they are set to be published with the project (build action set to Content and Copy Always or Copy if newer is selected).
You have two projects inside your solution. One is web project and the next will be a Class Library project. All the codes related to Entity framework, LINQ queries, Database transactions, etc should be in the class library project. while building the class library it will automatically generate the DLL files. then you need only add a reference to the web project file. Then you will get all the classes, methods etc from the class library. there is no need for publishing the class library project. Because you have add the dll reference to your webproject. all the code file inside your App_Code folder shuold be converted to dll while publishing the web project. so dont worry about the files inside the App_code folder data.
Thank you
You dont need to publish reference projects individually or even the whole solution. It works simply by referencing the dll of your other project.
Both projects need to be compiled if not already
If your UI project has reference to dll from data layer project it will be published with your UI project.
You can publish it locally in another folder and test using iis express or your local iis and then publish it online with database. Update connection string and it should work if setup correct.
I've recently started to explore Daniel Mohl "F# C# ASP.NET MVC3" template.
Can anyone share on how this type of project should be deployed to IIS7??
Thanks.
You deploy it pretty much the same way you'd deploy a "normal" ASP.NET MVC3 website, but there is one extra step: you need to make sure your deployed website will have access to FSharp.Core.dll.
If you have admin access to your server, you can simply install the F# redistributable; if not, you'll need to make sure FSharp.Core.dll is included when you publish or create a deployment package. The way I handled this in our website (written in MVC3 with C# + F#) was to manually add a reference to FSharp.Core to the website project, then right-clicked the reference, clicked properties, then set "Copy Local" to true. If you use any assemblies from the F# Powerpack, you'll need to do the same for them.
If I'm correct, the template consists of a C# Web Application that references F# Libraries (DLL) project which contains some of the functionality (namely, controllers and the model).
From the deployment point of view, this is just a normal C# Web Application with some referenced DLLs (created in F#) that will be copied to the bin directory, so the standard deployment procedure should for Web Applications should work just fine. I didn't try it myself now, but try:
Publish application to some folder (right click on C# web project in the solution explorer)
Copy that directory to your web server
Follow the usual IIS configuration steps (see for example here)