MediaPlayer does not appear in Toolbox even when adding from COM Components. - c#

I have googled so much about this issue. I have Visual Studio 2013. Following instructions: right click in toolbox, add mediaplayer from COM components and still this error:
Element 'MediaPlayer' is not a known element. This can occur if there is a compilation error in the Website, or the web.config file is missing.
config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5"/>
</system.web>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
</appSettings>
</configuration>
There is no error in website, I have the latest Silverlight. Please can someone help?

All that is needed is the System.Web.Silverlight.dll. file adding. Instructions:
1.Right click on toolbox (anywhere)
2.Select choose item
3.When the window opens click browse and search for your dll file.

Related

Cannot load file or assembly with System.Web.Http, Version=4.0.0.0

I am trying to upload my application to a host, however, I keep getting this error and I don't know how to handle it. Even if I try to add the assembly to my project, it does not work.
Anyone has any ideas? I am all yours. Thank you in advance.
Parser Error Message: Could not load file or assembly
'System.Web.Http, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
system cannot find the file specified.
Source Error:
An application error occurred on the server. The current custom error
settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could,
however, be viewed by browsers running on the local server machine.
Source File: H:\Inetpub\vhosts\Panel.Test.com\httpdocs\web.config
Line: 30
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'System.Web.Http, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.6.1069.1
Here is my Web.config
<configuration>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
</appSettings>
<system.web>
<pages validateRequest="false"/>
<httpRuntime requestValidationMode="2.0"/>
<customErrors mode="On">
<error statusCode="404" redirect="~/error/default.html"/>
</customErrors>
<authentication mode="Forms">
<forms name="MyAppCookie" loginUrl="Login.aspx" protection="All" timeout="120" defaultUrl="Default.aspx"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies>
</compilation>
</system.web>
Of course Connection-string has been cleared for security proposes.
Make sure to upload System.Web.Http.dll with your project. It usually ends up in the 'bin' folder after compiling.
I don't find the article and I don't remember well but after certain security pack update the new version is 4.0.0.1. Remove and install 4.0.0.1 solved for me.

Run time Error in converting application from .NET 2.0 to 4.5.1

I'm trying to convert my application from .NET 2.0 to 4.5.1 but I got the with the run time version of my application.
Could not load file or assembly '...dll' or one of its
dependencies.This assembly is built by a runtime newer than the
currently loaded runtime and cannot be loaded.
How can I can get rid off this?
Did I forgot something to add or modify on my Web.config?
The process of publishing the application is through local and the published files will be copy paste on the application server in Virtual Machine.
I just solved the issue by publishing the application locally in VS2013,get the published version and add & modified the web.config of the application server instance with the ff:
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="[myDllname].Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<system.web>
<globalization uiCulture="auto" culture="auto"/>
<customErrors mode="Off"/>
<pages validateRequest="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add tagPrefix="csla" namespace="Csla.Web" assembly="Csla, Version=3.0.3.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30"/>
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.5.1">
<assemblies>
<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
<identity impersonate="true"/>
<authentication mode="Windows"/>
</system.web>
Just make sure that the target framework is in compatible mode. In my case, I'm using old CSLA version.

Razor highlight stopped working

I have modular MVC Portal-Plugin application. When I've changed output path of mvc application Razor highlight and intellisense stop to work in cshtml files. Can anybody faced with this issue before? I've also added post build event to copy Views into custom directory
I have main "Container" MVC application and modules (mvc projects)
Main mvc application and modules reside in one solution
There is next options on each module MVC application:
Output Path : ..\Container\bin\
Post build Event: xcopy "$(ProjectDir)\Views" "..\Modules\$(ProjectName)\Views" /s /i /y
After this manipulations my Razor intelisense and highlight stop to work in module application.
I solve my problem. It was problem with output path.
I've just put default output path "bin\" and add post build event to copy my dll from this folder into another one.
Solved it and blogged about it in here...
http://mhammadchehab.com/wordpress/2013/12/enabling-intellisense-for-razor-in-class-library-mvc-5-razor-3-0/
*Right Click – >Manage Nuget Packages
*Click on the installed Packages.
*Click Uninstall.
*When your done search for MVC 5 online and install the Library.
*Right click on your project and go to properties
*Select Build
*On Configuration select all configuration.
*Go to the output path and type “bin\”
*Clean your project and rebuild.
*Make sure that your cshtml file is closed.
*Reopen your view file and BOOOOOOM it works.
Make sure your web.config file in your Visual studio project contain the following lines:
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="MyCustomHelpers" />
</namespaces>
</pages>
</system.web.webPages.razor>\
These lines give you the intelli sense.
Changing the Output Path to bin/ is the correct answere, but I extended it a bit. the steps needed for all creating a "vanilla" class library with intellisense support are the following
Create or open an existing class library project (if you open an existing one be sure to remove the MVC5 nuget package)
Add the MVC (5.0) nuget package (right click project in solution explorer -> Manage NuGet Packages -> search for MVC and install “Microsoft ASP.NET MVC”)
Close any and all open .cshtml files
Right click project -> Properties -> Build -> change Output path to “bin/”
Add the following minimal Web.config to the root of your class library project ( the web
config file is solely needed for intellisense. Configuration (via Web.config) should be done in the WebApplication hosting your ClassLibrary assembly)
Clean and Build the solution.
Open cshtml file
web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
</system.web>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
<!-- add other namespaces for views here -->
<!-- e.g. your own project's, Lib.Views.Etc -->
</namespaces>
</pages>
</system.web.webPages.razor>
</configuration>
I also just blogged about this http://thetoeb.wordpress.com/2014/01/05/enabling-mvc5-intellisense-in-a-classlibrary-project/
I resolved it as follows. In web.Config, add this:
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
</appSettings>
For reference, webpages:Version does this:
If the key is missing from web.config file such as default Razor V2/V3
website, VS will use bin directory’s razor dll version to determine
the design time razor engine dll to load.
https://stackoverflow.com/a/27918972/3146

Get razor intellisense in library project?

I have a business project where I will be creating emails based on templates made with razor. How can I get razor intellisense there? Is it as simple as including a few assemblies or do I need to do something more retorted?
This is for using the RazorEngine library.
You have to edit your .csproj file. Add following ProjectTypeGuids node (add just bellow them bellow existing ProjectGuid node).
<ProjectGuid>{28AD1627-3486-48C2-A045-EFFBB441582B}</ProjectGuid>
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
Save file, then reopen it with Visual Studio. VS2012 then performs some conversion, but at the end everything is OK. Tooling is there.
Depending what you are doing (Razor Generator?) you will need some references (System.Web, System.Web.WebPages, System.Web.Mvc, System.Web.Razor, System.Web.Routing...).
This was tested with VS2012.
In Visual Studio 2013 I had to also replace the following line in the .csproj file because it pointed to a wrong loaction:
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
This is a nice guide to achieve this.
http://thetoeb.de/2014/01/05/enabling-mvc5-intellisense-in-a-classlibrary-project/
The steps are:
Add the MVC (5.0) nuget package (right click project in solution explorer -> Manage NuGet Packages -> search for MVC and install “Microsoft ASP.NET MVC”)
Close any and all open .cshtml files
Right click project -> Properties -> Build -> change Output path to “bin/”
Add the following minimal Web.config to the root of your class library project (the web config file is solely needed for intellisense. Configuration (via Web.config) should be done in the WebApplication hosting your ClassLibrary assembly)
Clean and Build the solution.
Web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
</system.web>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
<!-- add other namespaces for views here -->
<!-- e.g. your own project's, Lib.Views.Etc -->
</namespaces>
</pages>
</system.web.webPages.razor>
</configuration>

Html.RenderAction is not available after including Microsoft.Web.Mvc dll

We want to use Html.RenderAction in our MVC1.0 project. I have downloaded the Futures Microsoft.Web.Mvc dll from codeplex, copied it to the bin folder in our project, and added a reference to it.
However, when I try to use it in one of our views, Html.RenderAction is still not available.
It might be just a silly detail I'm missing, but I have no idea what else I have to do :(
P.S. I checked, and I can actually write "Microsoft.Web.Mvc.ViewExtensions.RenderAction" and Visual Studio autocompletes the code just fine, so it seems the dll is correctly included in the project.
You have to add it to the "namespaces" tag in web.config.
<system.web>
<pages>
<namespaces>
<add namespace="Microsoft.Web.Mvc"/>
</namespaces>
</pages>
</system.web>
RenderAction is part of the MvcFutures project.
Kindness,
Dan
You might need to modify your web.config:
<compilation debug="true">
<assemblies>
<add assembly="Microsoft.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</assemblies>
</compilation>
<pages>
<namespaces>
<add namespace="Microsoft.Web.Mvc"/>
</namespaces>
</pages>

Categories