Repository navigation
Open
Labels
Priority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutReported by: CustomerStale
Milestone
Description
System Information (please complete the following information):
- Model Builder Version (available in Manage Extensions dialog): 16.14.0.2255902
- Visual Studio Version: Visual Studio Enterprise 2022 (64-bit), Version 17.4.2
Describe the bug
- On which step of the process did you run into an issue: After completing Model Builder wizard and C# code is generated.
- Clear description of the problem: At least in .NET Framework 4.7.2 console apps, with a completed model training process, the generated .cs files aren't recognized by the compiler; thus, the classes (eg,
IrisModel,ModelInput,ModelOutput) aren't accessible. The issue seems to be caused by the .csproj's<None/>tags:
<ItemGroup Label="IrisModel">
<None Include="IrisModel.consumption.cs">
<DependentUpon>IrisModel.mbconfig</DependentUpon>
</None>
<None Include="IrisModel.training.cs">
<DependentUpon>IrisModel.mbconfig</DependentUpon>
</None>
<None Include="IrisModel.zip">
<DependentUpon>IrisModel.mbconfig</DependentUpon>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>If these are changed to be <Compile/>, the .cs files are treated as compiled code that is accessible to the rest of the project.
To Reproduce
Steps to reproduce the behavior:
- Create new C# console app using the .NET Framework
- Create new Model Builder config
- Using the Iris dataset such as the one included in the attached file, train a model; in my example, it's created with
IrisData.mbconfig. - Try to access
IrisDatafromMain:ModelInput sampleInput = null;will exhibit the lack of recognition of theModelInputtype.
Expected behavior
.cs files should be handled as user-created classes.
Screenshots
Unnecessary, but I can provide them if you'd like.
Additional context
According to @JakeRadMSFT, and from my own test, a .NET 6 project uses 'new-style' .csproj where all .cs files are implicitly included. Thus, this issue shouldn't present in that scenario.
Metadata
Metadata
Assignees
Labels
Priority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutReported by: CustomerStale
Activity
zewditu commentedon Dec 6, 2022
@aeshirey thanks for catching it and pointing to potential causes.
[-]ModelBuilder using [/-][+]ModelBuilder-generated C# isn't recognized by the compiler[/+]luisquintanilla commentedon Jan 9, 2023
@zewditu can you please take a look at this one.
beccamc commentedon Jan 9, 2023
@zewditu If possible, can you add this into the code changes for tomorrow? Its changing the tag to for all the files.
For example....
If you don't have time or it is a complicated change, that is okay! It can ship in February.
zewditu commentedon Jan 19, 2023
None
.NET Framework 4.7.2projects does not like Compile tag because .net 5 and above projects have default compile and required to setEnableDefaultCompileItemstofalsewhich will removeprogram.csfrom the disc.the other Tag I tried
ItemandLinkstill have the same issue not able to recognizeModelInputin programs .cs in.NET Framework 4.7.2Proposed solution:
The Tag we should use should be dependent on the type of the project, unless otherwise we have a generic tag that could be used for all types of projects.
JakeRadMSFT commentedon Jan 19, 2023
Sounds good - I support rolling it out to next release and making it framework dependent. Thanks @zewditu!