Can´t build .net core project with a database project. Error MSB4019 - asp.net-core

I have a new .net Core 2.0 Web API project (In Visual Studio 2017 Version 15.3.5) where I can´t build the solution if I add a new database project.
error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.0.0\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
I have tried all kinds of solutions
Installed almost everything missing from the Visual Studio Installer
Installed Visual Studio Build Tools 2017
Repaired Visual Studio
Without luck I tried to find Microsoft.Data.Tools.Schema.SqlTasks.targets file on C:\ to the add reference to it in the project file (I then don´t know if that works while building the solution in VSTS).
So why can I add a database project to a normal API project and everything works just fine but not to a .net core one?
Do database projects not work with .net Core? I have searched for information on this but sorry I just can´t find it.
I´m not sure what to do. Hope somebody can help.

Ok I managed to find the Microsoft.Data.Tools.Schema.SqlTasks.targets file on my computer.
I then needed to unload the project and edit it
There I changed this line
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
to the hardcoded path of my file
<SSDTExists Condition="Exists('C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
And now it builds on my computer and on VSTS.
But why this is like this I don´t know.

I was having the exact same issue building a SQL Server project on an Azure DevOps CI/CD pipeline, and locally on VS Code. On Azure DevOps none of the pre-built build tasks would work for me, and locally I could only compile the SQL Server project on Visual Studio, which was annoying. Your solution didn't work for me, after doing what you suggest, I would get a .dll missing error, related with the first error.
I solved this by avoiding to add a SQL Server project to the solution.
I achieved this by using an MSBuild SDK, capable of producing a SQL Server Data-Tier Application package (.dacpac) from the set of SQL scripts. By adding this second project to the solution, I managed to continue taking advantage of linking the project to a live database through SQL Server Object Explorer on Visual Studio. I gave a more detailed explanation about my implementation in this answer.

Related

Web Setup Project on Visual Studio 2022 - Unable to open project error

Good evening,
I have created a Web Form using Visual Studio 2022, and I have created a Web Setup project to help our customers to install the site on their server. I used the official extension that allows to create Setup projects in VS2022 (Microsoft Visual Studio Installer Projects); everything worked fine until some days ago, when VS2022 started to show the following error when trying to load the installer project:
"Unable to open project .../Setup.vdproj".
This is the error I am getting when I try to open/create a Web Setup project
I tried to open it also with VS2019, which I still had installed on my computer, but I got the same error.
At the beginning I thought it was an issue related to the project (maybe for some reasons some files had been corrrupted), so I tried to create a new Web Setup project, both on VS2022 and VS2019. Again, the same error appeared, on both versions of VS. At this point I tried to load the already existing project on another computer, and on the other computer everything worked perfectly, the project was loaded immediatly and no issues have been detected.
I tried to unistall and re-install the Microsoft Visual Studio Installer Projects extension, it didn't solve the problem; I tried to repair VS2022, it didn't solve the problem; I tried to completely uninstall VS2022 and VS2019 and re-install only VS2022, and guess what? It didn't solve the problem.
Does anyone know how to fix this problem, and what is the reason why I am unable to neither load nor create Web Setup projects?
Thank you,
Giacomo

Migrating SSDT from 2015 to 2019 Breaks Script Component

I just migrated from SSDT 2015 to SSDT 2019 and tried to open a project created in SSDT 2015. One of the packages has a data flow task with a script component in it. The script component fails to build with the error:
Could not find part of the path
'C:\Users\xxxxxx\AppData\Local\Temp\2\Vsta\c2e811fdc5974e2ca3f7cb5426c82033_out'
I tried to delete the .vs folder in my project but that didn't work. The script still fails to rebuild. The script has a lot of classes in it so I'd rather not start from scratch and copy everything into it. Any idea what could be wrong?
Appears this issue may be caused by an incompatibility between Visual Studio 16.9 and SQL Server Integration Services Projects. The issue is described here: https://marketplace.visualstudio.com/items?itemName=SSIS.SqlServerIntegrationServicesProjects
Recommendation is to regress back to Visual Studio 16.8 or earlier.
The new version of data tools fixed it for me without rolling back to 16.8. This was a difficult issue to resolve. Nowhere in the MS documentation do they mention the tools update fixes that specific error. Thanks for the link!

VS2015: The components for communicating with FTP servers are not installed

I have been using Visual Studio 2010 Pro for my vb.net desktop application development. I publish the apps via clickonce to a web server with ftp. My settings look like this:
Publishing folder location: ftp://www.webaddress.com/folder/
Installation folder : http://webaddress.com/folder/
This works perfect in VS2010.
I am now trying to upgrade to Visual Studio 2015 community edition. When I try to publish my app, I get the error "The components for communicating with FTP servers are not installed". I am getting this error on both computers I have installed VS2015 on.
Strangely enough, there isn't much info on this error. The only solution I've seen is to repair the installation. I did this but still a no go.. Another cause I read about is having Xamarin installed, but I have never had that installed.
Has anybody run into this and know what the fix is??
EDIT:
It appears to not actually have anything to do with installed components. After I posted this question, I realized the publish via FTP had worked earlier on a little sample Hello World project i made (brain fart). It was only once I loaded my existing project that this error started showing up.
I closed the solution, created another simple project, and still got the error. I closed visual studio, reopened the sample project, and ftp worked! I then opened my existing project and ftp worked there too?! So I don't know what the trigger is, and I haven't had it fail again yet, but maybe this info will help figure out what is causing the failure.
EDIT (3/30/2017)
Just an update - I am still having this issue. This issue happens on visual studio 2013, 2015, and 2017. I have tried reinstalling the c++ redistributable, still nothing. It seems others are having this issue with a web project but mine is a desktop app publishing with clickonce via FTP. It must be something to do with solution I am working on that was originally created in 2010, as the issue is not present in any other project.
I had the same issue with Visual Studio 2017. What fixed it for me was to start the Visual Studio Installer and install the ".NET Core cross-platform development" workload.
I had the same issue in Visual Studio 2015 / Update 3. It was resolved after installing the 32-bit version of Visual C++ Redistributable Packages for Visual Studio 2013 (https://www.microsoft.com/en-us/download/details.aspx?id=40784)
See also https://github.com/aspnet/Tooling/issues/748
I had the same problem with Visual Studio 2015. And Publish used to work fine so I went going crazy looking for and trying different solutions. Then I read on another thread of doing a Setup-> Repair (submitted by Erikest). I did a Setup->Repair and the publish process now works! I think it's also possible that the Repair not only did the trick on the FTP components but also replaced the C++ redistributable (often mentioned as a solution to this problem),
This is a total work around, but I've noticed I get this error every time I open my app (that originated in VS2010) and try to publish without first opening a sample app. I created a new project and published it to my FTP server. When I receive this error, I close Visual studio, reopen and the open the sample project, publish that app, then open my real app. The publish then works.
This works every time, and seems to be a bug in Visual studio, and probably has something to do with the fact that my app was originally built in 2010.
Maybe this will help somebody else with the same issue. It's a big pain so hopefully MS gets a fix in for this.
I have been banging my head against this problem for many months, re-installed VS over and over and just did a clean install of Windows 10 in the hope it would work but to no avail. By chance I cleaned some old .accdb files from the App_Data folder that I no longer need since I converted to SQL Server database and FTP publishing now works.
So it seems VS does not like the .accdb files but was happy with .mdb files when publishing with FTP.
As soon as I put the file back in App_Data the problem returns. Hope this is some help.
I had the same issue here, I was using the Publish right click option on the project, which had been working fine. What fixed it for me was going back through the publish options and re-testing the connection. Publish seemed to work after that. Maybe it forgot a password or settings?
I also installed the x86 C++ Redistribution Package.
Hope this helps someone who is in the same boat.
After many successful website publishes with Visual Studio 2015 Community Edition, we experienced the "components for communicating with ftp servers are not installed" issue. :(
First attempt at resolution was uninstalling VS Community 2015, then installing VS Community 2017. Received the same error: "components for communicating with ftp servers are not installed" when attempting to publish our business website.
With some work, we found that by uninstalling Microsoft Web Deploy and re-installing, this seemed to fix the problem. We can now use Visual Studio > Publish function to our ftp without problems.
See this link for download of Microsoft Web Deploy components.
https://www.microsoft.com/en-us/download/details.aspx?id=43717
Dont know what broke this VS IDE functionality, but hope this fix helps some.
I encountered the same error with Visual Studio 2019
I fixed it by using the Visual Studio Installer to install the Web Deploy (inc .netcore 2.1) under individual components
I just did a simple "repair installation" in the installer. Worked for me.
I am using Microsoft Visual Studio Community 2019 and had this problem for a while.
The problem went away after I updated about 10 NuGet updates that were over due.
I had the same problem, I closed all the open windows I closed Visual Studio and then I opened again and published and then it worked!

How to create a database project in Visual Studio 2013

I'm migrating a solution which contains some C# projects from Visual Studio 2008 to VS2013. The migration went fine, with a few adjustments, but there's also a .dbp project (database project, from VS2008), which refuses to migrate / load in VS2013.
The closest project type I found in this newer version is "SQL Server Database Project", I've created one and added my existing .sql script files, but this project type (.sqlproj) appears to be something different. For example, VS 2008's "database project" does not build. Also, I had a hard time trying to add a reference to my existing SQL database running under SQLExpress.
I've also set BuildAction = None to all my script files, and now I can open each of them manually and execute. But still, I'd like to select multiple files and execute them all at once. Seems I'm missing something.
So, is there a way to accomplish that?
I suggest you look at the following article to convert the dbp to dbproj: MSDN
And after that look at the following link to convert dbproj to sqlproj: Tentacle Software Blog

Getting Auto Deploy to work with MSBuild on a build server

Please pardon a newbie's question about MS TFS and Visual Studio 2012, I hope I'm using the correct vocabulary.
Our shop has recently moved to MS TFS and Visual Studio 2012 to build internal web services for integration. Currently we have a TFS 2010 Server running on Server2008R2 and a Build server on a Windows 7 box, our dev application server is also running Server2008R2. I have been given the job of getting a nightly build and deployment running. I have the build definition working but the deployment portion is not functioning. I have installed Web Deploy on both the dev application server and the build server as per these articles:
http://www.kevingao.net/version-control/how-to-auto-deploy-web-application-with-tfs-build-server.html
and
http://www.iis.net/learn/install/installing-publishing-technologies/installing-and-configuring-web-deploy
We have configured an user, web_deploy_dev in active director and that user is a local admin on the dev app server.
The parameters added to the build definition are:
/p:DeployOnBuild=True
/p:DeployTarget=MsDeployPublish
/p:MSDeployServiceURL="https://PA-APPSRV1-DEV:8172/msdeploy.axd" /* double quotes not in original code */
/p:DeployIISAppPath="DW/DWServices" /* E:\Webroot\DW\DWServices */
/p:CreatePackageOnPublish=True
/p:MsDeployPublishMethod=WMSVC
/p:AllowUntrustedCertificate=True
/p:UserName=migp\web_deploy_dev
/p:Password=******
I suspect that MSBUILD is not even calling msdeploy.exe as I see no errors in the windows event and application logs, but I do not know all the places to look. I can use a web browser and connect to the service on the dev app server as the web_deploy_dev user from the build server, I receive a web page not found error after inputting user name and PW, but I assume that is to be expected.
I am at a loss as to where to look next, I've tried searching the web but nothing I try seems to work.
Thank you in advance for your help and input.
Roy
It sounds like you are experiencing a problem where your build completes and claims success, but you aren't getting any error and nothing is actually deployed. When I've experienced this with my TeamCity build server, the problem was that MSBuild was not set up on the machine that would do the building and deploying. These are my steps to resolve the problem I think you might be having:
Make sure that at least Visual Studio Express is installed. you can tell if a full enough version of Visual Studio is installed by navigating to the
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\ directory. If you see folders like 10.0, 11.0, or '12.0', look inside them and verify that there is a Microsoft.WebApplications.targets file. Note the versions that pass that check.
In your Build Configuration, add a /p:VisualStudioVersion=12.0 or whatever version of Visual Studio is appropriate.
Let me know if this gets you anywhere or not. I'm really curious to hear if you are finding any errors or logs anywhere. Basically, in my experience using Web Deploy and MSBuild with TeamCity, if the machine that is building and deploying doesn't have the MSBuild installed with the Microsoft.WebApplication.targets file, it silently fails.