I am trying to implement a custom code analysis assembly for SSDT. I am following the guide at Walkthrough Authoring a Custom Static Code Analysis Rule Assembly for SQL Server.
After I copy the resulting .dll and .pdb files to the designated directory, the project doesn't load, and I get this error message:
One or more projects in the solution were not loaded correctly. Please see the Output Window for details.
And there is this message in the Output window:
Exception has been thrown by the target of an invocation.
I don't know how to troubleshoot this.
I am using Visual Studio 2017 and an SSDT project that targets SQL Server 2016. So this is the directory I used as the target for the .dll and .pdb files:
\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\Extensions
This is the target directory given in the link:
\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120\Extensions
I've tried only copying the .dll file. I've tried restarting all running instances of Visual Studio as well as restarting the computer. I've tried running Visual Studio with the /log switch and looking for details in the ActivityLog.xml file.
Related
I'm building a DLL which goes into the build folder of my Acumatica website, but everytime I build my solution, Visual studio replace an unrelated DLL in my site folder with the same DLL but on another version, which breaks my site.
This is the DLL originaly present in my website
This is the DLL with which visual studio replace mine:
I tried just opening this dll so Visual studio just can't replace it, but then it throws an error when I build:
Severity Code Description Project File Line Suppression State
Error Could not copy "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\System.Runtime.CompilerServices.Unsafe.dll" to "..\..\..\..\Bin\System.Runtime.CompilerServices.Unsafe.dll". Exceeded retry count of 10. Failed. CUSTOMDEV
I finaly added the right DLL in the "references" of visual studio and it solved my problem, but I dont understand why it was so eager to put its own dll there instead of letting mine.
Does someone know why it happened and if there's a way to prevent it ?
TL;DR
I have a website project with a Library project, I'm only building the Library project, but Visual Studio replaces an unrelated DLL which is in my website project with its own version everytime I build the library project.
I have developed a small database application for learning and I wanted to deploy it to run on other machine.
I try to publish application and selected Download prerequisites from the same location as my application. It gives me an error that Prerequisite file not found and it asks me to download those files
Now I have downloaded the files and I wasn't sure where to place those files and googled it.
I found that I need to add under this path:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper\Packages\DotNetFX45
Now, I have 4 different directories under this path:
C:\Program Files (x86)\Microsoft SDKs\Windows
Directories:
v7.0A
v8.1
v8.1A
v10.0A
BTW, the Bootstrapper directory is only available in v7.0A folder. So, I add NDP452-KB2901907-x86-x64-AllOS-ENU.exe under this path:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\DotNetFX452
But it still gives me same error. Then I tried to add Bootstrapper directory under other versions but same error.
Questions:
What is the correct path and why it's unable to load that file?
I need to add few other prerequisites as well so how do I know the right directories for them? (sqlncli.msi, sqllocaldb.msi, sqlcmdlnutils.msi)
And it is asking for x64 and x86 setup files separately so how do I handle that?
Environment Detail:
Window 8 Single Language
Visual Studio 2015 (Enterprise)
SQL Server 2017
Instead of copying to bootstrapper under Microsoft SDKs folder,You need to copy the downloaded prerequisites to packages folder Bootstrapper under Microsoft Visual Studio 14.0. example
32-bit system:
C:\Program Files\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages
64-bit system:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages
Check your system for relevant path:
More details at following link:
https://msdn.microsoft.com/en-us/library/hh873130.aspx
For all of other prerequisite, make sure to copy it to \packages\{prerequisite} folder. And if it asks for x64 and x86 files separately then create sub-directory like:
Bootstrapper\Packages\SqlLocalDB2012\x64 (for 64-bit)
Bootstrapper\Packages\SqlLocalDB2012\x86 (for 32-bit)
I have installed VS2017 and call
call "%VS120COMNTOOLS%VSVars32.bat"
from the command line but all I get is
'"%VS150COMNTOOLS%VSVars32.bat"' is not recognized as an internal or external command, operable program or batch file.
If I run "set" from the command line I can see VS120COMNTOOLS (for VS2013) & VS140COMNTOOLS (for VS2015) but there is no VS150COMNTOOLS. How can I build from the command line?
I submitted this as a tech support issue to Microsoft who accepted it as a bug in the install ("there is no VSVars32.bat in the C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools directory.").
However, there is a work-around:
From MS:
At least, since there is a VsDevCmd.bat, there is a Visual Studio 2017 Developer Command Prompt, which also sets, modifies environment variables (Framework40Verion, FrameworkDir, FrameworkDIR64, FrameworkVersion, FrameworkVersion64, INCLUDE, IPCPATH, PATH, VCINSTALLDIR, VCToolsInstallDir, ...)
C:\Program Files (x86)\Microsoft Visual Studio\2017\EDITION\Common7\Tools\VsDevCmd.bat
Run C:\Program Files (x86)\Microsoft Visual Studio\2017\EDITION\Common7\Tools\VsDevCmd.bat where EDITION is the type of VS2017 install, i.e. C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat for the Enterprise install. This sets up the needed environment variables and batch builds will work.
Hope this helps anyone struggling with the same issue.
VS2017 has reworked its directory structure and filenames. The file is no longer titled "VsVars32.bat", you should look for the file 'vcvars.bat', which can be located in ..\Program Files (x86)\Microsoft Visual Studio\2017\EDITION\Common7\Tools\vsdevcmd\ext\vcvars.bat (using Adam's syntax, replace EDITION with the version of Visual Studio you use).
For simplicity, you can use %VSAPPIDDIR% in your call to point to the IDE folder where devenv.exe is located, and go back one folder to define your path to the batch file. For example:
call "%VSAPPIDDIR%..\Tools\vsdevcmd\ext\vcvars.bat"
If its any help to anyone...
If you modify your Visual Studio 2017 installation to install the component:
"VC++ 2015.3 v140 toolset for Desktop (x86,x64)"
then the 'VSVars32.bat' file which is missing, will be installed (as its a component of VC++ 2015, but not VC++ 2017).
I have an solution with one project. Able to build it via VS GUI.
I want to build it via command prompt. But getting errors:
Command used:
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" "C:\Users\xxx\Desktop\WebApplication1\WebApplication1.sln" /t:build
error:
error MSB4019: The imported
project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets"
was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
How to resolve this. Please suggest.
This can happen when Visual Studio is not installed on the machine on which you're attempting to build the project (e.g. a build agent).
Verify VS is installed, or if this isn't an option you could run the following command in the package manager console:
Install-Package MSBuild.Microsoft.VisualStudio.Web.targets
This package will update the .csproj file of your project to use the VS version of the targets if they exist, otherwise a local version contained in the packages folder.
The path of MSBuild should be "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" instead of "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe".
As per Visual Studio Blog: MSBuild is now part of Visual Studio!:
Starting with Visual Studio 2013, the 2013 version of MSBuild will ship as a part of Visual Studio instead of the .NET Framework. This transition allows us to more rapidly evolve MSBuild.
So when you build project via command prompt in Visual Studio 2015, the path of MSBuild should be "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe".
Hope this can help you.
I am not able to publish to azure my web api, after updated Visual studio 2015 update 3.
The error message says:
The “PublishTelemetry” task could not be loaded from the assembly
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.Tasks.dll.
Confirm that the declaration is correct, that the assembly and all its
dependencies are available
I have found the fix here. I edited with admin rights, the file
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets
and removed the tag PublishTelemetry and its using tag. After edition, I restarted visual studio. Now I am able to deploy again.
Even after editing the admin rights it wasn't working so I just install the MSBuild.Microsoft.VisualStudio.Web.targets from NuGet.
I downloaded the MSBuild.Microsoft.VisualStudio.Web.targets package from NuGet and replaced the C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web folder with MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3\tools\VSToolsPath\Web folder from tha package.