MappingGenerator icon indicating copy to clipboard operation
MappingGenerator copied to clipboard

Fix NuGet package OnBuildGenerator

Open MisinformedDNA opened this issue 5 years ago • 4 comments

Mapping Generator Version [Current]

Mapping Generator distribution NugetPackage

IDE type and version Visual Studio 2019 16.8

Describe the incorrect behavior The MappingGenerator.OnBuildGenerator on NuGet is broken. Running the code from this test case, results in 3 errors, such as

The type or namespace name 'OnBuildGenerator' does not exist in the namespace 'MappingGenerator' (are you missing an assembly reference?)

Describe the expected behavior No compilation issues.

Screenshots image

MisinformedDNA avatar Feb 15 '21 07:02 MisinformedDNA

Hi, The MappingGenerator.OnBuildGenerator assembly is not added to project dependencies. You need to copy the attribute definition directly to your source code. Please follow this guideline to set up OnBuildGenerator correctly https://cezarypiatek.github.io/post/generate-mappings-on-build/#generate-mapping-code-on-build

Please let me know if you still have any troubles.

Have a nice day, Cezary

cezarypiatek avatar Feb 15 '21 07:02 cezarypiatek

@cezarypiatek Thanks for the response. I get this error when adding SmartCodeGenerator.Engine:

MSB3073 The command "C:\Users\50587.nuget\packages\smartcodegenerator.engine\1.4.23\build/../tools/SmartCodeGenerator.Engine.exe -p C:\Users\50587\source\repos\MappingGeneratorPoC\MappingGeneratorPoC\MappingGeneratorPoC.csproj -o C:\Users\50587\source\repos\MappingGeneratorPoC\MappingGeneratorPoC\obj\Debug\netcoreapp3.1\ -g C:\Users\50587.nuget\packages\mappinggenerator.onbuildgenerator\1.22.1.18\build/../tools/MappingGenerator.OnBuildGenerator.dll" exited with code -532462766. MappingGeneratorPoC C:\Users\50587.nuget\packages\smartcodegenerator.engine\1.4.23\build\SmartCodeGenerator.Engine.targets 11

MisinformedDNA avatar Feb 15 '21 14:02 MisinformedDNA

Can you attach a sample solution that reproduces this problem?

cezarypiatek avatar Feb 15 '21 21:02 cezarypiatek