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
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
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

Modern Digital Website Security: Prepare to face any form of malicious web activity and enable your sites to optimally serve your customers.

Containers Trend Report: Explore the current state of containers, containerization strategies, and modernizing architecture.

Low-Code Development: Learn the concepts of low code, features + use cases for professional devs, and the low-code implementation process.

E-Commerce Development Essentials: Considering starting or working on an e-commerce business? Learn how to create a backend that scales.

Related

  • Stateless vs. Stateful Widgets: Make the Right Choice for Your Flutter App
  • Using Maven Profiles and Assembly Build Customized Applications
  • Preserving Context Across Threads
  • Node.js Unveiled: Why You Should Use It for Enterprise Apps

Trending

  • The Advantage of Using Cache to Decouple the Frontend Code
  • Leveraging "INSERT INTO ... RETURNING": Practical Scenarios
  • Apply Strangler Pattern To Decompose Legacy System Into Microservices: Part 1
  • The Scrum Trap
  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.

Neel Bhatt user avatar by
Neel Bhatt
·
May. 08, 18 · Tutorial
Like (3)
Save
Tweet
Share
19.5K 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
  • Using Maven Profiles and Assembly Build Customized Applications
  • Preserving Context Across Threads
  • Node.js Unveiled: Why You Should Use It for Enterprise Apps

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • 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
  • support@dzone.com

Let's be friends: