SSDT unresolved reference with dacpac references - visual-studio-2013

I have an SSDT project where I recently changed from SQL 2008 to SQL 2012. I re-exported my references DACPAC files using the SQL 2012 SqlPackage and replaced the SQL 2008 DACPACs with the new 2012 versions. Now I am getting unresolved reference errors for all of the referenced databases.
Strangely enough, IntelliSense auto complete works with the objects in the DACPACs. I can get all tables and columns to auto-complete and show their datatypes, even on the object SSDT is complaining about.
Is there a know issue with SSDT when migrating versions? I have another project using these DACPACs and it builds without error.

I would do three things, the first is double check that each dacpac is at 2012 - when I had a mixed project it was a nightmare, mixing versions causes all sorts of issues with references.
Secondly, open each of the dacpacs as a project in Visual studio and make sure that each of them build correctly, it might be a reference from one of those to something in master etc that is causing subsequent build failures.
Finally do a clean of the solution and build just the dacpac project, look for any messages or warnings in the output window, the answer will be there but just hard to see.
ed

Related

SSIS error in Visual Studio 0xC0010009

I've run into an issue with an SSIS package in Visual Studio 2010 and 2012. When I try to open the package I get the following error:
"Microsoft Visual Studio is unable to load this document
Exception from HRESULT: 0xC0010009"
No other information is provided. I have multiple SSIS packages in the solution and the others open. This package opened until I checked it into TFS and then it broke. Any ideas where I could get more information on the error? Or how to solve it?
Don't know if this is related, but thought I'd throw it out there.
Using SSIS Version 12.0.21005.1 REL, I received the same error and was able to solve it by editing the .dtsx with a good xml editor (hat tip to notepad++).
Basically, ensure it is well formed and all references agree. For example, in a simple ETL package with OLE DB Source, Transformation, and Output steps in a DataFlow, I found 24 references to each column involved. For one column, one reference somehow disagreed with the other 23 (it ended up being misspelled; not sure how that happened). Fixing that solved the error.
Hope that helps.

Unresolved References to Same Database Project

I've created a SQL Server database project in Visual Studio 2013 and imported a DACPAC taken from a production database. When I tried to build the project I get hundreds of SQL71501 and SQL71561 errors (both of which are "unresolved reference to an object"). Examining the scripts the problem is that many views and stored procedures use three part names: [database].[schema].[object].
It appears that Visual Studio 2013 throws this error whenever it comes across a three part name that includes the database represented by the database project. eg If the database project represents database "MyDatabase" and a SQL script in that project includes something like SELECT t.Column1 FROM MyDatabase.dbo.MyTable t then VS 2013 throws either SQL71501 or SQL71561 when I build the project.
Is there any way of suppressing unresolved reference errors that just apply to the current database? I still want Visual Studio to throw errors for unresolved references to external databases.
EDIT, Correction: Originally stated the error code was SQL71501. However, it appears Visual Studio throws both SQL71501 and SQL71561 errors for unresolved references to the same database.
Well actually there are two workarounds. My personal opinion is that there is a bug in SSDT concerning 3-part object names in the current database.
Create your project snapshot (dacpac) and reference it as a database reference. Remember to clear database variable field in the 'Add database reference' dialog.
It works however this approach is not recommended by Microsoft and can cause other problems:
https://connect.microsoft.com/SQLServer/feedbackdetail/view/1047094/post-deployment-script-is-not-generated-in-the-publish-script
At your code replace all occurrences of MyDatabase.dbo.MyTable with [$(DatabaseName)].dbo.MyTable
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/1863d960-d32d-4920-9a30-13dc86c6f857/sql71562-unresolved-reference-to-object-followd-by-database-name-in-the-same-project?forum=ssdt&prof=required
In Visual Studio:
1) Open SQL Object Explorer, link your database server, right click on unresolved reference database and "Extract Data tier application"
2) Insert a file path. Normally I use \Documents\SQL Server Management Studio\DAC Packages\ and click OK
3) Waiting for extraction
4) Right click on your project References and Add Database Reference
5) Then replace references in your functions, SP, .. with [$(YourDB)] prefix

Upgrade to Visual Studio 2010 throws a build error

Recently upgraded to VS 2010 from 2008, the previously built solutions are throwing the following error.
Error 14 Encountered multiple versions of the assembly with GUID 'a5851ea0-2f9a-40b2-a73a-cd7db32f09c5'. Try pre-importing one of these assemblies
I tried re-installing VS 2010 and it didnot help. Any ideas?
Is it the VS 2010 application itself crashing, or does it not like your solution? Can you open VS 2010 by itself? If so, it sounds like it doesn't like some of your references in one or more of your projects. Check the project references. If that doesn't work, start removing projects until you find the offending one.
This may happen, if you copy-paste-renamed a project file to re-use its settings but didn't changed the project GUID of it. Also could be a project migration error, anyway you will have to manually edit the project file and remove the duplicate references if the project fails to load because of the error.
I had the same issue when migrating 2008 -> 2013.
It was caused that we use same linked AssemblyInfo.cs for all projects in solution.
And only for the assembly that used some COM objects (MSMQ) it seems that it starts looking on referenced assemblies GUID and two of them from our solution...
So when I provide individual AssemblyInfo.cs for projects with unique GUIDs it start working.
Hope this info will helpful.
Try to remove the references to the debug folder.
In Visual Studio right click on Project
Select Properties
Select the references tab.
Check to see if any of the references are from the obj\Debug folder and remove them.
See similar question here.

.net 4.0 with Code Access Security NetFx40_LegacySecurityPolicy won't work

I'm trying to use an external library DevExpress.XtraTreeList.v8.1.dll in my vsto office addin built using VS2010 beta 2. I am getting the following compile time error:
DevExpress.Utils.AppareanceObject threw an exception --> System.NotSupportedException.
The error message goes on to say that for compatibility reasons I can use the NetFx40_LegacySecurityPolicy switch.
I've tried putting this config variable in all of the following locations:
1) my applications config file.
2) C:\Windows\Microsoft.NET\Framework\v4.0.21006\msbuild.exe.config
3) C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\dev.exe.config
None of these have resolved the problem. Here were the references I've used.
re-enable cas
msdn.microsoft.com/en-us/library/ee191568(VS.100).aspx
How do I get rid of this error so I can build the application in vs 2010?
LC.exe fails to process license information of devexpress 9.1.4 dlls
Update: Looks like this program is related to lc.exe. create a file called lc.exe.config that contains
<NetFx40_LegacySecurityPolicy enabled="true"/>
under C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\ (NETFX 4.0 Tools) solves the problem
This does work, however, you'll also need to create a file for devenv.exe.config to edit form designer changes, and the side effect of that is that COM references in project's will give obscure errors.
The end result, is that we really need an update from DevExpress on this. Allegedly a beta fix with a 2010.1 release is due any time now, come on DevExpress, hurry up! :)

Why do I get "An error occurred while validating. HRESULT = '80004005'" when building a setup project?

Why do I get the following error when building a setup project?
An error occurred while validating. HRESULT = '80004005'
One project in solution had ToolsVersion="4.0" (in .csproj file), changed it to ToolsVersion="3.5" and setup project builds fine.
Both of the reasons I found are already in other answers, but they are in separate answers and not fully explained. So, hopefully this will combine the possibilities and give good means of debugging each. :)
Common Reason
My problem was not a dependency error. However, that does seem to be the common reason. So, basically, you need to check your MSI file and make sure that all dependencies are still valid. Probably the best blog response on how you can easily resolve this if it is a dependency issue is An error occurred while validating. HRESULT = '80004005'.
Extract from blog:
Follow steps below to troubleshoot.
If you have multiple project outputs in your solution, identify the project that is giving the problem. You can do that by removing one project at a time from the Setup Project(S) until error goes away.
Once project is identified, identify the reference that could be giving the problem.
Check if the project(A) is referencing to a project that has been removed from solution. - Remove such references if any.
Check if the Project(A) is referencing to a project that was moved to a diffenrent physical location after it was added as a reference. - Remove and add such references.
Rebuild setup project after fixing the reference accordingly to see if error goes away.
Alternative Reason
My problem had to do with Visual Studio versioning, however. So, if your dependencies are valid and you still are getting this problem, then you resolve this if it is a problem with VS2010 .
Basically, if you run MSBuild and see this warning:
Project file contains ToolsVersion="4.0", which is not supported by
this version of MSBuild. Treating the project as if it had
ToolsVersion="3.5"
Then the problem is Visual Studio versioning. This means that one project was opened or created in Visual Studio 2010 and then saved or added to an existing 3.5 solution. I simply searched all files in my project for ToolsVersion="4.0" and found the offending .csproj file, opened it in a text editor and manually changed the 4.0 to a 3.5.
This error is related to a dependency error. I removed all references to my primary output project and added them again. It now compiles OK!
I ran up against this issue today. The solution in my case? Restart Visual Studio 2008.
In my case my solution (VS2008) had a project that was also referenced from another solution (VS2010). In the VS2010 solution I had upgraded the project to .NET 4.0. When I later realized the project was also used in another solution I downgraded it to .NET 3.5. For some reason everything seemed to be changed correctly in the csproj file except one place which is mentioned here: Error in setup project HRESULT = '80004005'
I know this is already solved somewhere else but I wanted to shed some light on this from another problem angle.
While simply removing and re-adding the project dependencies will work in many cases, it is important to note that:
The error message "An error occurred while validating. HRESULT=80004005."
usually happens when project is referenced to the other project which is
not added into the currect [sic] solution. Setup project only supports
dependency projects within same solution.1
I have spent enormous time on this one myself, though none of the above worked. But I have found another solution with a registry hack, you need to add a new DWORD (EnableOutOfProcBuild) value of (0) to HKCU\SOFTWARE\Microsoft\VisualStudio\14.0_Config\MSBuild\EnableOutOfProcBuild
Note: this is for Visual Studio 2015
In my case I had installed Visual Studio 2010 alongside Visual Studio 2008. My setup project, when opened in Visual Studio 2008 gave the same error, but was OK in Visual Studio 2010.
If copied to another machine that did not have Visual Studio 2010, but did have Visual Studio 2008, then it would compile.
I installed Visual Studio 2010 and converted the solutions to that version. Because of performance issues I changed my solutions back to Visual Studio 2008. Everything was better now but I got an error when I tried to compile the setup project. I realized that I had a Visual Studio 2010 Test Project in my solution so all I had to do was unload the Test Project and Build the setup project again.
Summary: unload any Visual Studio 2010 project in solution.
I hope it helps.
I know this is kinda old news, but my particular issue and solution are not specifically stated here (as far as I can tell - if I missed it, I apologize).
I had same problem. It would not compile my project, but had no errors. All I could see was "Build Failed". I opened up the "Output" file (Click View--> Output on menu), and it told me exactly which reference (in my case a .dll) was causing the problem.
I deleted and recreated the reference and it changed the reference name from Microsoft.Office.Core (which was appearently only a 32 bit version) to "OFFICE". Then everything worked great. -- Make sure to make a note of the path to the file you are referencing in the properties window... My new path was exactly the same, but the reference name changed anyway.... still scratching my head on that one...
So the moral of the story is... When you get no errors and your build fails, check the "Output" tab and it might help.
I read this answer from another post on Stack Overflow, and it has worked for me.
Open your setup project file (.vdproj) in Notepad (or any other text editor). Delete these lines at a beginning of the .vdproj file:
"SccProjectName" = "8:"
"SccLocalPath" = "8:"
"SccAuxPath" = "8:"
"SccProvider" = "8:"
Build again - the error is gone. That error didn't stop me from deploying, building, debugging (or anyting) my project; it just annoyed me. And it came on even if I set all projects to be build in a current configuration and the setup project not to.

Resources