所以我知道因为计时器可以自动收集垃圾吗?一开始System.Timers.Timer就不会被垃圾收集。
但我的实际问题是 - 我是否必须停止或处置计时器?
private void CreateTimer()
{
var timer = new Timer();
timer.Elapsed += TimerElapsed;
timer.Interval = 30000;
timer.AutoReset = true;
timer.Enabled = true;
}
Run Code Online (Sandbox Code Playgroud)
我的意思是这个计时器将永远运行。但是现在我不再需要在方法中创建计时器的对象了。我是否必须停止或处理Timer它被垃圾收集的东西?
我正在/t:packTFS-Build中创建一个nuget-package 。我不能使用Nuget-Pack-Step,因为我正在使用
<TargetFramework>netstandard2.0</TargetFramework>
Run Code Online (Sandbox Code Playgroud)
如何AssemblyVersion在Nuget包装上使用我的产品?因为我的Assembly-Version是正确的,但是我的Nuget版本始终保持不变1.0.0.0。
注意我正在使用C#文件而不是该.csproj文件作为我的程序集信息。
有没有可能?
想分享那个链接。
它是我的第一个 C++ 项目之一,我在使用 CMake 时遇到了问题。
我有一个带有可执行文件的 MyProject,我得到了一个带有 boost 单元测试的项目测试。我尝试了以下方法,但失败了。显然我不能以这种方式有两个可执行文件,我不知道如何修复它。
这是 MyProject 的 CMake
project (MyProject)
find_package( Boost 1.48.0 COMPONENTS thread )
set(MYPROJECT_SRCS main.cpp foo.h foo.cpp)
add_executable(MyProject ${MYPROJECT_SRCS})
target_link_libraries(MyProject ${Boost_LIBRARIES})
Run Code Online (Sandbox Code Playgroud)
这是测试的 CMake
project (tests)
find_package( Boost 1.48.0 COMPONENTS thread unit_test_framework)
find_package( Boost 1.48.0 COMPONENTS thread )
include_directories("../MyProject")
set(TEST_SRCS test.cpp )
add_executable(tests ${TEST_SRCS})
target_link_libraries(tests ${Boost_LIBRARIES} MyProject)
add_test( example_test tests )
Run Code Online (Sandbox Code Playgroud)
测试/CMakeLists.txt:13 (target_link_libraries) 中的 CMake 错误:
EXECUTABLE 类型的目标“MyProject”可能无法链接到另一个
目标。可以只链接到 STATIC 或 SHARED 库,或者链接到具有 ENABLE_EXPORTS 属性集的可执行文件。
我试图“ENABLE_EXPORTS 属性集”,但我认为我做错了。
我想使用这样的自定义 tfs 变量:
合并版本: $(BuildVersion.Major).$(BuildVersion.Minor).$(Date:yy)$(DayOfYear)$(Rev:.r)
我的问题是$(Date),$(Rev:r)并$(DateOfYear)没有在BuildNumberFormat的设置以外的工作。
我的结果是:
无效的版本字符串:'1.0.$(Date:yy)$(DayOfYear)$(Rev:.r)'。
使用此处显示的 buildnumberformat 时 - 正常工作:
结果$(Build.BuildNumber)是MyBuildName_1.0.18004.15
我想从我的私人 nuget 提要下载所有版本的所有软件包。就是这样。我在使用 powershell、bash、包管理器时没有任何问题。
我不能使用占位符项目 - 引用所有包并复制我的缓存,因为我需要所有版本。
任何的想法?
我正在与私人 nuget-feed 合作。饲料有点坏了,但我没有办法修理它。所以我必须走这条路......
我尝试计算TextBlock的高度。我不想在某些页面上使用 Textblock。我只需要知道我的内容的高度。
我这样试过,但它只返回 0
private static double CalculateContentHeight(string content, double width, double fontSize)
{
//Nur einen Textblock ggf. um Ressourcen zu sparen
TextBlock textblock = new TextBlock
{
FontSize = fontSize,
Text = content,
TextWrapping = TextWrapping.Wrap,
MaxWidth = width,
Height = Double.NaN
};
return textblock.ActualHeight;
}
Run Code Online (Sandbox Code Playgroud)
如果我在 XAML 中使用现有的 TextBlock 并且只是:
MyXAMLTextBlock.MaxWidth = 7;
double height = MyXAMLTextBlock.ActualHeight;
Run Code Online (Sandbox Code Playgroud)
我得到了正确的价值。
我知道 Meassure() 和 Arrange() 有可能像在这个例子中一样,但是 Meassure(Size) 需要大小参数,我没有它的高度。
我知道你可以用 Double.Nan 在 Auto 上设置大小,但它不能编译
double height = 9; …Run Code Online (Sandbox Code Playgroud) 我有错误
路径中的非法字符
当我尝试构建我的 WIX.Setup 时。我可以在以下组件中找到问题
<Component Id="C.Cef.Common.BrowserSubprocess.Core" Guid="{5603fa71-5739-4513-9cba-793a6f6d29ce}">
<File Id="CefSharp.BrowserSubprocess.Core.dll" Source="$(var.Path.Cefsharp.Commonx64)\CefSharp.BrowserSubprocess.Core.dll" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="C.Cef.Common.BrowserSubprocessexe" Guid="{5b0b77cd-7787-4c8a-b388-8042d179a788}">
<File Id="CefSharp.BrowserSubprocess.exe" Source="$(var.Path.Cefsharp.Commonx64)\CefSharp.BrowserSubprocess.exe" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="C.Cef.Common.Core" Guid="{98a016a2-50cb-4fdb-ae50-46f7f35ac270}">
<File Id="CefSharp.Core.dll" Source="$(var.Path.Cefsharp.Commonx64)\CefSharp.Core.dll" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="C.Cef.Common.CefSharp" Guid="{a181bbed-fc28-41c8-868d-8c1dd62dbc46}">
<File Id="CefSharp.dll" Source="$(var.Path.Cefsharp.Commonx64)\CefSharp.dll" KeyPath="yes" Checksum="yes"/>
</Component>
Run Code Online (Sandbox Code Playgroud)
如果我删除它们,它就会起作用。
<?define Path.Cefsharp.Commonx64 = "$(var.Path.Packages)\CefSharp.Common.55.0.0\CefSharp\x64 ?>
Run Code Online (Sandbox Code Playgroud)
非法字符在哪里?