Comments (3)
I looked under the section for "Packaging up your code generator for others' use", which doesn't apply to me since I'm not at the point yet of packaging my code for others, and I found a hint, which is to add <DotNetCliToolReference Include="dotnet-codegen" Version="0.4.6" />
. I tried that and saw an error that System.CommandLine was missing. How do I get this installed? (I believe my nuget has the corefxlab nuget setup properly.)
UPDATE: Fix was to update the version to match the latest Nuget package I used: <DotNetCliToolReference Include="dotnet-codegen" Version="0.4.11" />
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 2017-07-29 7:52:26 AM.
Project "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.sln" (1) is building "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.NET462\Walkthrough.Generators.NET462.csproj" (2) on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(178,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore. [C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.NET462\Walkthrough.Generators.NET462.csproj]
Done Building Project "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.NET462\Walkthrough.Generators.NET462.csproj" (default targets) -- FAILED.
Project "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.sln" (1) is building "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.NETStandard15\Walkthrough.Generators.NETStandard15.csproj" (3) on node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreGenerateAssemblyInfo:
Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
GenerateBuildDependencyFile:
Skipping target "GenerateBuildDependencyFile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
Walkthrough.Generators.NETStandard15 -> C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.NETStandard15\bin\Debug\netstandard1.5\Walkthrough.Generators.NETStandard15.dll
Done Building Project "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.NETStandard15\Walkthrough.Generators.NETStandard15.csproj" (default targets).
Project "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.sln" (1) is building "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Foo.NETStandard15\Walkthrough.Foo.NETStandard15.csproj" (4) on node 1 (default targets).
GenerateCodeFromAttributes:
dotnet codegen -r C:\Users\ja\.nuget\packages\codegeneration.roslyn.attributes\0.4.11\lib\netstandard1.0\CodeGeneration.Roslyn.Attributes.dll -r C:\Users\ja\.nuget\packages\codegeneration.roslyn\0.4.11\lib\netstandard1.5\CodeGeneration.Roslyn.dll -r C:\Users\ja\.nuget\packages\microsoft.codeanalysis.csharp\2.2.0\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll -r C:\Users\ja\.nuget\packages\microsoft.codeanalysis.common\2.2.0\lib\netstandard1.3\Microsoft.CodeAnalysis.dll -r C:\Users\ja\.nuget\packages\microsoft.win32.primitives\4.3.0\ref\netstandard1.3\Microsoft.Win32.Primitives.dll -r C:\Users\ja\.nuget\packages\system.appcontext\4.3.0\ref\netstandard1.3\System.AppContext.dll -r C:\Users\ja\.nuget\packages\system.collections.concurrent\4.3.0\ref\netstandard1.3\System.Collections.Concurrent.dll -r C:\Users\ja\.nuget\packages\system.collections\4.3.0\ref\netstandard1.3\System.Collections.dll -r C:\Users\ja\.nuget\packages\system.collections.immutable\1.3.1\lib\netstandard1.0\System.Collections.Immutable.dll -r C:\Users\ja\.nuget\packages\system.commandline\0.1.0-e170729-1\lib\netstandard1.5\System.CommandLine.dll -r C:\Users\ja\.nuget\packages\system.console\4.3.0\ref\netstandard1.3\System.Console.dll -r C:\Users\ja\.nuget\packages\system.diagnostics.debug\4.3.0\ref\netstandard1.3\System.Diagnostics.Debug.dll -r C:\Users\ja\.nuget\packages\system.diagnostics.tools\4.3.0\ref\netstandard1.0\System.Diagnostics.Tools.dll -r C:\Users\ja\.nuget\packages\system.diagnostics.tracing\4.3.0\ref\netstandard1.5\System.Diagnostics.Tracing.dll -r C:\Users\ja\.nuget\packages\system.dynamic.runtime\4.3.0\ref\netstandard1.3\System.Dynamic.Runtime.dll -r C:\Users\ja\.nuget\packages\system.globalization.calendars\4.3.0\ref\netstandard1.3\System.Globalization.Calendars.dll -r C:\Users\ja\.nuget\packages\system.globalization\4.3.0\ref\netstandard1.3\System.Globalization.dll -r C:\Users\ja\.nuget\packages\system.io.compression\4.3.0\ref\netstandard1.3\System.IO.Compression.dll -r C:\Users\ja\.nuget\packages\system.io.compression.zipfile\4.3.0\ref\netstandard1.3\System.IO.Compression.ZipFile.dll -r C:\Users\ja\.nuget\packages\system.io\4.3.0\ref\netstandard1.5\System.IO.dll -r C:\Users\ja\.nuget\packages\system.io.filesystem\4.3.0\ref\netstandard1.3\System.IO.FileSystem.dll -r C:\Users\ja\.nuget\packages\system.io.filesystem.primitives\4.3.0\ref\netstandard1.3\System.IO.FileSystem.Primitives.dll -r C:\Users\ja\.nuget\packages\system.linq\4.3.0\ref\netstandard1.0\System.Linq.dll -r C:\Users\ja\.nuget\packages\system.linq.expressions\4.3.0\ref\netstandard1.3\System.Linq.Expressions.dll -r C:\Users\ja\.nuget\packages\system.net.http\4.3.0\ref\netstandard1.3\System.Net.Http.dll -r C:\Users\ja\.nuget\packages\system.net.primitives\4.3.0\ref\netstandard1.3\System.Net.Primitives.dll -r C:\Users\ja\.nuget\packages\system.net.sockets\4.3.0\ref\netstandard1.3\System.Net.Sockets.dll -r C:\Users\ja\.nuget\packages\system.objectmodel\4.3.0\ref\netstandard1.3\System.ObjectModel.dll -r C:\Users\ja\.nuget\packages\system.reflection\4.3.0\ref\netstandard1.5\System.Reflection.dll -r C:\Users\ja\.nuget\packages\system.reflection.extensions\4.3.0\ref\netstandard1.0\System.Reflection.Extensions.dll -r C:\Users\ja\.nuget\packages\system.reflection.metadata\1.4.2\lib\netstandard1.1\System.Reflection.Metadata.dll -r C:\Users\ja\.nuget\packages\system.reflection.primitives\4.3.0\ref\netstandard1.0\System.Reflection.Primitives.dll -r C:\Users\ja\.nuget\packages\system.resources.resourcemanager\4.3.0\ref\netstandard1.0\System.Resources.ResourceManager.dll -r C:\Users\ja\.nuget\packages\system.runtime\4.3.0\ref\netstandard1.5\System.Runtime.dll -r C:\Users\ja\.nuget\packages\system.runtime.extensions\4.3.0\ref\netstandard1.5\System.Runtime.Extensions.dll -r C:\Users\ja\.nuget\packages\system.runtime.handles\4.3.0\ref\netstandard1.3\System.Runtime.Handles.dll -r C:\Users\ja\.nuget\packages\system.runtime.interopservices\4.3.0\ref\netstandard1.5\System.Runtime.InteropServices.dll -r C:\Users\ja\.nuget\packages\system.runtime.interopservices.runtimeinformation\4.3.0\ref\netstandard1.1\System.Runtime.InteropServices.RuntimeInformation.dll -r C:\Users\ja\.nuget\packages\system.runtime.loader\4.3.0\ref\netstandard1.5\System.Runtime.Loader.dll -r C:\Users\ja\.nuget\packages\system.runtime.numerics\4.3.0\ref\netstandard1.1\System.Runtime.Numerics.dll -r C:\Users\ja\.nuget\packages\system.security.cryptography.algorithms\4.3.0\ref\netstandard1.4\System.Security.Cryptography.Algorithms.dll -r C:\Users\ja\.nuget\packages\system.security.cryptography.encoding\4.3.0\ref\netstandard1.3\System.Security.Cryptography.Encoding.dll -r C:\Users\ja\.nuget\packages\system.security.cryptography.primitives\4.3.0\ref\netstandard1.3\System.Security.Cryptography.Primitives.dll -r C:\Users\ja\.nuget\packages\system.security.cryptography.x509certificates\4.3.0\ref\netstandard1.4\System.Security.Cryptography.X509Certificates.dll -r C:\Users\ja\.nuget\packages\system.text.encoding\4.3.0\ref\netstandard1.3\System.Text.Encoding.dll -r C:\Users\ja\.nuget\packages\system.text.encoding.extensions\4.3.0\ref\netstandard1.3\System.Text.Encoding.Extensions.dll -r C:\Users\ja\.nuget\packages\system.text.regularexpressions\4.3.0\ref\netstandard1.3\System.Text.RegularExpressions.dll -r C:\Users\ja\.nuget\packages\system.threading\4.3.0\ref\netstandard1.3\System.Threading.dll -r C:\Users\ja\.nuget\packages\system.threading.tasks\4.3.0\ref\netstandard1.3\System.Threading.Tasks.dll -r C:\Users\ja\.nuget\packages\system.threading.tasks.parallel\4.3.0\ref\netstandard1.1\System.Threading.Tasks.Parallel.dll -r C:\Users\ja\.nuget\packages\system.threading.timer\4.3.0\ref\netstandard1.2\System.Threading.Timer.dll -r C:\Users\ja\.nuget\packages\system.valuetuple\4.3.0\lib\netstandard1.0\System.ValueTuple.dll -r C:\Users\ja\.nuget\packages\system.xml.readerwriter\4.3.0\ref\netstandard1.3\System.Xml.ReaderWriter.dll -r C:\Users\ja\.nuget\packages\system.xml.xdocument\4.3.0\ref\netstandard1.3\System.Xml.XDocument.dll -r C:\Users\ja\.nuget\packages\validation\2.4.13\lib\netstandard1.3\Validation.dll -r C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.NETStandard15\bin\Debug\netstandard1.5\Walkthrough.Generators.NETStandard15.dll --out obj\Debug\netstandard1.5\ --generatedFilesList obj\Debug\netstandard1.5\tpmeshx0.fk0 -- Foo.cs
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.CommandLine, Version=0.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
at CodeGeneration.Roslyn.Generate.Program.Main(String[] args)
C:\Users\ja\.nuget\packages\codegeneration.roslyn.buildtime\0.4.11\build\CodeGeneration.Roslyn.BuildTime.targets(20,5): error MSB6006: "dotnet" exited with code -532462766. [C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Foo.NETStandard15\Walkthrough.Foo.NETStandard15.csproj]
GenerateBuildDependencyFile:
Skipping target "GenerateBuildDependencyFile" because all output files are up-to-date with respect to the input files.
Done Building Project "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Foo.NETStandard15\Walkthrough.Foo.NETStandard15.csproj" (default targets) -- FAILED.
Done Building Project "C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.sln" (default targets) -- FAILED.
Build FAILED.
"C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.sln" (default target) (1) ->
"C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.NET462\Walkthrough.Generators.NET462.csproj" (default target) (2) ->
(ResolveNuGetPackageAssets target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(178,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore. [C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.NET462\Walkthrough.Generators.NET462.csproj]
"C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Generators.sln" (default target) (1) ->
"C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Foo.NETStandard15\Walkthrough.Foo.NETStandard15.csproj" (default target) (4) ->
(GenerateCodeFromAttributes target) ->
C:\Users\ja\.nuget\packages\codegeneration.roslyn.buildtime\0.4.11\build\CodeGeneration.Roslyn.BuildTime.targets(20,5): error MSB6006: "dotnet" exited with code -532462766. [C:\forks\CodeGeneration.Roslyn.Walkthrough\src\Walkthrough.Foo.NETStandard15\Walkthrough.Foo.NETStandard15.csproj]
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:14.55
from codegeneration.roslyn.
So, I got it working! At least via a project reference as you can see in my repo. I still get compile warnings: 'System.Net.Http' could not be found, in the net462 projects.
from codegeneration.roslyn.
It looks like you figured it out. I've fixed the README for the comments you mentioned. If I'm missing anything else, please open a new issue or send a PR.
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.