Skip to content

ProduceReferenceAssembly causes stale assemblies in legacy C# project system #2431

Closed
@Suchiman

Description

@Suchiman

Version used: VS15.3

Reproduction steps:

  1. Create a new .NET 4.7 console application
  2. Add a class library project
  3. Add a project reference from the console application to the class library
  4. Unload the class library and add this to the first unconditional property group
    <Deterministic>true</Deterministic>
    <ProduceReferenceAssembly>true</ProduceReferenceAssembly>
  5. Reload the class library
  6. (optional, doesn't change the outcome) Close VS and remove the .vs, obj and bin folder and reopen VS
  7. In the class library project, add a class like the following:
    using System;
    
    namespace Lib
    {
        public static class Tester
        {
            public static void Test()
            {
                Console.WriteLine("Hello you");
            }
        }
    }
  8. Call this method from the console application
    using Lib;
    
    namespace Startup
    {
        class Program
        {
            static void Main(string[] args)
            {
                Tester.Test();
            }
        }
    }
  9. Ensure that the console application is the startup project
  10. Start debugging by pressing F11
  11. Step through the entire program once to confirm everything is working as expected
  12. Stop debugging
  13. In the class library, modify Console.WriteLine("Hello you"); to Console.WriteLine("Hello World");
  14. Save
  15. Start debugging again using F11
  16. Step into Tester.Test();

Expected Result
Works the same as the first time

Actual Result
the source file is different from when the module was built

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions