Stream: dotnet
Topic: Template file error
PS (Jul 17 2020 at 13:40):
Hi,
This error is related to .net firely API.
When I tried to run Template-model.tt file it gave me error that "Microsoft.VisualStudio.Shell.10.0" is not found. After I changed the version from 10.0 to 15.0 I am getting error that
"An exception was thrown while trying to compile the transformation code. The following Exception was thrown:
System.IO.FileNotFoundException: Could not find file 'C:\WINDOWS\system32\Microsoft.VisualStudio.Shell.Interop'.
File name: 'C:\WINDOWS\system32\Microsoft.VisualStudio.Shell.Interop'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
at Microsoft.VisualStudio.TextTemplating.CompilerBridge.<>c.<.ctor>b__15_0(String x)
at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext()
at System.Linq.Enumerable.<UnionIterator>d__67
1.MoveNext()
at System.Linq.Enumerable.<UnionIterator>d__671.MoveNext()
at System.Linq.Buffer
1..ctor(IEnumerable1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable
1 source)
at System.Collections.Immutable.ImmutableArray.CreateRangeT
at Microsoft.CodeAnalysis.Compilation.ValidateReferencesT
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonWithReferences(IEnumerable1 newReferences)
at Microsoft.VisualStudio.TextTemplating.CompilerBridge.PrepareNewCompilation()
at Microsoft.VisualStudio.TextTemplating.CompilerBridge.Compile()
at Microsoft.VisualStudio.TextTemplating.TransformationRunner.Compile(String source, String inputFile, IEnumerable
1 references, Boolean debug, SupportedLanguage language, String compilerOptions) Hl7.Fhir.Core 1
"
I tried to download the dll` and place it but I still get the same error. Can anyone help in running the template file. I am using Visual Studio 2019.
Thanks in advance
PS (Jul 20 2020 at 02:34):
@Ewout Kramer Any idea why I might be getting this error?
Thanks
Ewout Kramer (Jul 20 2020 at 09:49):
Yes, I had the problem myself. It seems to be connected with a recent VS upgrade.
Ewout Kramer (Jul 20 2020 at 09:49):
I fixed it in our develop branch. Let me check what I did.
Ewout Kramer (Jul 20 2020 at 09:53):
In fhir-net-api\src\Hl7.Fhir.Core\Model\Generated\TemplateFileManagerV2.1.ttinclude I changed the line
<#@ assembly name="Microsoft.VisualStudio.Shell.10.0"#>
to
<#@ assembly name="Microsoft.VisualStudio.Shell.15.0"#>
That fixed it for me.
PS (Jul 21 2020 at 04:17):
@Ewout Kramer Thanks for the reply. I already did that but now I am getting new error which I have mentioned in the original question. Did you face this issue ? I googled a bit but didn't find any solution. Any other changes which are required to fix this?
TIA
Ewout Kramer (Jul 21 2020 at 07:28):
Which branch are you building against? Can you try develop
?
PS (Jul 21 2020 at 14:13):
I am using developer branch. Visual Studio Version is 2019.
Brian Postlethwaite (Jul 22 2020 at 06:59):
Better question is why are you running the tt templates? Are you trying to change how things are generated, trying to do your own?
Trying to update the latest R5 code branch?
Ewout Kramer (Jul 22 2020 at 07:34):
(message deleted)
PS (Jul 27 2020 at 01:48):
I was trying to change structure definitions and see how models will be generated.
Brian Postlethwaite (Jul 27 2020 at 09:37):
Changing the core specification?
PS (Jul 29 2020 at 07:32):
Yes, to check if some new properties are added to resources models how will be behavior of parser and serializer.
Last updated: Apr 12 2022 at 19:14 UTC