T4MVC Error - T4 file is blocked or in a non trusted zone
Asked Answered
E

8

24

I am running Visual Studio 2010 on a Windows 7 virtual machine inside of Parallels Desktop 8 on a Mac Book Pro.

I'm trying to incorporate T4MVC into a new MVC4 project. I installed the T4MVC package from Nuget and immediately started getting this error...

Failed to resolve include text for file:The path '\psf\Home...\T4MVC.tt.hooks.t4' must be either local to this computer or part of your trusted zone. If you have downloaded this template, you may need to 'Unblock' it using the properties page for the template file in Windows Explorer.

I went into the "Properties" menu for the T4MVC.tt.hooks.t4 file, but I could not find any option or button to unblock it.

My assumption is that this problem has something to do with the fact that I'm running on a virtual machine and therefore My project files are not in a trusted location. But I'm not sure how to fix that.

I've been searching around but can't seem to find any answers. Any help would be appreciated.

Thanks

Exterritorial answered 3/11, 2012 at 11:36 Comment(0)
R
12

In Windows Explorer, right click on the file, and choose Properties. At the bottom of the General tab, there should be an "Unblock" button.

Reciprocation answered 3/11, 2012 at 12:14 Comment(4)
Right, but like I mentioned, I don't seem to have a button or any other option in "Properties > General Tab" of that file to Unblock.Exterritorial
Strange because normally, when it comes from a NuGet package, it doesn't have that 'unsafe' bit.Trygve
I'm in Win8, don't have that button.Sagittate
On windows 8 this does not work. The answer by @sevin7 is the right way to go on Win8!Sadie
N
40

This works for me with VS2012:

Using Internet Explorer:

Go to Tools | Internet Options and click the Security tab Under Trusted Sites, click Sites and uncheck “Require https…” Finally add a new entry – it should be the location of your shared folder: “file://folder_name” – note we’re using file instead of https.

Nedrud answered 19/4, 2014 at 19:7 Comment(0)
R
12

In Windows Explorer, right click on the file, and choose Properties. At the bottom of the General tab, there should be an "Unblock" button.

Reciprocation answered 3/11, 2012 at 12:14 Comment(4)
Right, but like I mentioned, I don't seem to have a button or any other option in "Properties > General Tab" of that file to Unblock.Exterritorial
Strange because normally, when it comes from a NuGet package, it doesn't have that 'unsafe' bit.Trygve
I'm in Win8, don't have that button.Sagittate
On windows 8 this does not work. The answer by @sevin7 is the right way to go on Win8!Sadie
G
3

This happens to me if I run the project of a shared drive through Parallels.

Windows FIX: Fixed by adding the network drive to trusted web sites. Guide (translated from other language OS)

Open Internet Explorer Open Internet settings Safety pane "Trusted websites" "Websites" Untick "require https for all websites in this zone" Add your network drive like x: For me it added "file://psf" Worked for me.

Guiana answered 5/1, 2016 at 3:7 Comment(0)
I
2

The site below has a good example of adding the Parallels share to the trusted zone for use with opening a Visual Studio project without warnings. The same technique should remove this warning for T4.

http://blog.florianb.net/2009/10/31/loading-projects-in-visual-studio-using-the-shared-profile-feature-in-parallels/

Isochronism answered 5/3, 2013 at 21:35 Comment(0)
A
1

Use the method to add security zones described here. Add your parallels shared folders under the trusted sites section. You may have to uncheck the require HTTPS box.

Angulo answered 5/3, 2013 at 20:49 Comment(0)
G
1

To allow VS.NET to load things of a network share one needs to add them (shares) to trusted locations. Have a read of this. This will solve the problem for Windows 8 users, when the file is not actually blocked as described above.

To add a location to a full trust list run (obviously amend as required for you environment):

caspol -m -ag 1.2 -url file:///H:/* FullTrust

To verify or list existing trusted locations run:

caspol -lg
Garry answered 13/8, 2013 at 7:0 Comment(0)
S
1

It's a file protection thing. The work-around was to create new files of the same name and copying in the text from the old files. Since these files were created on my local computer, there was no conflict.

I had this issue with VS2015 / VS2017 when I copied the .ttinclude files from another project. Creating the new .ttinclude file from the project and renaming them was the only solution.

Stonework answered 8/4, 2017 at 8:10 Comment(0)
R
0

None of them worked. The source of my problem was, I formatted my pc and in most of my projects, i hardcoded common,modified version of EF's tt. The path was e:.. before formatting.

After formatted, i removed e drive and used d as the same folder. Projects started failing saying that the path is not accesible, right. I created a very small e drive with junction links after, these error messages came...

failed to resolve include text for file:The path '.tt' must be either local to this computer or part of your trusted zone. If you have downloaded this template, you may need to 'Unblock' it using the properties page for the template file in File Explorer.

What i did to resolve was, changing every single path to d drive in tt files:

<#@ include file="d:\BitBucket\Kahia\EF Templates\EF6 ClientModel.tt"#>

it was actually;

<#@ include file="e:\BitBucket\Kahia\EF Templates\EF6 ClientModel.tt"#>
Runofthemine answered 29/5, 2018 at 21:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.