-
Notifications
You must be signed in to change notification settings - Fork 803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix app.config uptodate status #374
fix app.config uptodate status #374
Conversation
inputs.Remove(appConfig); | ||
var exeConfig = Utilities.CanonicalizeFileNameNoThrow(outputAssembly + ".config"); | ||
directMappings.Add(Tuple.Create(appConfig, "PreserveNewest", exeConfig)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you just add outputAssembly + ".config"
to the outputs list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i handle app.config (and content items) as 1 input -> 1 output. See my comment below
A fix for #11 should be fairly small, and your code here basically has those required changes. However you have also included a lot of other stuff, including a redesign of how inputs and outputs are detected, some of which I don't think I agree with. If you can trim this down to just the basic fix for #11 (with a test, please), then we will be happy to take it. If you think the feature needs to be redesigned further (e.g. do content files have an issue?), please open an issue and provide some examples that demonstrate the bad behavior. |
I not added a new issue for content items because there was a repro with content items by @rojepp I changed more code because the problem was bigger than an app.config workaround. I'll add test, just tell me this pr is the way to go The app.config is like a content item with The uptodate code is checking output groups, but should check msbuild build items instead. That's the root cause. From msbuild msdn:
This mean check input output of msbuild items not source files of the project or output groups. Not all output files are equal (there are multiple groups, see my comment on #11 ) some like Built, Symbols etc doesn't have 1 input msbuild item -> should check all source files old code This is not correct, msbuild is not going to replace the .dll or .exe, because is up to date ( an .exe/.dll input are only the Compile source files like .fs ), is going to change only the content file. That's the real problem. new code The content items (and app.config as workaround because we dont check msbuild items i/o directly) are checked with the output file generated by the content item. If you change a content item (or not exists in output dir) this cause a build. This pr handle also the |
I understand the scenario you are describing, but I don't think we should change our current behavior. It is acceptable to have conservative detection and sometimes trigger builds that aren't strictly necessary. It is not acceptable to have aggressive detection that can sometimes fail to trigger a necessary build. Treating all The current behavior:
C# even trips over |
ok, got it, thx @latkin for feedback 😄 I can update the pr and use the old way for Content[Never], so this pr fix
is this ok? for Content[Never] we can try a fix after v4. It's a shame, .fsx are Content[None] :sad: Do you think there is a possible workaround? Like use the dirty flag of item, check another file, dont know. /cc @KevinRansom @vasily-kirichenko @dungpa @rojepp |
@enricosada what is the status here? Are you planning to reduce to a minimal change and add tests? As explained earlier, there is no need to for any detection of copy semantics. |
@latkin didn't see this is the same behavior of c# for content items, np so. |
bdf335a
to
f677819
Compare
ok, summary:
some notes: pretty much the same behaviour of c#, but better ( fixed the deleted out config bug, c# got it ). the app.config is like a content item with preserveNewest, so msbuild doesnt replace every time, only if stale ( newer is ok for msbuild ) Target "_CopyAppConfigFile" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "D:\temp\temp projects\ConsoleApplication1\ConsoleApplication2\ConsoleApplication2.fsproj" (target "CopyFilesToOutputDirectory" depends on it):
Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files. The Now the check is appconfig msbuild target <!--
============================================================
_CopyAppConfigFile
Copy the application config file.
============================================================
-->
<Target Name="_CopyAppConfigFile" Condition=" '@(AppConfigWithTargetPath)' != '' " Inputs="@(AppConfigWithTargetPath)" Outputs="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')">
<!--
Copy the application's .config file, if any.
Not using SkipUnchangedFiles="true" because the application may want to change
the app.config and not have an incremental build replace it.
-->
<Copy SourceFiles="@(AppConfigWithTargetPath)" DestinationFiles="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')" OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" UseHardlinksIfPossible="$(CreateHardLinksForAdditionalFilesIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target> |
fix #11
fix both Content and app.config uptodate check
app.config is like Content with "Copy if Newer", so a new build doesn't replace a modified .exe.config in output directory