question

LudovicDelabre-5573 avatar image
0 Votes"
LudovicDelabre-5573 asked AnnaXiu-MSFT commented

Customizing MSBuild (SDK project style)

Hi,
On my current side-project (C# NET. Standard), some files must be processed using an external tool and its output embedded as a resource.
I'm trying to use a .props & .targets file to extend the build process.
I do not deny the power of MSBuild but sometimes its subtleties gives me headaches...

So far, here what I've got :
<Target Name="TblGen"
Condition="'@(TableGenerator)' != ''"
BeforeTargets="ResolveReferences">
<Exec Command="$(MSBuildThisFileDirectory)\bin\Debug\tblgen.exe -i %(TableGenerator.Identity) -o $(IntermediateOutputPath)%(TableGenerator.LogicalName).Index" />
<ItemGroup>
<EmbeddedResource Include="$(IntermediateOutputPath)%(TableGenerator.LogicalName).Index">
<LogicalName>$(RootNameSpace).%(TableGenerator.RelativeDir)%(TableGenerator.LogicalName).Index</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>


It's almost perfect excepts that %(TableGenerator.RelativeDir) gives mes slashes where I would prefer dots.
I did tried to play with CreateCSharpManifestResourceName but could make it work.

Besides this, I would like to be able to edit the "LogicalName" metadata of my files inside VStudio (as properties) instead of raw csproj editing.
I tried to use StringPropety on my PropertyPageSchema but I could not make it work (is this only working for C++ ?)

Any help would be gladly appreciated,
Thanks,
Ludovic.

vs-msbuild
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Which version of Visual Studio are you using? Please update your Visual Studio to the latest version.

0 Votes 0 ·

1 Answer

LudovicDelabre-5573 avatar image
0 Votes"
LudovicDelabre-5573 answered AnnaXiu-MSFT commented

Hi,
Both 2019 (16.11.1) and 2022 (17.0.0 pr 3.1) gives same behavior, which is kinda of expected.
The compiler is not in fault; I am.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.