Error when using RazorTemplates library: 'CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced'









up vote
0
down vote

favorite












On some machines, executing a razor template via RazorTemplates works OK.



On others, I receive the following message:



TemplateCompilationException



error CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.


Info:



  • This is within a WPF application running on .NET 4.7.

  • The assembly has a reference to System.Runtime.4.3.0libnet462System.Runtime.dll (v4.1.1.0)

  • However at runtime, this assembly does not show up in the 'Modules' list.

It seems the Attribute object exists in both System.Runtime and mscorlib.










share|improve this question

























    up vote
    0
    down vote

    favorite












    On some machines, executing a razor template via RazorTemplates works OK.



    On others, I receive the following message:



    TemplateCompilationException



    error CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.


    Info:



    • This is within a WPF application running on .NET 4.7.

    • The assembly has a reference to System.Runtime.4.3.0libnet462System.Runtime.dll (v4.1.1.0)

    • However at runtime, this assembly does not show up in the 'Modules' list.

    It seems the Attribute object exists in both System.Runtime and mscorlib.










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      On some machines, executing a razor template via RazorTemplates works OK.



      On others, I receive the following message:



      TemplateCompilationException



      error CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.


      Info:



      • This is within a WPF application running on .NET 4.7.

      • The assembly has a reference to System.Runtime.4.3.0libnet462System.Runtime.dll (v4.1.1.0)

      • However at runtime, this assembly does not show up in the 'Modules' list.

      It seems the Attribute object exists in both System.Runtime and mscorlib.










      share|improve this question













      On some machines, executing a razor template via RazorTemplates works OK.



      On others, I receive the following message:



      TemplateCompilationException



      error CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.


      Info:



      • This is within a WPF application running on .NET 4.7.

      • The assembly has a reference to System.Runtime.4.3.0libnet462System.Runtime.dll (v4.1.1.0)

      • However at runtime, this assembly does not show up in the 'Modules' list.

      It seems the Attribute object exists in both System.Runtime and mscorlib.







      c# razor






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 9 at 18:20









      Jon Barker

      1,4071016




      1,4071016






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          Looks like this is an underlying issue somewhere between win10 and the RazorTemplates library.



          In the end i switched from RazorTemplates to RazorEngine: https://github.com/Antaris/RazorEngine



          And there is a page here that explains how to fix the problem via a Resolver:



          https://github.com/Antaris/RazorEngine/issues/416






          share|improve this answer
















          • 1




            nice find @Jon-Barker
            – klabranche
            Nov 15 at 14:14

















          up vote
          0
          down vote













          System.Runtime is part of the .Net Framework and is installed in the GAC during framework installation.



          This could happen for two possible reasons:



          1. It's not on the machine.

          2. It's the wrong version.

          For the machines this fails on check what version of the .Net runtime they have and/or inspect the GAC for this file and version.



          Missing the framework, install it. :-)



          If machines have a version but it's not the expected version do either:



          1. Install the correct framework version

          2. Use a binding redirect in your config file





          share|improve this answer






















          • Unfortunately it's not quite this simple otherwise I would have solved it :) - The machines have .net framework 4.7.2 installed and the file exists in the GAC on both the machines that work, and the ones that don't - System.Runtime is references as a nuget package in our solution, but this file isn't loaded in the modules. As mentioned though, the Attribute class exists in mscorlib, so missing this file shouldn't affect anything
            – Jon Barker
            Nov 10 at 0:09











          • Well I have found: adding to the config the assembly -> stackoverflow.com/questions/22822406/…. This would be your app.config but it's not a compile issue.... so feels like a stretch. After that, is -> support.microsoft.com/en-us/help/2971005/… Again, a stretch as this is about VS and developer pack (and 4.5.X not 4.7) but I did find that my 4.7 folder has facades with System.Runtime in it, again VS box vs deployed machine... so both feel like a stretch.
            – klabranche
            Nov 13 at 14:47










          • To confirm my assumption - This is a runtime issue on deployed machines vs. a compile time issue on dev boxes? If it's runtime on deployed machines, these machines don't have VS on them?
            – klabranche
            Nov 13 at 14:48











          • All machines don't have VS installed. The issue occurrs on some and doesn't occurr on others unfortunately. I haven't been able to work out exactly what the determining factor is yet. I'll give the config change a go and see what happens. Thanks for taking the time to investigate.
            – Jon Barker
            Nov 13 at 18:53










          • All machines don't have VS installed. Are you saying some do? If yes, are they the one's working...?
            – klabranche
            Nov 13 at 18:58










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53231341%2ferror-when-using-razortemplates-library-cs0012-the-type-system-attribute-is%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          Looks like this is an underlying issue somewhere between win10 and the RazorTemplates library.



          In the end i switched from RazorTemplates to RazorEngine: https://github.com/Antaris/RazorEngine



          And there is a page here that explains how to fix the problem via a Resolver:



          https://github.com/Antaris/RazorEngine/issues/416






          share|improve this answer
















          • 1




            nice find @Jon-Barker
            – klabranche
            Nov 15 at 14:14














          up vote
          1
          down vote



          accepted










          Looks like this is an underlying issue somewhere between win10 and the RazorTemplates library.



          In the end i switched from RazorTemplates to RazorEngine: https://github.com/Antaris/RazorEngine



          And there is a page here that explains how to fix the problem via a Resolver:



          https://github.com/Antaris/RazorEngine/issues/416






          share|improve this answer
















          • 1




            nice find @Jon-Barker
            – klabranche
            Nov 15 at 14:14












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Looks like this is an underlying issue somewhere between win10 and the RazorTemplates library.



          In the end i switched from RazorTemplates to RazorEngine: https://github.com/Antaris/RazorEngine



          And there is a page here that explains how to fix the problem via a Resolver:



          https://github.com/Antaris/RazorEngine/issues/416






          share|improve this answer












          Looks like this is an underlying issue somewhere between win10 and the RazorTemplates library.



          In the end i switched from RazorTemplates to RazorEngine: https://github.com/Antaris/RazorEngine



          And there is a page here that explains how to fix the problem via a Resolver:



          https://github.com/Antaris/RazorEngine/issues/416







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 at 22:55









          Jon Barker

          1,4071016




          1,4071016







          • 1




            nice find @Jon-Barker
            – klabranche
            Nov 15 at 14:14












          • 1




            nice find @Jon-Barker
            – klabranche
            Nov 15 at 14:14







          1




          1




          nice find @Jon-Barker
          – klabranche
          Nov 15 at 14:14




          nice find @Jon-Barker
          – klabranche
          Nov 15 at 14:14












          up vote
          0
          down vote













          System.Runtime is part of the .Net Framework and is installed in the GAC during framework installation.



          This could happen for two possible reasons:



          1. It's not on the machine.

          2. It's the wrong version.

          For the machines this fails on check what version of the .Net runtime they have and/or inspect the GAC for this file and version.



          Missing the framework, install it. :-)



          If machines have a version but it's not the expected version do either:



          1. Install the correct framework version

          2. Use a binding redirect in your config file





          share|improve this answer






















          • Unfortunately it's not quite this simple otherwise I would have solved it :) - The machines have .net framework 4.7.2 installed and the file exists in the GAC on both the machines that work, and the ones that don't - System.Runtime is references as a nuget package in our solution, but this file isn't loaded in the modules. As mentioned though, the Attribute class exists in mscorlib, so missing this file shouldn't affect anything
            – Jon Barker
            Nov 10 at 0:09











          • Well I have found: adding to the config the assembly -> stackoverflow.com/questions/22822406/…. This would be your app.config but it's not a compile issue.... so feels like a stretch. After that, is -> support.microsoft.com/en-us/help/2971005/… Again, a stretch as this is about VS and developer pack (and 4.5.X not 4.7) but I did find that my 4.7 folder has facades with System.Runtime in it, again VS box vs deployed machine... so both feel like a stretch.
            – klabranche
            Nov 13 at 14:47










          • To confirm my assumption - This is a runtime issue on deployed machines vs. a compile time issue on dev boxes? If it's runtime on deployed machines, these machines don't have VS on them?
            – klabranche
            Nov 13 at 14:48











          • All machines don't have VS installed. The issue occurrs on some and doesn't occurr on others unfortunately. I haven't been able to work out exactly what the determining factor is yet. I'll give the config change a go and see what happens. Thanks for taking the time to investigate.
            – Jon Barker
            Nov 13 at 18:53










          • All machines don't have VS installed. Are you saying some do? If yes, are they the one's working...?
            – klabranche
            Nov 13 at 18:58














          up vote
          0
          down vote













          System.Runtime is part of the .Net Framework and is installed in the GAC during framework installation.



          This could happen for two possible reasons:



          1. It's not on the machine.

          2. It's the wrong version.

          For the machines this fails on check what version of the .Net runtime they have and/or inspect the GAC for this file and version.



          Missing the framework, install it. :-)



          If machines have a version but it's not the expected version do either:



          1. Install the correct framework version

          2. Use a binding redirect in your config file





          share|improve this answer






















          • Unfortunately it's not quite this simple otherwise I would have solved it :) - The machines have .net framework 4.7.2 installed and the file exists in the GAC on both the machines that work, and the ones that don't - System.Runtime is references as a nuget package in our solution, but this file isn't loaded in the modules. As mentioned though, the Attribute class exists in mscorlib, so missing this file shouldn't affect anything
            – Jon Barker
            Nov 10 at 0:09











          • Well I have found: adding to the config the assembly -> stackoverflow.com/questions/22822406/…. This would be your app.config but it's not a compile issue.... so feels like a stretch. After that, is -> support.microsoft.com/en-us/help/2971005/… Again, a stretch as this is about VS and developer pack (and 4.5.X not 4.7) but I did find that my 4.7 folder has facades with System.Runtime in it, again VS box vs deployed machine... so both feel like a stretch.
            – klabranche
            Nov 13 at 14:47










          • To confirm my assumption - This is a runtime issue on deployed machines vs. a compile time issue on dev boxes? If it's runtime on deployed machines, these machines don't have VS on them?
            – klabranche
            Nov 13 at 14:48











          • All machines don't have VS installed. The issue occurrs on some and doesn't occurr on others unfortunately. I haven't been able to work out exactly what the determining factor is yet. I'll give the config change a go and see what happens. Thanks for taking the time to investigate.
            – Jon Barker
            Nov 13 at 18:53










          • All machines don't have VS installed. Are you saying some do? If yes, are they the one's working...?
            – klabranche
            Nov 13 at 18:58












          up vote
          0
          down vote










          up vote
          0
          down vote









          System.Runtime is part of the .Net Framework and is installed in the GAC during framework installation.



          This could happen for two possible reasons:



          1. It's not on the machine.

          2. It's the wrong version.

          For the machines this fails on check what version of the .Net runtime they have and/or inspect the GAC for this file and version.



          Missing the framework, install it. :-)



          If machines have a version but it's not the expected version do either:



          1. Install the correct framework version

          2. Use a binding redirect in your config file





          share|improve this answer














          System.Runtime is part of the .Net Framework and is installed in the GAC during framework installation.



          This could happen for two possible reasons:



          1. It's not on the machine.

          2. It's the wrong version.

          For the machines this fails on check what version of the .Net runtime they have and/or inspect the GAC for this file and version.



          Missing the framework, install it. :-)



          If machines have a version but it's not the expected version do either:



          1. Install the correct framework version

          2. Use a binding redirect in your config file






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 9 at 19:34

























          answered Nov 9 at 19:04









          klabranche

          19.2k24473




          19.2k24473











          • Unfortunately it's not quite this simple otherwise I would have solved it :) - The machines have .net framework 4.7.2 installed and the file exists in the GAC on both the machines that work, and the ones that don't - System.Runtime is references as a nuget package in our solution, but this file isn't loaded in the modules. As mentioned though, the Attribute class exists in mscorlib, so missing this file shouldn't affect anything
            – Jon Barker
            Nov 10 at 0:09











          • Well I have found: adding to the config the assembly -> stackoverflow.com/questions/22822406/…. This would be your app.config but it's not a compile issue.... so feels like a stretch. After that, is -> support.microsoft.com/en-us/help/2971005/… Again, a stretch as this is about VS and developer pack (and 4.5.X not 4.7) but I did find that my 4.7 folder has facades with System.Runtime in it, again VS box vs deployed machine... so both feel like a stretch.
            – klabranche
            Nov 13 at 14:47










          • To confirm my assumption - This is a runtime issue on deployed machines vs. a compile time issue on dev boxes? If it's runtime on deployed machines, these machines don't have VS on them?
            – klabranche
            Nov 13 at 14:48











          • All machines don't have VS installed. The issue occurrs on some and doesn't occurr on others unfortunately. I haven't been able to work out exactly what the determining factor is yet. I'll give the config change a go and see what happens. Thanks for taking the time to investigate.
            – Jon Barker
            Nov 13 at 18:53










          • All machines don't have VS installed. Are you saying some do? If yes, are they the one's working...?
            – klabranche
            Nov 13 at 18:58
















          • Unfortunately it's not quite this simple otherwise I would have solved it :) - The machines have .net framework 4.7.2 installed and the file exists in the GAC on both the machines that work, and the ones that don't - System.Runtime is references as a nuget package in our solution, but this file isn't loaded in the modules. As mentioned though, the Attribute class exists in mscorlib, so missing this file shouldn't affect anything
            – Jon Barker
            Nov 10 at 0:09











          • Well I have found: adding to the config the assembly -> stackoverflow.com/questions/22822406/…. This would be your app.config but it's not a compile issue.... so feels like a stretch. After that, is -> support.microsoft.com/en-us/help/2971005/… Again, a stretch as this is about VS and developer pack (and 4.5.X not 4.7) but I did find that my 4.7 folder has facades with System.Runtime in it, again VS box vs deployed machine... so both feel like a stretch.
            – klabranche
            Nov 13 at 14:47










          • To confirm my assumption - This is a runtime issue on deployed machines vs. a compile time issue on dev boxes? If it's runtime on deployed machines, these machines don't have VS on them?
            – klabranche
            Nov 13 at 14:48











          • All machines don't have VS installed. The issue occurrs on some and doesn't occurr on others unfortunately. I haven't been able to work out exactly what the determining factor is yet. I'll give the config change a go and see what happens. Thanks for taking the time to investigate.
            – Jon Barker
            Nov 13 at 18:53










          • All machines don't have VS installed. Are you saying some do? If yes, are they the one's working...?
            – klabranche
            Nov 13 at 18:58















          Unfortunately it's not quite this simple otherwise I would have solved it :) - The machines have .net framework 4.7.2 installed and the file exists in the GAC on both the machines that work, and the ones that don't - System.Runtime is references as a nuget package in our solution, but this file isn't loaded in the modules. As mentioned though, the Attribute class exists in mscorlib, so missing this file shouldn't affect anything
          – Jon Barker
          Nov 10 at 0:09





          Unfortunately it's not quite this simple otherwise I would have solved it :) - The machines have .net framework 4.7.2 installed and the file exists in the GAC on both the machines that work, and the ones that don't - System.Runtime is references as a nuget package in our solution, but this file isn't loaded in the modules. As mentioned though, the Attribute class exists in mscorlib, so missing this file shouldn't affect anything
          – Jon Barker
          Nov 10 at 0:09













          Well I have found: adding to the config the assembly -> stackoverflow.com/questions/22822406/…. This would be your app.config but it's not a compile issue.... so feels like a stretch. After that, is -> support.microsoft.com/en-us/help/2971005/… Again, a stretch as this is about VS and developer pack (and 4.5.X not 4.7) but I did find that my 4.7 folder has facades with System.Runtime in it, again VS box vs deployed machine... so both feel like a stretch.
          – klabranche
          Nov 13 at 14:47




          Well I have found: adding to the config the assembly -> stackoverflow.com/questions/22822406/…. This would be your app.config but it's not a compile issue.... so feels like a stretch. After that, is -> support.microsoft.com/en-us/help/2971005/… Again, a stretch as this is about VS and developer pack (and 4.5.X not 4.7) but I did find that my 4.7 folder has facades with System.Runtime in it, again VS box vs deployed machine... so both feel like a stretch.
          – klabranche
          Nov 13 at 14:47












          To confirm my assumption - This is a runtime issue on deployed machines vs. a compile time issue on dev boxes? If it's runtime on deployed machines, these machines don't have VS on them?
          – klabranche
          Nov 13 at 14:48





          To confirm my assumption - This is a runtime issue on deployed machines vs. a compile time issue on dev boxes? If it's runtime on deployed machines, these machines don't have VS on them?
          – klabranche
          Nov 13 at 14:48













          All machines don't have VS installed. The issue occurrs on some and doesn't occurr on others unfortunately. I haven't been able to work out exactly what the determining factor is yet. I'll give the config change a go and see what happens. Thanks for taking the time to investigate.
          – Jon Barker
          Nov 13 at 18:53




          All machines don't have VS installed. The issue occurrs on some and doesn't occurr on others unfortunately. I haven't been able to work out exactly what the determining factor is yet. I'll give the config change a go and see what happens. Thanks for taking the time to investigate.
          – Jon Barker
          Nov 13 at 18:53












          All machines don't have VS installed. Are you saying some do? If yes, are they the one's working...?
          – klabranche
          Nov 13 at 18:58




          All machines don't have VS installed. Are you saying some do? If yes, are they the one's working...?
          – klabranche
          Nov 13 at 18:58

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53231341%2ferror-when-using-razortemplates-library-cs0012-the-type-system-attribute-is%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          How do I collapse sections of code in Visual Studio Code for Windows?

          ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ