Umbraco CMS problem: The type 'IEnumerable<>' is defined in an assembly that is not referenced - content-management-system

I Just started using Umbraco CMS v.9 and when I try to see the page I just created it shows an error.
Code
#using Umbraco.Cms.Web.Common.PublishedModels;
#inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.HomePage>
#using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
#{
Layout = null;
}
<!DOCTYPE>
<html>
<head>
#Model.Name
</head>
<body>
<div>
#Model.Check
</div>
<div>
</div>
</body>
<footer>
</footer>
</html>
Error:
The type 'IEnumerable' is defined in an assembly that is not referenced. You
must add a reference to assembly 'System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'
I've been searching the solution for a while. I came across a lot of other people who have encountered similar (my assumption) problems. I tried to add to web.config something like:
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"/>
</assemblies>
</compilation>
but any time I rerun, the file web.config get overwritten with the original code deleting the lines I wrote. (this thing is really upsetting me)
How this thing can be fixed?
Thanks

I don't think it is v9 you are using if you have a web.config. V9 does not have a web.config file as it is written in .Net Core. Settings are in appsettings.json.
I think you have v8.
Also I think the issue you are facing can happen if your view / class / code is not referencing System.Collections.Generic
Place the following using statement at the top of the page wherever you are referencing IEnumerable
using System.Collections.Generic;

Related

Using angular-ui and tinymce

I'm trying to use the angular-ui tinymce directive. I used Nuget to get the angular-ui (v 0.4.0), tinymce.jquery (v 4.0.6), and tinymce (v 4.0.6)packages. I added the ui directive to my angular module and referenced the following scripts (in order) on my page:
<script src="Scripts/jquery-1.10.2.js"></script>
<script src="Scripts/tinymce/tinymce.min.js"></script>
<script src="Scripts/tinymce/jquery.tinymce.min.js"></script>
<script src="lib/angular/angular.min.js"></script>
<script src="Scripts/angular-ui.min.js"></script>
When I navigate to the partial that contains the textarea that I decorated with ui-tinymce ng-model="tinymce", I can see the error (angular.min.js) listed in my title in Chrome's javaScript console.
I've searched the web and tried suggestions such as changing the listing of the script references, but nothing I've tried works. Am I missing a key component, do I have incorrect references (or out of order), or something else? I've come accross some fiddles, but most are broken or down. I haven't yet seen one that gives a working demo that I can use.
EDIT: Ok, now I'm getting the error: "Cannot call method 'Add' of undefined" at angular-ui.min. I didn't change anything in the code, so it's possible that the original error message was from a previous attempt?
The error you are receving is occurring from a version mismatch between tiny-mce (4.0.6) and the angular-ui (0.40) package.
Looking at the api for 4.x for tinyMCE onSetContent() does not exist and has been replaced with .on()
It looks like ed.onSetContent() exists in TinyMCE 3.x.
With that being said if you replace the tinymce package with a 3.x version everything should now play nicely together.
Installed Packages
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Angular.UI" version="0.4" targetFramework="net45" />
<package id="angularjs" version="1.0.7" targetFramework="net45" />
<package id="jQuery" version="1.9.1" targetFramework="net45" />
<package id="Select2.js" version="3.2.1" targetFramework="net45" />
<package id="TinyMCE" version="3.5.8" targetFramework="net45" />
<package id="TinyMCE.JQuery" version="3.5.8" targetFramework="net45" />
</packages>
Once the packages are installed you can get it all wired up with the following view:
<body ng-app="MyApp">
<textarea ui-tinymce="" ng-model="tinymce"></textarea>
{{tinymce}}
<script src="Scripts/jquery-1.9.1.min.js"></script>
<script src="Scripts/angular.js"></script>
<script src="Scripts/angular-ui.js"></script>
<script src="Scripts/tinymce/tiny_mce.js"></script>
<script src="Scripts/tinymce/jquery.tinymce.js"></script>
<script>
var myApp = angular.module("MyApp", ["ui"])
</script>
</body>
Working application on github

WebMatrix 2 doesn't recognize EntityFramework helper

I just started to work on WebMatrix, I did this tutorial to learn the basic and then I started with this one to get started with Entity Framework on WebMatrix (Note: That tutorial is for WebMatrix 1, but the only thing I see changed was the way you install helpers into your project). The thing is, I installed the Entity Framework helper, but my project doesn't recognize the EntityFramework.dll.
I get this error The type or namespace name 'MaxLength' could not be found (are you missing a using directive or an assembly reference?). But the EntityFramework.dll does appear in my bin folder, what is going on? I don't understand why the reference isn't working.
This is my Web.config file according to the second tutorial and after installing the EntityFramework helper:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0"><assemblies><add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /><add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /></assemblies></compilation>
</system.web>
<connectionStrings>
<add name="BookContext" connectionString="Data Source=|DataDirectory|Books.sdf" providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
</configuration>
This is the compiler output link
Am I missing something? Why does the EntityFramework.dll isn't being recognized properly by my project?
UPDATE
I thought the problem was solved when I copied the EntityFramework.dll from a webpage project created in Visual Studio 2012, but even though the errors aren't shown anymore, WebMatrix still doesn't recognize annotations like Table, Column, ForeignKey, InverseProperty, etc.
I really don't understand, a simple database is created but I can't use the EntityFramework annotations to specify all I need for the database. WebMatrix should recognize the EntityFramewor.dll but it is not. I need help in this one because I'm really lost.
The error that you see is the end result of the version of EntityFramework installed on your site.
The EntityFramework 5.0 package installs version 4.4 or 5.0 of the EntityFramework.dll depending on the version of .NET (4.0 or 4.5) that the project is targeting.
In my experience, installing EntityFramework from the NuGet Gallery in WebMatrix always copies version 4.4 of EntityFramework.dll into the bin folder: you can check it looking at Properties --> Details of the EntityFramework.dll file.
The only solution I know is to download EntityFramework v.5.0 using VisualStudio Express or another standalone utility (look at this post: Install Entity Framewok v5 in Webmatrix 2 RC) and simply replace the dll installed by NuGet Gallery in WebMatrix with this one.
UPDATE
Other problems experimented with EntityFramework v.5.0 and WebMatrix are that the type 'System.Data.EntityState' is defined in an assembly that is not referenced and that is needed a using directive for DataAnnotations.Schema.
The first problem is resolved adding the following reference to web.config (look at Could not load file or assembly 'System.Data.Entity):
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
The second problem needs the addition of the directive
using System.ComponentModel.DataAnnotations.Schema;
to the code.
Anyway, in my opinion WebMatrix isn't the right tool for developing a site based on EntityFramework.

Eclipse won't reckognize and validate JSP tag dir attributes

I'm currently using Spring Source Tools 2.9.1 - but I had the same issue with standard Eclipse J2EE distribution.
I'm writing java web application with jsp views.
To better reuse code I have created some tags - *.tag files in WEB-INF\tags folder
Example of enum.tag file:
<jsp:root version="2.0"
xmlns:form="http://www.springframework.org/tags/form"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:spring="http://www.springframework.org/tags"
xmlns:tags="urn:jsptagdir:/WEB-INF/tags"
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<jsp:directive.tag pageEncoding="UTF-8" />
<jsp:directive.attribute name="value" required="true" rtexprvalue="true" type="Object" />
<jsp:directive.attribute name="cssClass" required="false" rtexprvalue="true" />
<span class="enum ${value.cssClass} ${cssClass}">
<span class="message">
<spring:message code="${value.name}" />
</span>
</span>
</jsp:root>
If I use this tag in my jsp the tag is reckognized by validator, but the tag attributes are not.
so I get warning for this line of jsp
<tags:enum value="${t.state}" />
warning:
Undefined attribute name "value"
tag nemaspace is initialized with:
xmlns:tags="urn:jsptagdir:/WEB-INF/tags
How to setup eclipse to properly validate tagdir's tags?
I use XML version of jsps (and tags) - all teh fiels are valid XML documents, it uses syntax like
<jsp:directive.tag pageEncoding="UTF-8" body-content="scriptless" />
<jsp:directive.attribute name="caption" required="false" rtexprvalue="true" />
<jsp:directive.attribute name="labelInfix" required="false" rtexprvalue="true" />
I now realized and checked that I need to use tagx extension (alongside jspx). With this change Eclispe validation works well.
Yes, as of the time of this writing, using Eclipse Luna, Eclipse's JSP tag validation for custom tags in JARs (called 'packaged tag files' by Oracle) is still horrible. I have two Java projects, one which contains the JAR which has my .tags and TLD (the TLD has elements). I managed to get the JSP tag validation e.g. <t:customTag /> working but Eclipse still marks all attributes in yellow as "undefined attribute name".
I was able to get the tag validation working in my dependent project by:
Adding the tag project to Build path->Projects->"Required projects
on the build path"
In my JAR/tag project itself, under Java build path->Order and
export, I marked the JAR file itself as exported.

'compilerVersion' attribute in the provider options must be 'v4.0' or later

Getting this error:
The value for the 'compilerVersion'
attribute in the provider options must
be 'v4.0' or later if you are
compiling for version 4.0 or later of
the .NET Framework. To compile this
Web application for version 3.5 or
earlier of the .NET Framework, remove
the 'targetFramework' attribute from
the element of the
Web.config file.
It was working on our dev system, and we are now deploying to QA using an xcopy type deploy.
We don't have a "compilerVersion" anywhere in the web.config, and the targetFramework is set to "4.0". We have done an IISReset.
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
UPDATE 2: when we removed the entire section, we got past the error. So my question is, what is wrong with leaving in this section if we are on .NET 4.0?
We just did a full xcopy of exactly what was in Test to QA, and in QA it gets the error and DEV doesn't. So the software and configs are identical. Why would it work on one server and not another? IIS options seem to be identical.
taken from: http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770150
you should go to your server root web.config and include the whole
<system.codedom>...</system.codedom>
tag content into a
<location path="" inheritInChildApplications="false">...</location>
tag
Possible solution here - asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770150
After fighting with this for a while, I ended up creating a new IIS site using a different port and adding my ASP.Net 3.5 application to the new site and it is working perfectly.
I got the same error and found out that my v4.0 website was hosted under the default website that was v2.0. If you've such setup then you need to remove the following line from your web.config:
<compilation defaultLanguage="c#" debug="true" targetFramework="4.0"/>
I hope that helps.

JSP:include is not rendering the included file

I just created a new IceFaces application and I'm trying to include a navigation bar in all of the pages. When I use the jsp:directive.include tag the file is included, but when I use jsp:include it does not seem to be loaded. In fact, when I check the HTML source code in my browser, it's like the included file was completely empty. I do not want to use jsp:directive.include because it will not automatically show any updates to the included file.
My environment: Eclipse 3.5, Tomcat 6, JSF 1.2, IceFaces 1.8.
Steps to reproduce the problem and pieces of code:
create a new Dynamic Web Project with the following options:
Target runtime: Apache tomcat v6.0
Dynamic web module version: 2.5
Configuration: ICEfaces project
create a new ICEFaces JSPX file -- the home file. Some code:
<jsp:directive.page contentType="text/html;charset=ISO-8859-1" />
<f:view >
<ice:outputDeclaration doctypeRoot="HTML"
doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN"
doctypeSystem="http://www.w3.org/TR/html4/loose.dtd" />
<html>
<head>
<title>test file</title>
<link rel="stylesheet" type="text/css"
href="./xmlhttp/css/rime/rime.css" />
</head>
<body>
<jsp:directive.include file="./vertical_navigation.jsp" /> <!-- working -->
<jsp:include page="./vertical_navigation.jsp" /> <!-- not working, no error though -->
</body>
</html>
</f:view>
create the file to be included, also as a new ICEFaces JSPX file. Simplified code:
<ice:form>
<ice:panelGrid columns="1" width="152">
<ice:graphicImage url="./img/image.jpg"></ice:graphicImage>
<ice:panelCollapsible expanded="true">
<f:facet name="header">
<ice:panelGroup>
<ice:outputText value="Customer"/>
</ice:panelGroup>
</f:facet>
<ice:panelGrid columns="1">
<ice:commandLink action="customer"><ice:outputText value="Customer name" /></ice:commandLink>
</ice:panelGrid>
</ice:panelCollapsible>
</ice:panelGrid>
</ice:form>
</body>
</html>
</f:view>
Some remarks:
I'm completely new to JSF, so forgive me for any obvious mistake.
In the home file (the first one) I'm not using both tags at the same time. I pasted both here just to show that I am trying both options.
I created both files as "ICEFaces JSPX file", but the second one was assigned the .jsp extension.
When I use the directive.include tag, the included file is loaded. But if I change it, it's not automatically republished.
To start, you have to separate and distinguish several technologies:
JSP is a Java based view technology which allows you to write HTML/CSS/JS in and use taglibs to call backend Java code and/or control the output flow.
JSPX is the same as JSP, but forces you to write code in XML format. JSP-specific tags are replaced by tags in XML format. JSPX is also called "JSP Document". Here is a basic tutorial which outlines the differences in tags.
JSF is a component based MVC framework which provides components in flavor of taglibs which outputs HTML/CSS/JS.
You cannot use <jsp:include> in a JSPX page. You have to transform the JSPX page into a JSP page. You need to rename the file .jspx to .jsp and replace JSPX specific tags by JSP tags. Here's a kickoff example for JSP with JSF/IceFaces:
<%# page pageEncoding="ISO-8859-1" %>
<%# taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%# taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%# taglib uri="http://www.icesoft.com/icefaces/component" prefix="ice"%>
<!DOCTYPE html>
<f:view>
<html lang="en">
<head>
<title>Title</title>
</head>
<body>
<jsp:include page="include.jsp" />
</body>
</html>
</f:view>