DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

How are you handling the data revolution? We want your take on what's real, what's hype, and what's next in the world of data engineering.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Stateless vs. Stateful Widgets: Make the Right Choice for Your Flutter App
  • The Battle of the Frameworks: Choosing the Right Tech Stack
  • Designing Microservices Architecture With a Custom Spring Boot Starter and Auto-Configuration Framework
  • Elevating LLMs With Tool Use: A Simple Agentic Framework Using LangChain

Trending

  • Seata the Deal: No More Distributed Transaction Nightmares Across (Spring Boot) Microservices
  • Maximizing Productivity: GitHub Copilot With Custom Instructions in VS Code
  • A Complete Guide to Modern AI Developer Tools
  • Replacing Legacy Systems With Data Streaming: The Strangler Fig Approach
  1. DZone
  2. Coding
  3. Frameworks
  4. How I Resolved the Error ''The Reference Assemblies for Framework 'v4.5.1' Were Not Found''

How I Resolved the Error ''The Reference Assemblies for Framework 'v4.5.1' Were Not Found''

If you've come across this issue while programming your .NET projects in Windows, then this post might have your answer.

By 
Neel Bhatt user avatar
Neel Bhatt
·
May. 08, 18 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
20.4K Views

Join the DZone community and get the full member experience.

Join For Free

Nowadays, I am experimenting a lot to implement CI\CD for all our .Net projects along with BitBucket(Git), Jenkins, Sonar, Fortify, Visual Studio 2017 tools, Artifactory, Dev cloud, VMs, Docker, and many more.

I will post a series of detailed posts for this in the future, but I just wanted to share the resolution for an error which I faced today.

So, basically:
  • We have a bunch of .Net projects under one solution.
  • These projects are mainly .Net version 4.5.1.
  • The first step is to build these projects on Jenkins using a Windows agent.

The Challenge

Here comes the challenging part - the Windows agent on which we are going to build our projects, has Visual Studio 2017 along with all required tooling. So the projects which are under VS 2015, but we want them to build with VS 2017 build tools

The challenge is to build our normal .Net projects with Visual Studio 2017 MSBuild, which generally resides in the location C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe.

Now, when I try to build a big solution (which has around 30 projects) with VS 2017 MSBuild, it throws this error:

The reference assemblies for framework ".NETFramework,Version=v4.5.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

I was wondering why this happened, because I thought 4.5.1 was also present on the Windows agent.

The Solution

After much struggling and different tries (more than 200 builds on the agent), I finally found a solution which helped me  get rid of the above error. The solution which worked for me was to add FrameworkPathOverride as a parameter along with your MSBuild commands.

So basically the command would look like:

bat '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe" MySolutionName.sln /p:Configuration=Debug /p:Platform=\"Any CPU\" - p:FrameworkPathOverride="C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5″'

Important Notes:
  • Make sure you have the required sdk installed on your agent; if not, install it first, no need to install the whole VS 2015 - just the sdk should work.
  • Note that the path may change in your case. I just pasted the path which worked for me.
  • Also, this is not a full and final solution to allow your regular .Net project to build with the latest VS 2017 tooling, it is just a solution to the above error.

As I said, there are still many things to do, so I will write some more posts in the future on these topics.

P.S. Start restructuring your normal csproj code to latest sdk structure, which will help you to onboard your applications with the latest powerful VS 2017 tools.

Helpful link: Old csproj to new csproj: Visual Studio 2017 upgrade guide.

Hope it helps.

Assembly (CLI) Framework Build (game engine)

Published at DZone with permission of Neel Bhatt, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Stateless vs. Stateful Widgets: Make the Right Choice for Your Flutter App
  • The Battle of the Frameworks: Choosing the Right Tech Stack
  • Designing Microservices Architecture With a Custom Spring Boot Starter and Auto-Configuration Framework
  • Elevating LLMs With Tool Use: A Simple Agentic Framework Using LangChain

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: