FilterConfig in visual studio 2015 - asp.net-web-api

I am trying to migrate my asp.net mvc web api project to visual studio 2015 preview version.
I am not finding a way to adopt the FilterConfig.cs code on visual studio 2015 since the 2015 version doesn't going to support global.asax, web.config.
So where i can put my filterconfig, areaconfig.

You need to register your filters in the StartUp class, inside the ConfigureServices method:
public void ConfigureServices(IServiceCollection services)
{
// Add MVC services to the services container.
services.AddMvc().Configure<MvcOptions>(options =>
{
options.Filters.Add(typeof (MyGlobalFilterAttribute));
});
}

Related

Breakpoint put in decompiled assembly from .Net Reflector is never hit while debugging in Visual Studio

First, I created a testing assembly HelloWorld.dll which I want to debug and built it with release configuration.
namespace HelloWorld
{
public class HelloClass
{
public string SayHello(string name)
{
return "Hi " + name + "!";
}
}
}
Then I created standart ASP.NET MVC project and:
Referenced HelloWorld.dll assembly
Modified HomeController's About method
public ActionResult About()
{
var testingClass = new HelloClass();
ViewBag.Message = testingClass.SayHello("John");
return View();
}
Via .NET Reflector Object Browser decompiled HelloWorld assembly
Put breakpoint inside SayHello method (in decompiled file)
Run debug in IIS express or IIS and request ~/Home/About page
Result: Brekpoint is never hit.
When I go to Debug -> Windows -> Modules it seems that symbols for HelloWorld.dll assembly was loaded:
So, what am I doing wrong?
EDIT: I am using Visual Studio 2015 Update 1 and RedGate Reflector 8.5
After hours and hours of research and contacting RedGate support it seems to be a bug in their software.
Workarounds:
Use Visual Studio 2013, where it works as expected
In VS 2015 go to .NET Reflector -> Generate PDBs and select C# version to v4.5. Reflector has some problems with C# version v4.6

Can I use .net core on visual studio 2013

Is, or will .net core be available to use on visual studio 2013? Or it will be available only on visual studio 2015?
Thanks
Yes, it's possible to build against the .NET Core 5 contracts in Visual Studio 2013 by creating a Portable Class Library that targets .NET Framework 4.5 and Windows 8. You'll need to manually edit the .csproj file and add the following.
<PropertyGroup>
<ImplicitlyExpandTargetFramework>false</ImplicitlyExpandTargetFramework>
</PropertyGroup>
Then install the System.Runtime NuGet package and other .NET Core 5 packages.
The resulting assembly will be able to execute on any .NET Core 5-based framework including .NET Framework 4.6, ASP.NET 5 & .NET Native.
Note, this is the same technique used to build the .NET Core assemblies in the corefx repository.
An empty ASP.NET Core application can be built in VS2013 by doing the following steps:
Create a Console App project that targets at least .NET Framework 4.5.2 (using 4.5.1 is possible but support has now ended).
Install the following NuGet Packages:
Microsoft.AspNetCore.Hosting
Microsoft.AspNetCore.Server.Kestrel
Add existing item to project: [solution root]\packages\Libuv.[version]\runtimes\[os]\native\libuv.dll.
For the above file, set the property "Copy to Output Directory" to "Copy always"
Produce the necessary Startup.cs and Program.cs files
Basic Code (from the Getting Started Tutorial):
Program.cs
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
Startup.cs
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.Run(context =>
{
return context.Response.WriteAsync("Hello from ASP.NET Core!");
});
}
}

Can I make a windows form application in Microsoft Visual Studio Express 2013 Windows 8?

Seems likely that I am not able to create a windows form application using the Microsoft Visual Studio Express 2013 under Windows 8. The default templaters are only for creating apps rather than traditional normal windowed applications.
Is there any way I could find the template or find a solution?
Thanks.
You cannot.
Download Microsoft Visual Studio 2013 Express for Windows Desktop instead.
Link for online installer
Link for ISO file
Visual Studio download page
Actually yes, you can do that manually, by adding the references to the project (System.Windows.Forms) and changing the output type in the properties of the project, and adding classes - you have to manually do the whole thing..
To Expand RobDev's answer, you can actually do this. I will show you an example of how to do this in Visual Studio Express 2015 for Web, probably same applies for 2013 version.
Steps.:
Create an empty solution
Create a .dll library project
Change output in project properties to Windows Application. To do so, right click on the new added project and pick "Properties". There, you can change "Output Type" dropdown in Application tab.
Add a reference to System.Windows.Forms to your project (by right-clicking => Add Reference to your Reference option under your project)
Set the project to Startup Project, by right-clicking the project and choosing "Set up as Startup Project"
add a main method to the generated class (you can rename it to Main). It will need this code to start.
using System.Windows.Forms;
namespace ClassLibrary1
{
public class Class1
{
public static void Main()
{
Application.Run(new Form());
}
}
}
and voila! That will create a new fresh Form. You could use a starting point whatever form you want. To do so, add a new .cs class and make it inherit from Form class.
The toolbox to customize forms is available at View => Toolbox menu.

Cannot Import Asmx web service reference in vs 2010

I have web site built in visual studio 2008 using .net framework 3.5.Now i want to migrate the web site code to visual studio 2010 but want to keep the target framework to same i.e 3.5. The web site is built using vb.Net.MY problem is when i am importing the reference of web service in visual studio 2010 it show error as "NameSpace or type specified in imports 'WebReference' does not contain any public methods".My service name is "WebReference" . I thought may be .net has built in System.web.services.Description.Webreference ,may be it shows conflict ,so i tried to rename it to "WebReference1" or some other name but it does not have any effect,yhe error is still there.What am i missing?
probably it is because you cannot use importer :
ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
in vs 2010....you need vs 2012 because that only has support for .net framework 4.5 which in turn has assembly references to ServiceDescriptionImporter .

ODATA template in Visual Studio 2010

I don't see a OData (or WCF data service, or ADO.NET service) template in visual studio 2010. Am I missing something
If you create a new ASP.NET application, you can add to it a WCF Data Service, which should be what you are looking for.
These are the templates you need:
New Project => Visual C# Templates => ASP.NET Empty Web Application
Add an item to the new project => Visual C# Templates => ADO.NET Entity Data Model
Add an item to the new project => Visual C# Templates => Web => WCF Data Service
You can install WCF Data Services for OData. Doing this willl add a WCF Data Service (for OData) template under the Web tab of VS2010.

Resources