C
C#15mo ago
ascpixi

❔ Any way to make VS work with shared project wildcards?

Hi everyone! catlurk I have a C# shared project in a solution, and its projitems file is defined as the following:
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)**\*.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)**\*.cs" />
</ItemGroup>
By default, Visual Studio adds each file to this XML file. This keeps causing merge conflicts, since VS doesn't even settle on the order of how it adds the files. catfacepalm MSBuild works fine with this, and works perfectly; no issues there. However, with VS, several issues arise: - when adding a file, it gets added to "Miscellaneous Files". In order to fix this, I have to: - exclude the file from the project - include the file - restart VS, not saving the projitems - again include the file - when removing a file, it removes all files. Probably because it associates the wildcard entry with the removed file, and removes said wildcard entry. This can realistically only be fixed by restarting VS, discarding the projitems changes it made, and then telling it to include any file. After this, it will refresh the project, reflecting that all C# files are included in the project. I don't want to use individual entries for each file because of the merge conflict issue I've mentioned earlier, but also because VS sometimes even fails at that - sometimes I just see unreferenced files that were supposed to be deleted, but just kinda... stuck around. With a wildcard, this at least solves that issue - but many more, more severe ones arise. How can I make VS work with such wildcards? I'm not sure whether I can even use a csproj, because I'm compiling under NAOT w/ no corlib (the std library is supplied by the shared project) and I don't want to mess around with any of the internal classlib functionality (unless there is a way to package in the whole project just like a shared one). Thanks in advance! catsip
4 Replies
ascpixi
ascpixi15mo ago
anyone? catfine bumping allowed...?)
ffmpeg -i me -f null -
is this an old project? there shouldn't be the need in modern projects to include the .cs files
ascpixi
ascpixi15mo ago
no, it's a new one it's just that it's a shproj, not a csproj :/ im considering learning VS extension development just to fix this thing XD (if there maybe is something like "AddFileEvent" or whatever then i could hack something together)
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.