Comments (8)
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.
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.
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.
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.
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.
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.
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.
Great. Thanks for reporting.
from codegeneration.roslyn.
Related Issues (20)
- [0.7.43-alpha] Plugin.Sdk introduces a circular dependency in MSBuild HOT 2
- Add warnings for using pre-0.7 artifacts
- Fill/update package Descriptions HOT 1
- Allow custom props/targets additions in Plugin.Sdk HOT 1
- Empty output files HOT 4
- PluginMetapackage.Sdk implicit .Tool reference causes it to run
- Rename internal names in .Tool MSBuild props/targets HOT 1
- Add IncludeSymbols=false in Metapackage (if not set)
- Release v0.7 HOT 1
- Add LanguageExt.CodeGen as a migration example to wiki HOT 1
- Run code generation in parallel HOT 1
- Add performance tracking into the Tool HOT 1
- How does this relate to Source Generators from MS? HOT 7
- Make tool working with compatible versions HOT 1
- Build fails on 3.1.100 HOT 7
- Why not use `$(NuGetPackageRoot)` to determine the tool path?
- Question: controlling the build order HOT 4
- How generate new class HOT 1
- Question: Is it possible to create a new class from an attribute that targets methods? HOT 2
- .Net 5.0/3.1 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codegeneration.roslyn.