I was wondering if there is any way to take a console application and switch it to a ASP.NET MVC5 Web Application.
I have a Regression ML Console Application that I want to create a web form with
You can make a DLL of your console application, and then use the classes and methods from the DLL by adding reference of the DLL to the MVC project.
To make DLL of the console application, Right click on your Console Application -> Properties -> Change the Output type to Class Library and build the project.
To add reference of the DLL, Right click on your MVC project References->Add References->Browse, and select the DLL you just made.
Now, go to the controller where you want to use the DLL's code, write using and the DLL name with its namespace. Now, you can access the classes, and methods of the DLL in this controller.
Related
I am trying add new function inside my SharePoint and I created HTML code and it will call .dll file where I download it. However, when I run project standalone outside SharePoint it works. However, inside SharePoint code (HTML) when I add assembly to my .dll , it shows not found.
I tried adding it in SafeControl in web.config bug still same issue.
I place .dll in all places where other SharePoint .dll are there but still the same problem.
I am not sure if I understood what you trying to accomplish but I suspect you are using some SharePoint on-prem and you deploy some kind of solution (webpart or other) to a site were you want to use an external dll. If that is the case you need to create some kind of empty sharepoint farm project (or use one of the existing farm solutions) and add an external dll to it so it will be deployed to GAC. When an dll is in Global Assembly Cache then we may use it in all places in SharePoint.
Here I found some blog post how to add a external dll to GAC
I hope this will be of any help
When the project is running inside the SP server, it's different from when it's starting outside the farm. You need to ensure the dll has been copied to gac, or the server cannot find it.
If you're developing a custom WCF in SP on-premise, you may take a reference of below demo:
Custom WCF
More reference:
https://blog.mastykarz.nl/including-additional-assemblies-wsp-visual-studio-sharepoint-development-tools/
BR
Hi I created one app that show you all your devices in your network. I would like to encapsulate all this code and controls in one "custom control" for use it in others apps.
I only find information about WPF custom controls, however when I tried to create a WPF custom control and then reference it to my Universal App, I got an error. I have searched about it and It seems that you can't use WPF controls in Universal Apps.
My idea is create something like "NetworkDevices", then I would put in my Universal App Main XAML:
<NetworkDevices Property1= .. Event1=........ ></NetworkDevices>
and then I would have my custom control embebed in my Universal App.
Thanks for your time.
Update:
Visual Studio Solution and the error
What you need is a Templated Control in a Universal Windows class library (so it can be reused in other apps).
I suppose you know how to do the rest (as you've created WPF custom controls, but as a reference you can use this MSDN article as well to guid you through step by step.
I have converted a large project, currently in VS 2012 from a Web Site project to a Web Application project.
I have added the namespace to all of my .cs files.
I have ran the "Convert to web application" on the project and it has generated all of the needed files. (So I do have the designer files created as part of this upgrade)
When I compile, it errors off on all of the references in my C# code behind file for all of the UI Controls. The error indicates that the control does not exist. The controls are there, and they are present in the designer files.
I have cleaned my solution and no matter what I do I get this error.
Any ideas / suggestions of things to try? Have I missed something in the conversion to a Web Application?
Fixed My Issue.. It was the inherits statement in the ASPX. I had to include the namespace along with that... Problem solved... so, the syntax is inherits="namespace.formname"
ASP.NET Web API project template in Visual Studio 2012 is a specialized MVC4 project and after creating an instance of such a project, right clicking on the "Controllers" folder shows you "Add >> Controller" menu item which triggers the controller generator. (scaffolding)
On the other hand, it is also possible to host an ASP.NET Web API server in a console application, which is called in the documentation a Self-Host application.
http://www.asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api
My question is:
How can I use the "Controller Scaffolding" if I am developing a self hosting console application?
Scaffolding is still supported via the package manager console e.g. here.
But the MVC specific "Add Controller" dialog is indeed reserved for MVC project files.
You can however, force your self host project to include this dialog.
This can be achieved by adding a line into the project file to "trick" visual studio into thinking your self host app is a MVC app. See this question for details "Add Controller" / "Add View" in a hybrid MVC/WebForms ASP.NET application
If you:
Create a Controllers folder under your project root
Right mouse button your self host project file and "Unload Project"
Right mouse button your self host project file "Edit "
Under the Xml > Project -> PropertyGroup Add the node shown under the steps
Save
Right mouse button your self host project file click reload project
<ProjectTypeGuids>
{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>
Once you have done this you can start playing around with TT files (scaffolds) to make them more useful/specific to self hosting http://www.hanselman.com/blog/ModifyingTheDefaultCodeGenerationscaffoldingTemplatesInASPNETMVC.aspx
I don't think this is currently possible. This scaffolding support is specific to MVC 4 projects currently.
I'm new to SharePoint and trying to get my head around this. I have a simple Web Part project. I also have a custom Data layer project that uses the Microsoft Enterprise Library for data access. In the Web Part project, I am adding a reference to the Data layer project's assembly. I specified in the Package of the Web Part project that I want my Data layer's assembly to be deployed. I can verify this works by using standard ADO.NET classes and not the custom MS library. If I deploy to the SharePoint server (which I have 100% access to) using the Enterprise Library, I get the error message:
"Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data"
What steps do I need to take to ensure this project and all future projects on the server can easily gain access to the Enterprise Library for data access?
Thanks!
You did everything correct until a certain point: Deployment.
When deploying external DLLs, which shall also be put into the GAC or somewhere else, you need to package them with the WSP aswell. This has become very easy with Visual Studio 2010:
Open your Package
Click on "Advanced" (on the bottom)
Add your external DLL and maybe even SafeControls for the web.config