Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7949535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:01:44+00:00 2026-06-04T02:01:44+00:00

In my project I have Resharper installed, and I’m doing design time templating with

  • 0

In my project I have Resharper installed, and I’m doing design time templating with T4 Templates from within Visual Studio.

I have

<#@ assembly name="$(SolutionDIr)FTest\bin\Debug\FTest.dll" #>
<#@ assembly name="$(SolutionDIr)FTest\bin\Debug\nunit.framework.dll" #>

I also have

<#@ import namespace="NUnit.Framework" #>

Then i have a cast in the code like this

    <#
    var someVar = (TestAttribute)typeof(BaseTest).GetMethods()
    .Where(
    x => x.GetCustomAttributes(false).Where(y => y.Name == "CategoryAttribute" && ((CategoryAttribute)y).Name == "Smoke").Any()
     )
    #>

Im getting an invalid cast exception. It tells me that the template generator uses a different ‘nunit.framework’ dll than the project dll uses.

Error   21  Running transformation: System.InvalidCastException: [A]NUnit.Framework.CategoryAttribute cannot be cast to [B]NUnit.Framework.CategoryAttribute. Type A originates from 'nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' in the context 'LoadFrom' at location 'C:\Users\Chandirasekar Thiaga\AppData\Local\assembly\dl3\ZGE1068O.OD1\ARWGXOXD.EMZ\7407d57d\ff3a4298_6ceccc01\nunit.framework.dll'. Type B originates from 'nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' in the context 'Default' at location 'C:\Program Files (x86)\JetBrains\ReSharper\v6.1\Bin\nunit.framework.dll'.

How do I, when importing with <#@ import namespace=”NUnit.Framework” #> import the same dll as the one that FTest.dll uses? I do not want to use the Resharper’s version of nunit!

EDIT :

After setting registry key like GarethJ said, the message looks like this :

Error   12  Running transformation: System.InvalidCastException: [A]NUnit.Framework.CategoryAttribute cannot be cast to [B]NUnit.Framework.CategoryAttribute. Type A originates from 'nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' in the context 'LoadFrom' at location 'C:\Repos\BSF-Functional-Automation\FunctionalTest\FunctionalTest\bin\Debug\nunit.framework.dll'. Type B originates from 'nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' in the context 'Default' at location 'C:\Program Files (x86)\JetBrains\ReSharper\v6.1\Bin\nunit.framework.dll'.
   at Microsoft.VisualStudio.TextTemplating64EAA000670725A96AF52252D093BE63.GeneratedTextTransformation.<TransformText>b__5(Object x)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.VisualStudio.TextTemplating64EAA000670725A96AF52252D093BE63.GeneratedTextTransformation.<TransformText>b__4(MethodInfo m)
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.VisualStudio.TextTemplating64EAA000670725A96AF52252D093BE63.GeneratedTextTransformation.TransformText()
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)        1   1   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:01:45+00:00Added an answer on June 4, 2026 at 2:01 am

    The @import just contributes a ‘using’ statement rather than a reference, so it’s not consequential here.

    Type A loaded in the LoadFrom context is the one that is being loaded by the assembly tag in T4.
    Type B that’s coming from the Resharper directory appears from this error to be coming from the reflection over the assembly that’s containing ‘BaseTest’.

    I’d try looking at the build of BaseTest to see if Resharper could have crept in here. You can probably validate this theory by running reflector or ildasm over basetest’s assembly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Visual Studio 2010 solution containing several C# projects, with Resharper 5.1
I have a C++ project that have like 15+ external libraries installed with a
I have project Emle in Launchpad . I set it to import from emle.svn.sourceforge.net
In our project we have requirement that, after receiving sms message from third party
I have a project with many projects that performs miserably with ReSharper enabled, even
I've begun using ReSharper and really enjoy it. However I have a project which
We have been getting a range on infuriating error dialogs using Visual Studio 2008
I have a strange problem with resharper. I have a project file which is
I have R installed via the CRAN repo as instructed at http://cran.r-project.org/bin/linux/ubuntu/ . I've
I'm installing it now. I've seen a few videos where people have Resharper installed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.