Open pshao25 opened 1 year ago
//cc: @m-nash, @heaths, @pallavit
I think this is a common thing for many library dependency cache situations. If we wanted to fix this I would lean more towards having the cdoe generation target always run restore for the user so they don't need to run multiple commands.
Is this issue more of a concern now than before due to all the activity happening in the autorest repo? As Michael said I would assume this is package caching concern which is usually diminished by backward compatibility. So, if you end up using an older package you generate older code but not necessarily incorrect code.
I agree with Michael. Solve this as low down the stack as possible by depending on the Restore
target for GenerateCode
. You might need to find some way to force it, though. Maybe. Given a <PackageReference>
changed that may not be necessary.
If you fix it in some higher-level script, if and when someone calls the GenerateCode
target themselves or another script is written for some other purpose, the problem will be apparent again and may be hard to diagnose for people who aren't as familiar with the system end-to-end.
Is this issue more of a concern now than before due to all the activity happening in the autorest repo? As Michael said I would assume this is package caching concern which is usually diminished by backward compatibility. So, if you end up using an older package you generate older code but not necessarily incorrect code.
I would rephrase as "user might generate unexpected code from out-of-date generator."
Repro steps:
Microsoft.Azure.AutoRest.CSharp
version is3.0.0-beta.20230328.2
.dotnet msbuild /t:GenerateCode
under an arbitrary project. The version autorest is loading should be3.0.0-beta.20230328.2
.Microsoft.Azure.AutoRest.CSharp
version to3.0.0-beta.20230329.1
.dotnet msbuild /t:GenerateCode
again, you would see theMicrosoft.Azure.AutoRest.CSharp
version is still3.0.0-beta.20230328.2
instead of3.0.0-beta.20230329.1
.Root cause: You could go to
{RopoRoot}\artifacts\obj\Azure.Analytics.Synapse.Monitoring
for example, there is a cache fileproject.nuget.cache
. Its content isSuggestion: I suggest we add a
dotnet restore
to everyautorest.md
, otherwise user might generate incorrect code from out-of-date generator.