.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2025 .net core obj folder (project.assets.json) killing old compiles

4 REPLIES 4
Reply
Message 1 of 5
JamesMaeding
178 Views, 4 Replies

2025 .net core obj folder (project.assets.json) killing old compiles

I'm taking .net projects for acad 2024 and making them work in 2025.

I think many out there will be interested in this post as I think what I am doing is the simplest of .net core migration.

I have a vs solution and project for each acad version, all in one folder.

So, I can open a solution for 2024 and compile my dll, easy.

I open my 2025 solution and compile my dll(s), also easy. (big YAY btw. YAY YAY!)

When I go to recompile my 2024 solution, it fails, lots of errors about missing .net framework reference. (doh)

I then delete the obj folder and the 2024 solution compiles fine. (squeemish yay)

What is going on is the project.assets.json file, in the obj folder, messes up the 2024 compile, and all previous acad version compiles.

What I have decided I want is the the 2025 solution to put its obj folder in another spot so my old projects don't conflict. There are other ideas like deleting the obj folder but that messes with nuget so a bad idea.

I'm trying all ideas like mentioned here:

https://stackoverflow.com/questions/52833741/your-project-does-not-reference-netframework-version-v4... 

I can't get it to work though.

I think I am close but my code to set <BaseIntermediateOutputPath>$(SolutionDir)\objR25\</BaseIntermediateOutputPath> in project file is not working.

My project file looks like this: (or the first part...)

JamesMaeding_1-1734558265654.png

see the little red squiggle? I won't compile. I'm trying things....

How can I get the acad 2025 project to put all its obj stuff in obj25?

I know I could make separate project folders. That was never needed and I don't think it is now.

I'm just getting caught on details of project configuration.

thx,


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

4 REPLIES 4
Message 2 of 5
JamesMaeding
in reply to: JamesMaeding

After much struggle, I got all the items normally the obj folder to go to another folder.

The problem is there are two kinds of obj files.

The ones that the project makes, and those that relate to packages (nuget).

To redirect both, you must set the values before the project import, like this:

JamesMaeding_1-1734571587325.png

and then at end add the <Import statement:

JamesMaeding_2-1734571630082.png

You must use an explicit path at top, not ProjectDir variable as its not defined yet.

Acad 2026 will have a ObjR26 folder and so on. One per .net core project is best as I understand it.

I'm expected to be ripped apart by at least someone on my "multiple acad version projects in one folder" approach.

Just explain the advantages of alternatives if better.

thx


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 3 of 5
Jeff_M
in reply to: JamesMaeding

@JamesMaeding I also have 1 folder with solutions and projects for each year. When I was working on the same issue last year I was pointed to a better solution than editing the project files as you are doing.  https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-directory?view=vs-2022

I added the Directory.Build.Props file to the top of the solutions folder and it has worked like a charm. 

<Project>
 <PropertyGroup>
   <Deterministic>false</Deterministic>
   <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">obj\$(MSBuildProjectFile)\</BaseIntermediateOutputPath>
 </PropertyGroup>
</Project>

 

Jeff_M, also a frequent Swamper
EESignature
Message 4 of 5
JamesMaeding
in reply to: Jeff_M

@Jeff_M

Hmm, I did see that, its actually the most common suggestion. I did not try it as I thought that would put all project "obj" stuff in one folder.

I was trying other variables, not the $(MSBuildProjectFile) so I'll try that. Much better than hardcoding paths.

I need to update my previous reply as it turns out both paths need to be explicit in my approach, not just the first one.

I'm going to do a walkthrough post on how i transitioned things.

Its way easier than the "conversion" methods I read, but also not multi-targeted.

That idea of all eggs in one basket just seems risky to me. Its likely not but I'm easily scared.

thx

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 5 of 5
18348401357
in reply to: JamesMaeding

just add multiple framework version numbers,
QQ20241225-153857.png

and control their nuget separately by itemgroup and condition

QQ20241225-155143.png

After compiling, two folders will appear

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report