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.
c# razor
add a comment |
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.
c# razor
add a comment |
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.
c# razor
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
c# razor
asked Nov 9 at 18:20
Jon Barker
1,4071016
1,4071016
add a comment |
add a comment |
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
1
nice find @Jon-Barker
– klabranche
Nov 15 at 14:14
add a comment |
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:
- It's not on the machine.
- 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:
- Install the correct framework version
- Use a binding redirect in your config file
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
|
show 3 more comments
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
1
nice find @Jon-Barker
– klabranche
Nov 15 at 14:14
add a comment |
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
1
nice find @Jon-Barker
– klabranche
Nov 15 at 14:14
add a comment |
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
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
answered Nov 13 at 22:55
Jon Barker
1,4071016
1,4071016
1
nice find @Jon-Barker
– klabranche
Nov 15 at 14:14
add a comment |
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
add a comment |
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:
- It's not on the machine.
- 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:
- Install the correct framework version
- Use a binding redirect in your config file
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
|
show 3 more comments
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:
- It's not on the machine.
- 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:
- Install the correct framework version
- Use a binding redirect in your config file
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
|
show 3 more comments
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:
- It's not on the machine.
- 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:
- Install the correct framework version
- Use a binding redirect in your config file
System.Runtime is part of the .Net Framework and is installed in the GAC during framework installation.
This could happen for two possible reasons:
- It's not on the machine.
- 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:
- Install the correct framework version
- Use a binding redirect in your config file
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
|
show 3 more comments
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
|
show 3 more comments
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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