Home > database >  Visual Studio Error : Unrecognized Guid format
Visual Studio Error : Unrecognized Guid format

Time:09-13

I have a solution containing CSharp projects and Python projects in a specific folder.

I just added a Directory.Build.targets into the root of the folder as following:

<Project>
    <ItemGroup>
        <ProjectReference Include="..\..\Shared.csproj" />
    </ItemGroup>
    
    <Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Debug'">
        ... commands
    </Target>
</Project>

After that, when I'm running the VisualStudio again in the output I have some errors because of Python projects:

..[path][projectName].pyproj : error : Unrecognized Guid format.

Any idea how can I exclude the python projects from the Directory.Build.targets?

CodePudding user response:

Yes. Add a condition, such as

    <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
        <ProjectReference Include="..\..\Shared.csproj" />
    </ItemGroup>

This will include this group (in this case with a reference) only if the current project is a C# project.

  • Related