Following my previous question, I want to change TargetFrameworks
for each developer on their machine only. However, I cannot find anyway to modify it without pushing something into our Git source control. Assuming we have a dev who works on Android and one who works on iOS, how should we do that?
Currently I can use Environment Variable but changes are not applied until VS is restarted and cleaning the project always results in some strange error until the 2nd restart.
<TargetFrameworks></TargetFrameworks>
<TargetFrameworks Condition="$(MAUI_BUILD.Contains('win'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="$(MAUI_BUILD.Contains('and'))">$(TargetFrameworks);net7.0-android</TargetFrameworks>
<TargetFrameworks Condition="$(MAUI_BUILD.Contains('ios'))">$(TargetFrameworks);net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$(MAUI_BUILD.Contains('mac'))">$(TargetFrameworks);net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$(MAUI_BUILD.Length)==0">$(TargetFrameworks);net7.0-windows10.0.19041.0;net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
Is there a better way to accomplish this? If possible, I'd like to have it to be project-specific. For example we may have a TargetConfig.txt
file in our project folder for example and we add that file into our .gitignore
. Or something like project.Development.csproj
like web.config
transformation would be great too.
Note that the solution need to work on VS for Mac as well though I think there's no difference between MSBuild on Windows and Mac.
UPDATE: somehow my environment variable workaround doesn't even work on MacOS.
CodePudding user response:
Add .user
to your .gitignore
. Add a file with the name of your project and the .user extension as a peer of the project file.
e.g.
project1\
project1.csproj
project1.csproj.user
Place the per-user customizations in the .user file.
See Customize your build.