How can I use some projects I created using Visual C# 2010 in a Web Application.
I want the projects all separated in the web application if possible
Thanks :)
Simply separate the parts of the application that are specific to Windows from the parts that are not specific. Similarly, separate the parts that are not web-specific from the rest. Put that parts not specific to any particular technology into one or more common class library projects.
Hint: these common class library projects should build with no references to System.Windows.Forms or to System.Web. Otherwise, they may not be general enough.
Are those projects class libraries? Most probably you can use them (except the windows application projects) as it is in the web application by adding references of them in the web application.
You can separate out the classes in those windows application in the class libraries and then you should be able to add the class libraries in the Web application which would use the class libraries.
If you are not looking to rewrite the application and would prefer a quick start on creating the web application then I'd investigate how useful the tool offerings are in this area.
A quick look on SharpToolbox reveals two candidates:
suite4.net
Visual Web GUI
I am not affiliated with any of these nor have I tried them and so cannot vouch for any of the claims they make about their products, but it might be worth trying them out.
Related
Is it possible to create an VSTO add in for multible office applications?
Can I outsource the functions i want to have for every application and then create an Add-in for every application? If yes, is there a better way to achieve this?
I recommend making a solution with an add-in project for each Office application.
Then add a class library project to the solution and reference that from each of the add-on projects.
That way you can centralize code used in all add-ins.
If you need to interact with the active application or document, you can detect the type of the calling object and typecast it to the relevant application/document type.
Yes - you can just put your common functions into a shared DLL, just like any other application. Since each VSTO project targets a different application structure and potentially UI paradigm, I'd recommend having different VSTO projects in a single solution, and a shared assembly holding the common code.
VSTO doesn't support creating multi-host add-ins. You need to create separate projects for each host and use a class library for the shared code base.
Note, Add-in Express allows creating multi-host COM add-ins. So, a single add-in project can be run in multiple hosts. It comes from the IDTExtensibility2 interface. I don't know why VSTO creators didn't provide such feature to developers.
VSTO itself doesn't provide such an option. If you want to get single project for all application you can use shim add-in. That makes possible to run add-in in all applications from the same dll. The only issue -- your code need to handle what application started to call it to run separate logic or to call specific office API functions.
I have developed a WPF application and the customer is planning to deploy the application on DVDs.
My application is really simple and doesn't require any setup process, but I need to assure that if the client doesn't have .NET 3 installed that it will be installed locally (from the DVD) before starting the WPF application.
So, what's the easiest was to add the .NET 3/3.5 package locally on my DVD and assure it'll be installed before running my application? Remeber that my application will be a standalone application.
when you use the publish option...
The Project Properties has a place to specify the dependancies that will need to be downloaded
then you simply check the boxes
there are other more complex ways to go abaout this but for .net 3.5 you don't have to go far
I would suggest using Visual Studio Setup Project for creating a setup package which would check for prerequisites and provide fundamental features like file system, registries, scripting. It is very easy to get started with. Take a look here for a brief walkthrough.
I received source code of a web application for Visual Studio which its solution contains 15 different projects and I'm supposed to create something like that.
The main project is a MVC3 web application, and the rest are non web applications just for handling data and other resources.
I don't know the type of those projects while I try to add new projects to my new solution. Could I just add an empty project for example a asp.net web application empty project or anything else C# application empty project even a windows one and still make the right solution with adding right references , configure and other files? does the type of project really matter?
The type of project matters to Visual Studio because it controls the compile switches. There are different switches to create a .dll (Class Library project) and so forth. Visual Studio also uses the project type to determine how to run a particular project. (In the Cassini web server for websites and Web Projects, or just as an executable for Console and WinForms apps, etc.)
If you have the .csproj files, you can look in the file to determine the project type.
For example, a Class Library will have
<OutputType>Library</OutputType>
A WinForms, Console, or Windows Service app has
<OutputType>WinExe</OutputType>
A Website will have no .csproj file, but you'll be able to identify that based on the existence of .aspx, .asmx, and other files.
If you DON'T have the .csproj files you'll be left to your best guess. Generally, if it looks like a bunch of classes with no Main() function to be found, and those classes are referenced in another library, it's most likely a Class Library project.
If you see a Main() routine, it could be any of the varieties of Windows Executables, so you'll need to look for clues like the existence of Console.WriteLine() calls (usually associated with Console apps) or Windows UI components like TextBoxes, etc, and references to the System.Windows.Forms Namespace. References to System.ServiceModel generally indicate a Windows Service, etc.
I'm working in constrained environment (win7 under VirtualBox), and everything works excellent, except emulator (debug on real phone is OK). But I'm new to Visual Studio and .NET, and would like to develop all logic (at least interaction with web, algorithms, data models) in separate library (to test it against simple console or WPF application).
But here problems come — WP7 library uses special solution (and all projects by default are built against .NET Framework 4, when phone runs with .NET CF 3.7, why?). How I should setup IDE, to build crossplatform (I mean desktop/windows phone 7) library?
You can create parallel projects (one for desktop, one for phone) and add your c# files to one of them and link them in the other project.
To add a link to a file instead of copying it follow these steps:
Right click on the project => add existing item -> Select the file -> click the drop down arrow next to the "Add" button and chose "Add as Link".
To solve any incompatibility you can define a conditional compilation symbol like PHONE and wrap your incompatible code in:
#if PHONE
//phone code
#else
//desktop code
#endif
The downside is after you add a new code file in a project you need to link it from the corespondent project of the other platform.
I don't think there is a easier way of doing this.
You could use the MVVM pattern to develop your viewmodels (the business logic) in one assembly, then when you are ready for the UI, you can create a WP7 project and create the views inside that project, referencing the view models in the first project.
This would allow you to unit test and develop all your logic first, then just create the views and bind to the appropriate properties on the appropriate viewmodels.
MVVM was designed to be able to develop like this, so it works really well IMHO.
An acquaintance of mine suggested to use Portable Library Tools, which allows creation portable library for multiple target platforms (xbox, winphone7, silverlight, etc) without recompilation. Looks very promising.
I am currently porting a legacy VBA application to a .Net application. During this process the users of the existing VBA application need to have some features added. So instead of coding them in VBA & then later in C#, I’ve wrote the new functionality in C# and I want to expose this to the existing VBA application through COM, as well as also keeping it in the currently .Net application version.
The solution contain several projects, 1 project for the UI, 1 project for Business Logic, 1 project for the data access layer.
The new features are just a some new forms to modify data. So ideally they will click on a form command button in access which lunch these C# forms via COM interop.
How should I go about exposing this forms through COM Interop.
What I was hoping to do was just add another project, MyProject.COM, which will contain my Interface ICOMManager, for exposing methods to access to launch the required forms. My COMManager class will just instantiate the required forms in my .net application and show them.
This project MyProject.COM will have references to the UI layer & Business Logic Layers.
When I want to register this project using REGASM how will I include references to these other projects?
Thanks for any help or advice on how about doing this.
Ah ok so i see this is alot easier than i thought.
Once i looked at the reg file produced by regasm i could see that the tlb (Type Library) is just a pointer to where it can find the libraries to execute the .Net component.
So once i register the tlb and make sure its pointed to the install directory where the rest of the project files are located it works.