I have a sql database project in visual studio 2015, that includes a clr stored procedure that calls a webservice. I have configured the projects to auto generate the serialization assembly. This means in de output folder I get both a projectname.dll and a projectname.XmlSerializers.dll.
I use the visual studio schema compare function and that works fine in comparing and updating projectname.dll but it does not show projectname.XmlSerializers.dll which I have to update by hand every time.
How do I get the schema compare to recognize and update the projectname.XmlSerializers.dll file?
In order to get SSDT to load a DLL that is not being created directly from your project into SQL Server, you need to do the following two steps:
Add the DLL to the Project (Add Existing Item)
For the properties of the newly included DLL, make sure that "Model Aware" is set to "true".
Related
This is probably a novice MS build query.
I have created an empty C# project called Database with only database sql scripts. The reason for doing this is to have the scripts output into the TFS build drop folder, since adding scripts as solution items were not output without changing templates/tweaking the XAML files.
However I noticed that the new project does not have a main entry point and hence compilation fails. So i went to Build Configuration manager and disabled both 'Build' and 'Deploy' which means I do not get the compilation error.
But the problem is that I am unable to find the scripts output anywhere in the TFS build drop folders. Please advise.
To resolve your compilation error:
Open the project properties.
Select the 'Application' area on the left (if it is not already selected)
Change the 'Output Type' from Console Application to Class Library
Once this is done you will be able to build and deploy without compilation errors even though you do not have a main() entry point.
This still will not resolve your concern about the 'Copy to Output Directory'. Visual Studio by default recognizes .sql files as having a build action of Content with an Output property of 'Do Not Copy'.
I am trying to generate a Visual Studio 2010 solution and add VS 2010 projects from custom templates!
My requirement:
1. Generate a VisualStudio Solution 2010, Save it to a folder, add VisualSTudio Project from my own templates (I have 3 different templates: ClassLibrary,WinForms ,WCFService)
My issue:
I implemented something that is working half a way!
Solution is created correctly but the content of the ".sln" file is very poor! No project reference is added >
In the root folder, it creates a Solution also for the C# Project, which I do not want. I want only the MainSolution file. (In my case "TestSolution.sln"). How can I stop creating a solutionfile for each project created?
Below the source code I use:
//for The solution:
//adding a project
Am I using the wrong interfaces?
Why the vs2010Solution.AddFromTemplate(..) returns null after the call, but no exception is thrown? Also the Project is created correctly in the folderstructure! But at runtime I can't check the list of projects "vs2010Solution.Projects" as it is null! (After correctly adding a project). I need the Project added because I need to add some references programmatically, which I try to do in the next line, but it doesn't work because vs2010Project is null).
So I am trying to wrap the VisualStudio 2010 automation model, to create a solution and add projects! But is not really working! Do I need to cast EnvDTE.Project to "VSLangProj.Project" at some point? I want to create a clean wrapper for VS2010, after that one for VS 2012!
Any help is much appreciated.
See the several articles of the section "Articles about automating project creation" on my web site:
http://www.visualstudioextensibility.com/articles/add-ins/
They explain why AddFromTemplate method returns null, how to create a solution, a project, a project inside a solution folder, a project item, etc.
I have a very simple SQL Project in Visual Studio 2013 but cannot publish to another database.
Within the obj folder it generates the "MYPROJECT.generated.sql" file, but the Microsoft.SqlServer.Server attributes are outputted above the CREATE ASSEMBLY.
CREATE PROCEDURE ....
AS EXTERNAL NAME [MyProject].[StoredProcedures].[MyMethod]
GO
CREATE TRIGGER ....
FOR INSERT
AS EXTERNAL NAME [MyProject].[Triggers].[MyTrigger]
GO
CREATE ASSEMBLY [MyProject] AUTHORIZATION [dbo]
FROM 0x234234...... (DLL as Binary Hex)
WITH PERMISSION_SET = SAFE
My problem is that this generates an error because the [MyProject] was not found in the SQL catalog. If I manually move the CREATE ASSEMBLY to the top then it works as desired.
I assume a T4 template is generating this file and was wondering if anyone knows how to update/swap the template so that I can shuffle the order (and perhaps add schema to the SqlProcedureAttribute)
[UPDATE]
My target database takes 30min to publish and I need a faster turn around for developing/debugging SQLCLR projects. My SQLCLR is a separate project that is set as a dependency from my large target database (build order). In the interim I've created a vbScript that is invoked in the SQLCLR post build event to copy the SQLCLR/prebuild.sql and combine the bottom of generated.sql + top of generated.sql + SQLCLR/postbuild.sql into a consolidated Target/PostBuild.sql. These two scripts are fired from the pre and post build scripts of the target database. This ensures that my assembly hex is current and targets the proper configuration (DEBUG|RELEASE) and I can manually deploy it outside of the target project. (3 seconds vs 30 minutes to redeploy my assembly)
[UPDATE2]
I'm modified it from generating a scripts to attach to the main project, to a standalone project with linked files. This way the large database project deployment remains unchanged and deployed with dacpac, and I have a separate project that I can use for fast build and deploy testing
In my Visual Studio solution, there are two projects. The first project is a web application. The second project contains tests, it references the first project.
In the web app's project designer, under the 'web' tab, is a field 'project URL'. At the moment, this happens to be completed:
http://localhost:8080/shop
How can I access the value of this field from my code? (in particular the test project)
The short answer… you can’t and shouldn't. This value is just a user preference setting for Visual Studio and has nothing to do with your code or the compiler.
Having said that, the value is stored in the ProjectName.csproj.user file (which is just an xml file) so you could theoretically open the file from within your code and get the value that way. I’m not sure when this would ever be a good idea though.
I have tried creating an install file but it never includes the database in the output, I have run into this problem a few times and most of the answers I find online are too cryptic for me to wrap my head around.
In the Project menu, select Add existing item, change the file type to Data Files and select your database. Then go to your project properties, in the publish tab, click the Application Files button and make sure your access file is include.
If you include your MDB as a resource (Properties -> Build Action -> Embedded Resource) you can extract it using: Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
See here for a complete sample (that also decompresses):
http://code.google.com/p/videobrowser/source/browse/trunk/MtnFrameGrabProvider/Plugin.cs