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

Pointing to a non-existent csproj produces a confusing error message #99

Open
shilangyu opened this issue Sep 30, 2022 · 0 comments
Open

Comments

@shilangyu
Copy link
Contributor

When trying to generate contracts using the project flag and then pointing to a non-existent file produces an exception that does indeed mention lack of the file, but also mentions other problems which might be misleading. Example:

 Generator script failed with: Cannot compile project or generate contracts: The project file could not be loaded. Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
   /home/shilangyu/coding/work/contractsgenerator-dart/packages/leancode_contracts_generator/contractsgenerator/examples/project/aggregated/Combined/Combined.csproj
 At
    at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
    at Microsoft.Build.Shared.ProjectFileErrorUtilities.ThrowInvalidProjectFile(BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
    at Microsoft.Build.Construction.ProjectRootElement.CreateProjectFromPath(String projectFile, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting)
    at Microsoft.Build.Construction.ProjectRootElement.<>c.<OpenProjectOrSolution>b__208_0(String path, ProjectRootElementCacheBase cache)
    at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement openProjectRootElement, Boolean isExplicitlyLoaded, Nullable`1 preserveFormatting)
    at Microsoft.Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath, IDictionary`2 globalProperties, String toolsVersion, ProjectRootElementCacheBase projectRootElementCache, Boolean isExplicitlyLoaded)
    at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
    at LeanCode.ContractsGenerator.Compilation.MSBuild.MSBuildHelper.RestoreProjects(IReadOnlyCollection`1 projectPaths, IDictionary`2 globalProperties) in /home/runner/work/contractsgenerator/contractsgenerator/src/LeanCode.ContractsGenerator/Compilation/MSBuild/MSBuildHelper.cs:line 69
    at LeanCode.ContractsGenerator.Compilation.ProjectLoader.LoadProjectsAsync(IEnumerable`1 projectPaths) in /home/runner/work/contractsgenerator/contractsgenerator/src/LeanCode.ContractsGenerator/Compilation/ProjectLoader.cs:line 24
    at LeanCode.ContractsGenerator.Compilation.ContractsCompiler.CompileProjectsAsync(IEnumerable`1 projectPaths) in /home/runner/work/contractsgenerator/contractsgenerator/src/LeanCode.ContractsGenerator/Compilation/ContractsCompiler.cs:line 68
    at LeanCode.ContractsGenerator.Program.HandleProjectAsync(ProjectOptions p) in /home/runner/work/contractsgenerator/contractsgenerator/src/LeanCode.ContractsGenerator/Program.cs:line 114
    at LeanCode.ContractsGenerator.Program.Main(String[] args) in /home/runner/work/contractsgenerator/contractsgenerator/src/LeanCode.ContractsGenerator/Program.cs:line 61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant