How can I resolve this error: Loading the include file 'EF.Utility.CS.ttinclude' returned a null or empty string - visual-studio

How can I resolve these errors:
Loading the include file 'EF.Utility.CS.ttinclude' returned a null or empty string.
Value does not fall within the expected range.
Tools Used: VS 2012, Entity Framework 5.0.0, T4MVCExtensions 3.5.0, .NET Framework 4.5
I've been using EF and T4 templates in a project within a large MVC solution without incident. Now, when I right-click on the edmx diagram, EF responds with the message: Value does not fall within the expected range. When I compile the EF project it responds with these messages:
Loading the include file 'EF.Utility.CS.ttinclude' returned a null or empty string. The transformation will not be run. C:\Projects\NSAForms\NSAForms\NSAFormsEDM\NSAFormsEntities.tt
Failed to resolve include text for file:C:\Projects\NSAForms\NSAForms\NSAFormsEDM\EF.Utility.CS.ttinclude C:\Projects\NSAForms\NSAForms\NSAFormsEDM\NSAFormsEntities.tt
Every table in the database has a primary key. I'm struck by how suddenly this issue appeared. Does anyone have some suggestions how to resolve this issue?
Thanks in advance,
Arnold

I had very similar issue and I tried with VS2012 and VS2013.
After reinstalling Entity Framework 6 Tools for Visual Studio 2012
http://www.microsoft.com/en-us/download/confirmation.aspx?id=40762
every thing went back to normal.

In VS 2012, the EF.Utility.CS.ttinclude file will only be installed if the Microsoft Web Developer Tools or Microsoft SQL Server Data Tools component is selected.

Reinstalling Entity Framework 6 Tools for Visual Studio 2012 http://www.microsoft.com/en-us/download/confirmation.aspx?id=40762 work for me

For VS2017, I ended up adding EF6.Utility.CS.ttinclude to model's folder. This resolved my issue with MySql and EF.
File can be found: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF6.Utility.CS.ttinclude
UPDATE To avoid doing the above, removing the entities completely then adding back in fixed the issue.

Had this issue with a recent install of VS2017 Enterprise after already having this functionality working in Professional.
The solution for me was to:
Open the Visual Studio Installer program and "Modify" my Enterprise installation.
Select "ASP.NET and web development" under the Web & Cloud section
Click "Modify" in bottom right
It's probably worth noting that I already had EF6 installed and did not need to re-install it to get this to work.
After completing those steps and firing up Visual Studio, the error went away and I was able to generate my classes successfully. Hope this helps!

Visual Studio 2017
was getting the same error but only in a test project. after reviewing the test project and the other project successfully referencing that file i found that adding the following to the app.config of the failing project resolved my issue
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<connectionStrings>

All of the above solutions did not work for me so I created a new project to see if the problem persists but the error did not occur in the newly created project. I then compared the project with the old backup to check recent changes made and found the problem. I recently had upgraded a package Clarius.TransformOnBuild to more recent version after downgrading the package the error went away.

In my case the issue was caused by a bizarre folder name (with %20 instead of spaces). I just made a directory junction to the same folder with spaces instead of %20 and it solved the issue.
Here is the PowerShell command I used to make the junction:
cd "c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\"
mklink /j "Entity Framework Tools" "Entity%20Framework%20Tools"
Junction created for Entity Framework Tools <<===>> Entity%20Framework%20Tools
You can then use ls look at the directory contents, and you should see these two lines (edited for brevity):
Mode LastWriteTime Length Name
---- ------------- ------ ----
...
d----l 2/27/2019 9:57 AM Entity Framework Tools
d----- 2/26/2019 12:24 PM Entity%20Framework%20Tools
...
Under Mode, the l indicates that it is a "link" (aka junction), and the d indicates it's a directory. By making a junction instead of renaming the folder, you can be sure that both directory names will always work.

Related

Build error "Cannot find name 'Record'" with bootstrap 4

Today, I decided to migrate my ASP .NET MVC 5 project from bootstrap 3 to bootstrap 4 (the sass version).
After the migration, I got an error after the compilation of my project.
Error Build:Cannot find name 'Record'.
Error Build:Cannot find name 'undefined'.
How to solve this?
After some research, I found this link to have a better understanding of typescript and visual studio. If you want to improve your skills, you can go to this official page and have some readings.
The solution
You just have to update the typescript plugin for Visual studio. You can download the latest version here for visual studio 2015.
Here for visual studio 2017
Enjoy!
If, for some reason you are unable to update your Visual Studio with the updated TypeScript .exe file (company/business IT policy, non-admin account, etc...), you can try this solution:
Single-click on the "index.d.ts" file in Visual Studio Solution Explorer.
Look in the Properties panel, under "Build Action".
Switch it from "TypeScriptCompile" to "Content".
Now, you'll be able to build your project without these errors.
Update 2019
I have found another workaround/solution that hasn't had any noticeable effects and still allows me to compile without erroring on index.d.ts. Just comment line 68 in your index.d.ts file as such:
//[name: string]: (BaseModifier & Record<string, any>) | undefined;
For Visual Studio 2015:
I downloaded TypeScript, installed and restarted Visual Studio. While restarting it prompted me the TypeScript my solution uses is older than what is installed(2.9.2) and whether I want to update it to the supported version, I clicked Yes and that fixed the issue.
My guess is TypeScript 2.9.2 is for VS 2017 maybe.
I uninstalled jpopper.cs and went to the Web.config file and added these lines of code
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
to deal with that validation error.
Out of the box, for me it has been fixed by update VS 17 to latest version!!
open your project in visual studio 2017 and it will ask you to upgrade the typescript just press upgrade
OR
Upgrade your Typescript version

My Visual Studio is missing Microsoft.VisualStudio.QualityTools.UnitTestFramework

I configured now a new computer. Installed VS 2010 and all necessary component, got my running project on that new computer..
Compiling the project shows me that VS 2010 cannot find the reference "Microsoft.VisualStudio.QualityTools.UnitTestFramework".
This assembly is located in
Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies
But VS is not able to find it.
The used project is OK. It can be compiled on my old machine!
Edit:
The error while compiling:
error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Upgrade of some 2003 code for us was resolved through the following:
Removing the existing broken reference
Updating the project from .Net 3.5 to .Net 4 (not the client version)
Adding the new one from VS2010 OR VS2012
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
The existing "USING" statement worked without change.
"using Microsoft.VisualStudio.TestTools.UnitTesting;"
I had the same problem.
Old machine:
Windows XP, 32 bit
VS 2010 (32 bit)
New machine:
Windows 7, 64 bit
VS 2010 (32 bit)
I solved it by simply deleting the reference to Microsoft...UnitTestFramework, and adding the new one, which was here:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
I did not need to change the target .NET framework version.
Check that your project is not marked for X64 platform in a mixed solution configuration (right click the solution -> Configuration Manager option). After changing the platform for the test project from X64 to Any CPU the assemblies were recognized and it worked.
Forget to mark this as solved:
What I did:
Uninstalled VS 2008 and VS2010 including all updates - Installed VS2008 full, VS2010 full Now it works! The cause is still unknown!
Staggering: 7 years on, still an issue
The solution that worked for me (Visual Studio 2017, Pro) was to delete the reference from the list (see image below) and then re-add it.
No Solution, just some hints:
// using Microsoft.VisualStudio.QualityTools.UnitTestFramework
// Path: %ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
You also need to check the versions. There are two out by now (10.1.0.0 and 10.0.0.0) A wrong will result in such an error.#
All versions of the unity-framework can be found at Codeplex. unity.codeplaex.com
Compile against the .DotNet4 Framework 4 instead of the .DotNet4 Framework 4 Client Profile might also solve the problem.
I was getting the same problem, but found that in the references it was set as GAC, so I removed this and put it in the BIN folder. When it was on one server it was fine but that was because it was registered on that machine and not the other
I believe your problem is that you have a project that was created on a machine with VS2010 SP1 installed and you are running on a machine with VS2010 (no SP). I recently had to change machines and my IS department installed an image on the new machine with VS2010, just like I asked.
When I pulled my code down out of source control, all of a sudden I couldn't run the unit tests because
"Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework"
Then I remembered that I had installed SP1 on my old machine. So I installed VS2010 SP1 on the new machine and magically the problem went away.
So try downloading and installing SP1
I had the same problem, too. It was caused by an config file automatically generated for the unit test dll, I didn't notice.
The app.cfg - file content was:
<?xml version="1.0"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.UnitTestFramework" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-10.1.0.0" newVersion="10.1.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
I have just removed that app.cfg file and everything worked fine without any other changes again.
I had same problem.
You need to change target framework of your project from ".Net Framework 4 Client Profile" to ".Net Framework 4"
It worked for me.
I had the same problem in an old project targeting DotNet Framework 2; updating it to DotNet Framework 3.5 solved it for me.

Visual Studio 2010 Premium is giving me a "Cannot Create Window" error!

When I first launched the Visual Studio (I just installed it) I choose the default programming layout (Visual C#/Visual Basic.NET/ F#/etc) as Web Development. It gave some error that it couldn't find the layout scheme or something and now it says Cannot Open Window.
Is there some way to reset the selected layout option?
I has the same error when I installs MySql Net Connector mysql-connector-net-6.3.4.msi
I think that this installer corrupt my VS 2010. But NOT.
Previous, I uninstall MySql Connector 6.3.2 and edit machine.config... this was the error!
<system.data>
<DbProviderFactories>
<!-- !!! aƱadido a mano para poderlo usar en VS2010
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net
Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory,
MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> -->
<add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/></DbProviderFactories>
</system.data>
The logic comments not is OK. Then, I erase all commented code and VS2010 come to the live, again!
In my lab the Visual Basic was working fine last semester, but this semester got that "Cannot create the Window" message. After trying reinstalling the VB, Visual Studio, .Net, and other things always got same message. Found a site that mentioned missing windowscodecs.dll file in the windows\system32 directory, but I had the file. Found a different date on file on machines witch the VB was working. Copied the newer windowscodecs.dll file, and that got rid of the problem, but later found I also had to copy the windowscodecsext.dll file as well.
Am now doing a comparison between the two systmes using sigcheck on all the files in system32. Have found a large number that report the Signing date: 12:07 PM 4/14/2008, but the other system has Signing date: 12:13 PM 4/14/2008. Haven't checked the actual contents to see how different the files are. Would be nice if there was a method to check and update to the latest versions.
I've had a similar problem with Visual Studio 2010 Express - restarting the computer solved it.
Similar error message here when starting up a freshly installed VS2010 Premium.
I had copy pasted stuff from old machine.config, but accidentally left out one Section-definition. Fixed by adding the missing definition into configSections-block.
Problem might be due to some issue in machine.config. Try to replace the config with the original and try.
This resolved for me.

.net 4.0 with Code Access Security NetFx40_LegacySecurityPolicy won't work

I'm trying to use an external library DevExpress.XtraTreeList.v8.1.dll in my vsto office addin built using VS2010 beta 2. I am getting the following compile time error:
DevExpress.Utils.AppareanceObject threw an exception --> System.NotSupportedException.
The error message goes on to say that for compatibility reasons I can use the NetFx40_LegacySecurityPolicy switch.
I've tried putting this config variable in all of the following locations:
1) my applications config file.
2) C:\Windows\Microsoft.NET\Framework\v4.0.21006\msbuild.exe.config
3) C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\dev.exe.config
None of these have resolved the problem. Here were the references I've used.
re-enable cas
msdn.microsoft.com/en-us/library/ee191568(VS.100).aspx
How do I get rid of this error so I can build the application in vs 2010?
LC.exe fails to process license information of devexpress 9.1.4 dlls
Update: Looks like this program is related to lc.exe. create a file called lc.exe.config that contains
<NetFx40_LegacySecurityPolicy enabled="true"/>
under C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\ (NETFX 4.0 Tools) solves the problem
This does work, however, you'll also need to create a file for devenv.exe.config to edit form designer changes, and the side effect of that is that COM references in project's will give obscure errors.
The end result, is that we really need an update from DevExpress on this. Allegedly a beta fix with a 2010.1 release is due any time now, come on DevExpress, hurry up! :)

Visual Studio 2005 Can't find System assemblies

I have Visual Studio 2008 installed on my machine, but I haven't used it. I did open a dummy project and make sure that version 2.0 is the .NET Framework version I am using, since it is the one that suddenly doesn't work for me.
Here's the warning message I get when I am trying to open an existing Windows 2005 project.
"Namespace or type specified in the project level Imports 'System.Data' doesn't contain any public member or cannot be found."
All of the basic System, System.Data, System.XML assemblies show up in a new project with the yellow exclamation point warning.
Does anyone know how I can solve this issue? Please help!
I would start by downloading and re-installing .NET 2.0 on your system.
You could check the project references and make sure that you have System.Data added to the project.

Resources