-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Unable to build using <TargetFrameworks> tag on .NET 7 RC1 #28009
Comments
@igdmitrov That's literally the very first point in my repro steps: I'm on Preview, downloaded from that exact link. |
@dsplaisted could this be related to any of your recent rid and tfm changes? |
This issue appears to be fixed in the new VS Preview that dropped today. Not sure what you guys did, but I can build again. |
...scratch that. I can build, but when I try to run I get a bizarre error I've never seen before:
What in the world is going on with reference assemblies at runtime? |
What happens if you build and run from the command line using What about if you build from the command line with Would you be able to share a binlog of a command-line build with |
@dsplaisted
This is on a completely valid codebase, entirely unmodified from code that works as expected in .NET 6, except to add |
Can you clarify the exact error that you're seeing? I don't see any errors in the binlog you just shared. |
That's correct... sort of. Something is apparently causing it to try to load reference assemblies as dependencies at load-time. Either that or I'm reading the error message wrong. Not sure if that's a runtime error or if it was built wrong and has a bad reference in there now. Strangely, when I open the assembly in question in ILDASM and look at the manifest, it has references to System.Runtime and other system assemblies marked as |
It looks like you're overriding the If that doesn't help, can you provide an updated binlog of a build after a clean? The one that you provided skipped over some things since they were already up-to-date. |
Same problem.
|
@masonwheeler Based on the error message it looks like a reference assembly is being copied to the output instead of an implementation assembly, but looking at the binlog I didn't find that happening. Which assembly is it complaining about in the BadImageFormatException message, and which project is that happening for? |
@dsplaisted When I try to run the project This is one of my own projects, which makes me suspect that somewhere, some dependency-of-a-dependency is pulling in a reference assembly. The project in question has two external dependencies:
It sure would be nice if we had more informative error messages that would tell us where the problem is actually occurring, rather than just the root of the dependency tree that's failing to load, now wouldn't it? |
Just for the record, I just tried building this with RC2 and the new version of Visual Studio Preview. The error remains unchanged. |
I think the issue is this, from <ItemGroup>
<Reference Include="Pansynchro.Connectors.MSSQL">
<HintPath>..\Pansynchro.Connections.MSSQL\obj\Debug\net6.0-windows\ref\Pansynchro.Connectors.MSSQL.dll</HintPath>
</Reference>
</ItemGroup> That is a direct reference to the reference assembly, which is probably causing it to be copied to the output folder. I think you can just delete that, since you already have a project reference to that project. |
Wow, that's bizarre. Why does that even exist? |
No idea. If you've got it in a source code repo you could look at the history / blame information to try to figure it out. |
Describe the bug
Visual Studio Preview suddenly fails to build in all sorts of interesting ways on code that used to work perfectly well in .NET 6. Any project with a
<TargetFrameworks>
tag in its csproj rather than a<TargetFramework>
tag is barfing everywhere.To Reproduce
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
rather than net7.0`Expected behavior:
This was working fine in .NET 6. It should continue to work fine in .NET 7.
Observed behavior:
First, Visual Studio complains about
TargetFrameworkMoniker
andNuGetTargetFrameworkMoniker
properties being missing from the project. Then you manually rebuild project 1 and it works, but when you try to rebuild project 2, it has trouble with the types declared in project 1. VS very helpfully suggests adding a reference to project 1, even though project 2 already has one. An option to do so even shows up in the relevant ALT-ENTER popup menu. Selecting this option does nothing.How did such a massive regression in such a basic piece of functionality end up in an RC?!?
The text was updated successfully, but these errors were encountered: