Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate T4 files due to System.IO.FileNotFoundException "Microsoft.OData.ConnectedService.dll" #406

Open
fmcgarry opened this issue Aug 5, 2024 · 4 comments
Assignees
Labels
bug Something isn't working P3

Comments

@fmcgarry
Copy link

fmcgarry commented Aug 5, 2024

Describe the bug

I'm trying to follow the instructions outlined here using the OData Connected Service 2022+ version of the extension in Visual Studio 2022 Enterprise with T4 files enabled.

image

Whenever I run the custom tool on the generated tt file, I receive the following error:

An exception was thrown while trying to compile the transformation code. The following Exception was thrown:
System.IO.FileNotFoundException: Could not find file 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Microsoft.OData.ConnectedService.dll'.
File name: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Microsoft.OData.ConnectedService.dll'
   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.StandardFileSystem.OpenFile(String filePath, FileMode mode, FileAccess access, FileShare share)
   at Roslyn.Utilities.CommonCompilerFileSystemExtensions.OpenFileWithNormalizedException(ICommonCompilerFileSystem fileSystem, String filePath, FileMode fileMode, FileAccess fileAccess, FileShare fileShare)
   at Microsoft.VisualStudio.TextTemplating.CompilerBridge.<>c.<.ctor>b__15_0(String x)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Enumerable.<UnionIterator>d__67`1.MoveNext()
   at System.Linq.Enumerable.<UnionIterator>d__67`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
   at Microsoft.CodeAnalysis.Compilation.ValidateReferences[T](IEnumerable`1 references)
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.WithReferences(IEnumerable`1 references)
   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)

I've tried this in empty .NET 6-8 console projects and a .NET Standard 2.0 NuGet package project. I've also tried on a few different machines with various version of Visual Studio 2022 installed. All output the same result. Am I missing a package or some dependency that will put Microsoft.OData.ConnectedService.dll on my machine?

Version of the Project affected

OData Connected Service 2022+ v1.1.0
VisualStudio Version v17.10.5 Enterprise
Microsoft.Odata.Client v7.21.3

To Reproduce

Steps to reproduce the behavior:

  1. Open Visual Studio 2022.
  2. Install the OData Connected Service 2022+ extension.
  3. Create a new empty .NET 8 console project.
  4. Follow the instructions linked here.
  5. Before clicking Finish in the OData service dialog, click the "Advanced Settings" link on the Settings page. Check "Add code templates". Then click Finish.
  6. See error.

Expected behavior

The tool succeeds in generating the OData Reference class.

Actual behavior

The Reference class file has "ErrorGeneratingOutput" and the above error is displayed in the Error List.

@WanjohiSammy
Copy link

WanjohiSammy commented Aug 6, 2024

@fmcgarry

Have you tried opening your project in Visual Studio 2022 with ADMIN privileges and generating the OData reference files.

@fmcgarry
Copy link
Author

fmcgarry commented Aug 6, 2024

Have you tried opening your project in Visual Studio 2022 with ADMIN privileges and generating the OData reference files.

@WanjohiSammy Yes, unfortunately I see the same error.

@WanjohiSammy WanjohiSammy added the bug Something isn't working label Aug 6, 2024
@WanjohiSammy WanjohiSammy self-assigned this Aug 6, 2024
@WanjohiSammy WanjohiSammy added the P3 label Aug 6, 2024
@WanjohiSammy
Copy link

Thanks @fmcgarry

Please allow me to investigate this further and get back to you.

@egil
Copy link

egil commented Aug 20, 2024

Have the same issue. Our service description is downloaded as a local file, and is from an on-premise CRM odata endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P3
Projects
None yet
Development

No branches or pull requests

3 participants