Missing values for the following SqlCmd variables:Path1 Path2 - visual-studio-2010

I get the error
Missing values for the following SqlCmd variables:Path1 Path2.
in a few Sql Projects in Visual Studio.
I tried googleling it but found nothing.

Select the SQL project.
Go to project's properties (ALT + Enter).
Navigate to SQLCMD Variables and act accordingly (either remove the variables or fill in the default values).

I ran in to this yesterday after tinkering with the project settings for my database project (right-click the database project, click properties, then click the Project Settings).
I had checked the Create script (.sql file) option and things continued to work as normal for me. But when another team member checked out the the latest update, they could not build and got the error about missing values for SqlCmd variables. Things still worked for me though until I checked out a fresh version of the source and started getting the same error.
To fix, I simply unchecked the Create script (.sql file) setting and all was well again.

I hit this issue. I'd added some SQLCMD variables then deleted them. The SQLCMD variables no longer existed in the publish files or the .sqlproj file. I grepped all the files in the project and the variables didn't exist anywhere. I'd restarted Visual Studio. However I was still getting the
Missing values for the following SqlCmd variables: error.
From the project directory I deleted the *.dbmdl and *.sqlproj.vspcc files. The project then published successfully.

This happened to me as well and it turned out that someone else had setup some automatic logging on the project that mapped a path variable in the sqlcmd variables. After they checked in to tfs, I could no longer build because of this error. Have them either clear the path and update the project or match the value of the variable on your side.

Related

Why SSISDeploy overwrite the whole projects and not only what was modified?

I have the below structure in ssis server:
Assuming I worked on Integration service project in VS but only on one dtsx from the list above.
Now I ran the below SSISDeploy (documentation is here) command from CMD:
SSISDeploy.exe -s:"C:\git\test\Integration Services\bin\Development\Integration Services.ispac" -d:catalog;/SSISDB/TEST/TEST_INRG;"TEST03,1234" -at:win
and got this message:
Will deploy 'Integration Services.ispac' to TEST03,2890:/SSISDB/TEST/TEST_INTG.
The project 'TEST_INTG' already exists in the catalog folder 'TEST'. Will overwrite it.
So what actually happened, all the packages were delete and my dtsx package was overwritten the modified one. Is there a flag which can tell the command to change only what was modified? I was expecting to see only change in the actual dtsx package.
Got official answer in Microsoft forum:
https://learn.microsoft.com/answers/answers/441954/view.html

Error building a console .netcoreapp3.1 app with VS2019

I am building a console HelloWorld .netcoreapp3.1 with VS2019 16.7.5
After the wizard, when building I get the error
>C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1004: Assets file 'D:\ConsoleApp2\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
I tried:
PM> dotnet restore
Determining projects to restore...
C:\Program Files\dotnet\sdk\5.0.100-rc.1.20452.10\NuGet.targets(130,5): error : 'Python 3.6.5' is not a valid version string. (Parameter 'value') [D:\ConsoleApp2\ConsoleApp2.sln]
Same results with nuget restore.
Yes, I have Python 3.6.5, but even removing from the environment variables, I get this error.
Whatever issue you're having is certainly machine specific, and therefore I cannot possibly give you an answer with any certainty, or reproduce it on my machine. I know you said that you removed environment variables, but this is my best guess, as MSBuild automatically imports all environment variables as MSBuild properties.
What you can do is run dotnet restore -bl, which will create a msbuild.binlog file. Open it with https://www.msbuildlog.com/, and type "python" in the search box. You'll discover where the string is coming from, and how it flows to NuGet's restore. If it's listed as a property at the very beginning of the project evaluation, unless you passed in that string on the command line, it's almost certainly coming from an environment variable.
If you swear it's not an environment variable, in the binlog viewer, you can right click the csproj and choose "preprocess", or run dotnet msbuild -pp:pp.txt and open pp.txt in your favorite xml/text viewer. This is the csproj with all MSBuild imports copy/pasted into a single file. If python didn't come in via an environment variable, then it must have come from an import, which will be visible in the preprocessed file.

Setting Environment variable in Visual studio C++project

I realize that similar questions were posted earlier but I need slightly different solution.
I have VS2012 C++ project A.vcxproj,that has debug1 configuration( platform x64) , and it builds corresponding .exe. It also uses a dll from other VS2012 C project B.vcxproj from a path that must be added to the environment variables. A.vcxproj.user file has following text
<LocalDebuggerEnvironment>PATH=%PATH%;C:\Program Files\libsndfile\bin;..\..\lib\simulink\;$(LocalDebuggerEnvironment) </LocalDebuggerEnvironment>
I need to add this setting automatically to the "A"project with following constraints
I cannot export user file as it as "per user", so cannot upload to our SCM system where other users can download it.
I tried adding code in main function, something like
_putenv("PATH = ....\lib\simulink");
but this does not work, as before the main file is compiled, it needs to search for the dll from specified path, which it dosn't .
Can anyone suggest a easy, portable fix , that i could distribute to all users through SCM, along with the project file.
I have also tried following:
--Created batch file setpath.bat with following content
#ECHO %PATH% set PATH = %PATH%;C:\Program Files\libsndfile\bin;C:\dev\lib\simulink
-- added to A.vcxproj settings->build event->Pre-build->Command line
call C:\setpath.bat
and I don't see the added paths under vS op window. neither does the VS User file gets the change, and running the project complains for missing dll error.
--I tried to execute the batch file in
A.vcxproj settings->
Custom build step->Execute before "Run"
and still no result.
I guess the solution needs to add needed path to current environment variable for the time VS project is "run".
Thanks
sedy
added to A.vcxproj settings-> Build Events ->Pre-Build event
call setdllpath.bat
where the file contains the following:
#ECHO %PATH%
set COMSPEC = "%VCINSTALLDIR%\vcvarsall.bat" amd64
setx PATH "C:\Program Files\libsndfile\bin;..\..\lib\simulink"
#ECHO %PATH%
So, once I build the Project, close Visual studio and open it again, and run the files wiithin project, it picks up dll correctly.
Contents in *.vcxproj.user, *.vcxproj.user or *.props use the same xml schema so can be easily exchanged or included.
First if usefull you can add UserMacros to define the path to your libraries.
Like bellow for the following two variable
PYTHONHOME=$(USERPROFILE)\AppData\Local\Programs\Python\Python37
PYTHONPATH=$(PYTHONHOME)\DLLs;$(PYTHONHOME)\Lib;$(PYTHONHOME)\Lib\site-packages
Edit the .vcxproj adding inside <Project>:
<Project .... >
...
<PropertyGroup Label="UserMacros">
<PYTHONHOME>$(USERPROFILE)\AppData\Local\Programs\Python\Python37</PYTHONHOME>
<PYTHONPATH>$(PYTHONHOME)\DLLs;$(PYTHONHOME)\Lib;$(PYTHONHOME)\Lib\site-packages;</PYTHONPATH> </PropertyGroup>
...
</Project>
After you can add inside your build configuration, the following to set the $(Path) variable.
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<LocalDebuggerEnvironment>Path=$(Path);$(PYTHONHOME);$(PYTHONHOME)\DLLs;$(PYTHONHOME)\Lib;$(PYTHONHOME)\Lib\site-packages;$(PYTHONHOME)\Scripts;$(PYTHONHOME);</LocalDebuggerEnvironment>

Running NUnit-Console on a Mac

Apologies for the nubbery, but I'm having a real pain getting NUnit to run on my Mac. The overall goal is to have Jenkins on our Mac build server build our Xamarin project and run the relevant tests to the .sln file.
I've got NUnit-Console installed and invoking correctly on the mac. However, whenever I pass it /relative/path/to/solution.sln (or .csproj, we don't have a .nunit or built .dll), NUnit finds the the .sln file correctly, however it then throws this error: Could not find file "/relative/path/to/solution\TestProject.csproj".
The .csproj is there, but NUnit seems to want to append a backslash instead of a forward slash. Is there some config option I've missed for this?
Ok so it doesn't look like you can configure NUnit-Console to not do this. If anyone reads this and is looking for a work around, you just need to get your built files from their location, onto a location that Nunit-console running on windows can access.
For my particular use case with Jenkins as the build manager, I've set the project to build on our MAC server, then as a post build action added 'Archive for Clone Workspace SCM'. I've then setup another project called [ProjectName]Tests, which has the other project targeted in 'Source Code Management' > 'Clone Workspace'.
The test project then has my relevant calls to nunit-console as a Windows batch script and everything works as expected!
Hope this helps save others some time if they hit the same issue!

Include Search Paths in TeamCity build Configurations

Normally when a Developer compiles a certain mixed C++/C# solution locally on their machine at our company, they employ the use of a .vssettings configuration file. One of the things included in this config file is reference to various directory paths for Lib and Include files.
However, our buildAgent machines (using TeamCity) are set up to be sterile, and have the bare minimum installed on them required to build any given solution/project. This means the above exampled mixed C++/C# project wont have access to the IDE's configuration where things like include search paths were set. TC accounts for this by allowing you to set all sorts of variables for any given buildConfiguration (or even by buildAgent)....
But how do I get an Include search path to WORK in TC? I'm copying down from Source Control (Perforce) a copy local of what I want Included (1), and then trying to define an Environment Variable (2) -- and yet TC fails the build (3).
I'm sure I have something configured wrong, but for the life of me cant figure out what!
Any help would be most appreciated,
blong
(1) VSC Client Mapping - Perforce
//depot/OpenSource/Boost-1.33.0/boost/... //team-city-agent/OpenSource/boost/...
(2) buildConfig Environment Variable definition
env.Include = %system.teamcity.build.checkoutDir%\OpenSource
(3) TC build log snippet
[16:57:39]: [Project "xxx.sln" (Build target(s)):] e:\buildagent\work\ef1853a454da9d94\xxx\rowsbase.cpp(5, 0): error C1083: Cannot open include file: 'boost/dynamic_bitset.hpp': No such file or directory
First, you should try to compile the solution yourself with msbuild or vcbuild on the command line, because TeamCity will do something similar. If necessary, add msbuild folder to the Path system variable. Then open the command line and type:
msbuild.exe YourSolution.sln
or
msbuild.exe YourSolution.sln /p:Configuration=Release
depending whether you want to do so in debug or release mode. This should give the same C1083 errors.
Here's the fix:
Add the path of the directories you need to add an environment variable (in fact, system variable) that I suggest you call INCLUDE.
Open the file VCProjectEngine.dll.config.xml in folder .../Microsoft Visual Studio 9.0/VC/vcpackages/.
Add the INCLUDE system variable to the include line. To me it came to replacing:
Include="$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)\include;$(FrameworkSDKDir)include"
with:
Include="$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)\include;$(FrameworkSDKDir)include;$(INCLUDE)"
Test it works: Open a new command line (need to after you change environment variables for them to be taken into account) and try to build your solution as shown above. This has worked for me to build C++ solutions with files that #include .
Now let's have it work in TeamCity too. You can run a TC build at this point to see whether it does, but it didn't for me. Go to the "Properties and environment variables" of your TC build configuration, and add an environment variable named INCLUDE with value the same path(s) as in the INCLUDE system variable above.
Now this should work. Hope it helps.
Setting the Build Agent Service to run as a non "local System" account fixed my problem.
I ran into a problem were my C++ projects would build in Visual Studio on the build agent, but they failed when built through TC. The build agent is running windows and agent is running as a service (TeamCity Build Agent Service). The problem was that the service was being run as "Local System" instead of the user that configured Visual Studio. I change service so it would log on as the "build" user and everything worked fine.

Resources