question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fast up-to-date check with SDK project doesn't see new embedded resources

See original GitHub issue

Visual Studio Version: 16.3.7

Summary:

I have set up a SDK-style .csproj to default all .sql files to be embedded resources. If I add a new .sql file via the file system (touch on the command line, context menu -> new file in Windows Explorer) or via File->New in Visual Studio, the new file will not be embedded as VS thinks the project is up to date.

Steps to Reproduce:

I have a repository with a minimal reproduction and more detail https://github.com/hyrmn/ReproGlobsNotEmbedding

  1. Create a C# console project with the SDK-style project file (.NET Full Framework or Core)

  2. Add two file globs for SQL files

    <ItemGroup>
        <None Remove="**\*.sql" />
        <EmbeddedResource Include="**\*.sql" />
    </ItemGroup>
  1. Build the project a few times. You should see “1 up-to-date” in the build output window

  2. Add a .sql file. It can be empty.

  3. Compile the project again

  4. Use ILSpy to check the file manifest for the file from step 4

Expected Behavior:

The file should be listed under Resources when viewed in ILSpy, DotPeek or another tool.

Actual Behavior:

The file is not listed.

Oddly, the file is correctly picked up if it’s added as part of a git pull from a remote repository.

User Impact:

Application runs do not included embedded resource changes. Also, my outlook is 3% gloomier than it otherwise would be. I would be 8% happier if this worked correctly (the delta is because I’d know that reporting this issue and repro steps helped in getting it fixed and that would make me feel nice)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
drewnoakescommented, Jan 15, 2020

Thanks for the great error report and the chuckle 👍

0reactions
drewnoakescommented, May 5, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual studio doesn't trigger MSBuild
The Visual Studio build manager uses a process called FastUpToDateCheck to determine whether a project must be rebuilt to be up to date....
Read more >
Using embedded files in dotnet core
We will use a feature called EmbeddedResource. When building the project, the json file will be included in the dll.
Read more >
Upgrading your .NET projects with Visual Studio - .NET Blog
We are happy to introduce it as a Visual Studio extension and will upgrade your .NET Framework or .NET Core web- and desktop...
Read more >
MSBuild Targets
Learn how MSBuild uses targets to group tasks together and allow the build process to be factored into smaller units.
Read more >
Add app resources | Android Studio
Android Studio helps you add new resources and alternative resources in several ways, depending on the type of resource you want to add....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found