C# Interactive - Project References and Settings - c#

With the Visual Studio 2015 Update 1 there now is a C# Interactive tool window built into Visual Studio.
The new tool window is invoked by going to View → Other Windows → C# Interactive.
Is there any way to have the C# Interactive tool load the set of references, app settings, IOC config etc. for a project in the solution?

This only works for .NET Framework projects:
You can context-click a project in your solution explorer and choose "Initialize interactive with project". Then the interactive window will load all references and your project's dll.
It will only load the dlls, no config. You could still do that manually though, aswell as the IOC config, by calling the startup.cs yourself.
This doesn't work for .NET Core or .NET standard projects.

Related

Visual Studio Esproj - Debug only launching esproj

I've a solution with 2 projects, .net7 api and a vue esproj
When I set the startup project as the .net 7 api, Visual Studio changes to the .esproj and launches it instead of the api.
Any ideas why is this happening?
There may be a project in the solution that depends on another project, and you set the startup project of the dependent project. This means that when you start a dependent project, Visual Studio automatically starts the dependent project as well.
Apparently you have some wrong settings in your user settings.
So the fix for this issue is to remove the user settings from the solution and run again.

Adding a web reference in visual studio for mac

I want to add a web service reference in my ASP.NET Core 2.2 project in Visual Studio for Mac 'Community' Edition (7.8.3) Build 2. From an answer I read Add Service Reference in .NET Core in Visual Studio for Mac, right clicking on my project reveals an Add command, however I do not see anywhere to add a web reference under it. All I see is to Add Nuget Package, file, folder, and docker support.
Please what I'm I missing that is not making the Add Web Reference command appear under the Add context menu in my web project.
I've tried downloading Visual Studio for Mac 'Professional' Edition, but clicking on the download link on the website, still downloads the 'Community' Edition.
My context menu screenshot
This is not currently supported in Visual Studio for Mac.
The code that was being generated, when adding a Web Reference, was using System.Web.Services which could not be compiled with a .NET Core or .NET Standard project so the ability to add web references was removed for these types of projects.
Service references are not currently supported in Visual Studio for Mac.
There is a dotnet svcutil command line tool you can use to generate service references. Not sure if you can use that instead, depending on what web service you are trying to use.
To have support for service references in Visual Studio for Mac probably the best thing would be to open a feature request for it.

StandAlone c# application [duplicate]

I've finished my C# application, but I have a little problem:
When I try to run my application in another PC, I need always to Install .NET Framework 4.0.
Is there something to do to make it work without installing the framework from internet?
I tried before InnoSetup for a VB6 application, but I'm not sure if it's going to work for .NET 4.0!
Any ideas?
Use Visual Studio Setup project. Setup project can automatically include .NET framework setup in your installation package:
Here is my step-by-step for windows forms application:
Create setup project. You can use Setup Wizard.
Select project type.
Select output.
Hit Finish.
Open setup project properties.
Chose to include .NET framework.
Build setup project
Check output
Note: The Visual Studio Installer projects are no longer pre-packed with Visual Studio. However, in Visual Studio 2013 you can download them by using:
Tools > Extensions and Updates > Online (search) > Visual Studio Installer Projects
You need to create installer, which will check if user has required .NET Framework 4.0. You can use WiX to create installer. It's very powerfull and customizable. Also you can use ClickOnce to create installer - it's very simple to use. It will allow you with one click add requirement to install .NET Framework 4.0.
WiX is the way to go for new installers. If WiX alone is too complicated or not flexible enough on the GUI side consider using SharpSetup - it allows you to create installer GUI in WinForms of WPF and has other nice features like translations, autoupdater, built-in prerequisites, improved autocompletion in VS and more.
(Disclaimer: I am the author of SharpSetup.)
Include an Setup Project (New Project > Other Project Types > Setup and Deployment > Visual Studio Installer) in your solution. It has options to include the framework installer. Check out this Deployment Guide MSDN post.

install dependencies automatically when user install software (.Net)

I'm building a software using .Net 3.5 (c#, WPF), My software need to user install .Net 3.5 and Media Player 11. I want to build an installer that automatically install this two component while user install main software. How i can fix that?
this components:
1- .Net 3.5
2- Media Player 11
Create a setup package using visual studios instructions (Updated Link). for vs2010:
On the File menu, point to Add, then click New Project.
In the resulting Add New Project dialog box, in the Project Types
pane, open the Other Project Types node, open Setup and Deployment
Projects, and select Visual Studio Installer.
In the Templates pane, choose Setup Project for a standard setup, or
Web Setup Project for a Web application.
I usually do this inside the solution i want an installer for. You will create a project like:
Note the detected dependancies folder. In here, make sure you have the relevant .net framework and media player modules. Building this wil produce a .msi and a .exe, and will also output an installer for the framework plus other compnents and assemblies. When the user runs the exe, they will be prompted to install the necessary dependencies.
Ofcousre there are other installer packages, but this one is visual studios integrated and i find it works great for many purposes.
Edit:
Adding dependencies:
Right click the installer project -> properties - > prerequisites, select the .net framework desired.
for all other dependencies right click the installer project -> add -> assemblies and either browse to the assembly you want or if it is .net, select it from the list

Visual Studio 2010 wants to start project as class library

sometimes i have problems with the debug.
I have a solution with some projects (1 WPF application, 1 console application and some libraries - the console application host some services and the wpf application is the client).
If i want debug the client (or the host) visual studio means it can not be started because it is a class library. But after some tries and restarts of Visual Studio i can debug one of the projects without problems!
Is there a solution for this problem?
Mfg
edit#1: i have already set a startup project. If i want to debug the client, the host will be the startup project. If i want to debug the host, the client will be the startup project.
When using Visual Studio 2010 (probably even before that ;)), you can specify multiple startup projects. Just right click on the solution, click Set Startup Projects and choose radio button item Multiple startup projects. You can now set the Action property to Start (with or without debugging) for all projects you like.
If you are just hitting debug and haven't set a default debug start project, then it will try and debug the current project, which may well be a class library.
Set the default project by right cliking on a project in SOlutions Explorer and Set As StartUp Project.

Categories