dotnet / try-convert

Helping .NET developers port their projects to .NET Core!
MIT License
1.14k stars 154 forks source link

try-convert error - No OutputType found in the project file #379

Open rmaloo opened 3 years ago

rmaloo commented 3 years ago

Console output:-

No OutputType found in the project file '{proj-path}.csproj'. Are you sure your project builds today? {proj-path}.csproj does not have a supported OutputType.

No projects converted.

Please let me know if you want the csproj content. I can share privately

phatcher commented 2 years ago

@rmaloo This seems to be a missing OutputType node in the project file's main PropertyGroup; I have this on an older project where it was upgraded e.g.

  <PropertyGroup>
    <AssemblyName>MyProject</AssemblyName>
    <RootNamespace>MyProject</RootNamespace>
    <AssemblyVersion>1.1.0.0</AssemblyVersion>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <TargetFrameworkProfile />
    <OutputType>Library</OutputType>
  </PropertyGroup>

VS is detect the type automatically some how if it's missing, but will insert it automatically if you toggle between the current type and another value forcing, or you can manually add it to the project file.

In terms of this tool, ProjectRootElementExtensions.GetOutputType function would need to be enhanced to perform the same magic that VS/MsBuild do to detect the project type if the value is not present.