Open
Description
openedon Dec 6, 2022
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
IrisData
fromMain
:ModelInput sampleInput = null;
will exhibit the lack of recognition of theModelInput
type.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment