GithubHelp home page GithubHelp logo

Comments (8)

AArnott avatar AArnott commented on July 27, 2024

Ouch. Thanks for the report. Version 0.4.6 is significantly different. Can you try that out and let me know whether the problem is fixed?

from codegeneration.roslyn.

tg73 avatar tg73 commented on July 27, 2024

I have significant concerns about the new burden put on consumers of generator packages (see my comment on 185df8a), but not withstanding that, I've tried installing the 0.4.9 packages but get the following error when installing CodeGeneration.Roslyn to my net46 generator project:

Could not install package 'CodeGeneration.Roslyn 0.4.9'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

from codegeneration.roslyn.

tg73 avatar tg73 commented on July 27, 2024

Ok, I made a fresh netstandard1.5 project for the generator, and I was able to add the package ref. But now my build fails with:

GenerateCodeFromAttributes:
  dotnet codegen -r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.CSharp.dll" -r "C
  :\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" -r "C:\Program Files (x86)\Refere
  nce Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" -r "C:\Program Files (x86)\Reference Assemblies\Microsoft\
  Framework\.NETFramework\v4.0\System.Data.DataSetExtensions.dll" -r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framewo
  rk\.NETFramework\v4.0\System.Data.dll" -r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Sys
  tem.dll" -r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll" -r "C:\Program Fi
  les (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll" -r C:\dev\devtools-typedef\DevTools.Ty
  pedef.Attributes\bin\Debug\ZanyAnts.DevTools.Typedef.dll --generatorSearchPath C:\dev\devtools-typedef\DevTools.Typedef.CodeGener
  ation\bin\Debug\netstandard1.5 --out obj\Debug\ --generatedFilesList obj\Debug\hchfihid.bb4 -- Class1.cs Class2.cs Properties\Ass
  emblyInfo.cs
  No executable found matching command "dotnet-codegen"
C:\dev\devtools-typedef\packages\CodeGeneration.Roslyn.BuildTime.0.4.9\build\CodeGeneration.Roslyn.BuildTime.targets(20,5): error M
SB6006: "dotnet" exited with code 1. [C:\dev\devtools-typedef\DevTools.TypeDef.Tests\DevTools.TypeDef.Tests.csproj]

I have added the required DotNetCliToolReference to my test consuming project, but note that this is a .NET 4.0 project so I don't know if DotNetCliToolReference is meaningfully supported. Also, the test project uses packages.config, not <PackageReference>. Note that the extensive codebase with which I want to use my generator also uses packages.config, and cannot be changed to use <PackageReference>. Any such requirement would, I suggest, substantially restrict the audience for CodeGeneration.Roslyn.

I also tried dotnet restore from command line, which was not happy:

C:\dev\devtools-typedef>dotnet restore
  Restoring packages for C:\dev\devtools-typedef\DevTools.TypeDef.Tests\DevTools.TypeDef.Tests.csproj...
  Restoring packages for C:\dev\devtools-typedef\DevTools.Typedef.CodeGeneration\DevTools.Typedef.CodeGeneration.csproj...
  Generating MSBuild file C:\dev\devtools-typedef\DevTools.Typedef.CodeGeneration\obj\DevTools.Typedef.CodeGeneration.csproj.nuget.g.props.
  Writing lock file to disk. Path: C:\dev\devtools-typedef\DevTools.Typedef.CodeGeneration\obj\project.assets.json
  Restore completed in 274.6 ms for C:\dev\devtools-typedef\DevTools.Typedef.CodeGeneration\DevTools.Typedef.CodeGeneration.csproj.
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to resolve 'dotnet-codegen (>= 0.4.6)' for '.NETCoreApp,Version=v1.0'. [C:\dev\devtools-typedef\DevTools.Typedef.sln]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Value cannot be null.\r [C:\dev\devtools-typedef\DevTools.Typedef.sln]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Parameter name: path [C:\dev\devtools-typedef\DevTools.Typedef.sln]

from codegeneration.roslyn.

AArnott avatar AArnott commented on July 27, 2024

I'm afraid you're hitting both bugs in the dotnet CLI tooling (the ArgumentNullReference at the end of your message) and ya, some by (very unfortunate) design requirements for reliability.

But I hear your pain. And yes, this requires new .NET SDK projects to consume. You can (and I do) target net40 with the .NET SDK projects, just FYI. But porting is non-trivial and not possible for some projects (like those targeting WPF) at this point.

Here's what I'll do though: I've created a v0.3 branch at the point before I merged the changes that added these requirements. We can service that to fix bugs like this one till I find a better story in the master branch.

from codegeneration.roslyn.

tg73 avatar tg73 commented on July 27, 2024

Argh! Your v0.3 branch sounds good. Does that correspond to an already-published set of nuget packages? If not, could you publish some? Also, if relevant, could you fix the binary versions in v0.3 as per the original report in this issue? Many thanks!

from codegeneration.roslyn.

AArnott avatar AArnott commented on July 27, 2024

Does that correspond to an already-published set of nuget packages?

Yes: 0.3.9 is already on nuget.org and is nearly on-par with what is in the v0.3 branch.

could you fix the binary versions in v0.3 as per the original report in this issue?

Right: v0.3 would presumably still have the original issue you reported. So I'll keep this issue active and look for time to investigate.

from codegeneration.roslyn.

tg73 avatar tg73 commented on July 27, 2024

I've got a working test using nuget 0.3.9 and SyntaxGenerator! Looks like the binary issue might have been a red herring: from what I can tell, Microsoft.CodeAnalysis.Common.1.3.2 and related packages confusingly contain dlls with version 1.3.1.60621.

from codegeneration.roslyn.

AArnott avatar AArnott commented on July 27, 2024

Great. Thanks for reporting.

from codegeneration.roslyn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.