question

PhilipStapleton-2343 avatar image
0 Votes"
PhilipStapleton-2343 asked Viorel-1 commented

User control with test project will not build (framework and netcore mismatch?)

I am using VS 2019 to create a user control and a test project, but the resulting soluton fails to build with the message..
Project '..\xxx.vbproj' targets 'netcoreapp3.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7.2'.

This is how I created the solution...

  1. open Visual Studio

  2. click "new project"

  3. select "Windows Forms Control library" (Visual Basic)

  4. click "Next" and select a name (HTMLeditor) and location - click "Create"

  5. accept the default of ".net core 3.1 (Long-term support)"

  6. drag a Button control onto the control surface

  7. build solution(successfully)

  8. right-click the solution and select "Add" and "New project"

  9. select "Windows Forms App (.Net Framework)"

  10. click "Next" and select a name (HTMLeditor_Testing) and location
    accept the default of ".NET framework 4.7.2" - click "Create"

  11. build solution(successfully)

  12. right-click on "References" in "HTMLeditor_Testing" project in Solution Explorer and select "Add reference"

  13. select "Projects" and "Solution" and select "HTMLeditor" - click "OK"

  14. build solution - get
    Project '..\HTMLEditor\HTMLEditor.vbproj' targets 'netcoreapp3.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7.2'. HTMLeditor_Testing

What am I doing wrong?

dotnet-visual-basic
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @PhilipStapleton-2343 ,
May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.

0 Votes 0 ·

Hi @PhilipStapleton-2343 ,
May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.

0 Votes 0 ·
Viorel-1 avatar image
0 Votes"
Viorel-1 answered

Try a "Windows Forms App" instead of "Windows Forms App (.NET Framework)".

Or create a "Windows Forms Control Library (.NET Framework)" instead of "Windows Forms Control Library".

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JiachenLiMFST-9349 avatar image
0 Votes"
JiachenLiMFST-9349 answered JiachenLiMFST-9349 edited

Hi @PhilipStapleton-2343 ,
You need to make sure that the created project is Windows Forms Control library and Windows Forms App.
Or Windows Forms Control library (.net framework) and Windows Forms App (.net framework).
Mismatched frameworks will cause the error you're getting.
Best Regards.
Jiachen Li


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.